Skip to content
Browse files

Implementing support values in CDAO, and adding a support value to th…

…e CDAO test file to test against.
  • Loading branch information...
1 parent 95a63b1 commit b603a0184c376ea12d860163018268c9b7527fcb @bendmorris bendmorris committed with etal Feb 13, 2013
Showing with 11 additions and 1 deletion.
  1. +10 −1 Bio/Phylo/CDAOIO.py
  2. +1 −0 Tests/CDAO/test.cdao
View
11 Bio/Phylo/CDAOIO.py
@@ -171,6 +171,7 @@ def new_clade(self, node):
kwargs = {}
if 'branch_length' in result: kwargs['branch_length'] = result['branch_length']
if 'label' in result: kwargs['name'] = result['label'].replace('_', ' ')
+ if 'confidence' in result: kwargs['confidence'] = result['confidence']
clade = CDAO.Clade(**kwargs)
@@ -203,6 +204,7 @@ def get_node_info(self, model, context=None):
qUri('cdao:has_Value'): 'value',
qUri('cdao:represents_TU'): 'tu',
qUri('rdf:label'): 'label',
+ qUri('cdao:has_Support_Value'): 'confidence',
}
try:
@@ -232,6 +234,9 @@ def get_node_info(self, model, context=None):
annotation = self.obj_info[edge['annotation']]
if 'value' in annotation:
node_info['branch_length'] = float(annotation['value'])
+
+ if 'confidence' in edge:
+ node_info['confidence'] = float(edge['confidence'])
if 'tu' in obj:
# if this object points to a TU, we need the label of that TU
@@ -438,7 +443,11 @@ def process_clade(self, clade, parent=None, root=False):
(nUri(edge_uri), qUri('cdao:has_Annotation'), nUri(edge_ann_uri)),
(nUri(edge_ann_uri), qUri('cdao:has_Value'), branch_length),
]
- # TODO: annotate with confidences?
+ if hasattr(clade, 'confidence') and not clade.confidence is None:
+ confidence = RDF.Node(literal=str(clade.confidence),
+ datatype=RDF.Uri('http://www.w3.org/2001/XMLSchema#decimal'))
+
+ statements += [(nUri(edge_uri), qUri('cdao:has_Support_Value'), confidence)]
for stmt in statements:
yield RDF.Statement(*stmt)
View
1 Tests/CDAO/test.cdao
@@ -32,6 +32,7 @@
obo:CDAO_0000200 <tree0000001#tree0000001> ;
obo:CDAO_0000201 <tree0000001#node0000004> ;
obo:CDAO_0000209 <tree0000001#node0000005> ;
+ obo:CDAO_0000214 20.0 ;
a obo:CDAO_0000139 .
<tree0000001#edge0000005>

0 comments on commit b603a01

Please sign in to comment.
Something went wrong with that request. Please try again.