Skip to content
This repository
Browse code

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

…e CDAO test file to test against.
  • Loading branch information...
commit b603a0184c376ea12d860163018268c9b7527fcb 1 parent 95a63b1
Ben Morris bendmorris authored etal committed

Showing 2 changed files with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. +10 1 Bio/Phylo/CDAOIO.py
  2. +1 0  Tests/CDAO/test.cdao
11 Bio/Phylo/CDAOIO.py
@@ -171,6 +171,7 @@ def new_clade(self, node):
171 171 kwargs = {}
172 172 if 'branch_length' in result: kwargs['branch_length'] = result['branch_length']
173 173 if 'label' in result: kwargs['name'] = result['label'].replace('_', ' ')
  174 + if 'confidence' in result: kwargs['confidence'] = result['confidence']
174 175
175 176 clade = CDAO.Clade(**kwargs)
176 177
@@ -203,6 +204,7 @@ def get_node_info(self, model, context=None):
203 204 qUri('cdao:has_Value'): 'value',
204 205 qUri('cdao:represents_TU'): 'tu',
205 206 qUri('rdf:label'): 'label',
  207 + qUri('cdao:has_Support_Value'): 'confidence',
206 208 }
207 209
208 210 try:
@@ -232,6 +234,9 @@ def get_node_info(self, model, context=None):
232 234 annotation = self.obj_info[edge['annotation']]
233 235 if 'value' in annotation:
234 236 node_info['branch_length'] = float(annotation['value'])
  237 +
  238 + if 'confidence' in edge:
  239 + node_info['confidence'] = float(edge['confidence'])
235 240
236 241 if 'tu' in obj:
237 242 # 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):
438 443 (nUri(edge_uri), qUri('cdao:has_Annotation'), nUri(edge_ann_uri)),
439 444 (nUri(edge_ann_uri), qUri('cdao:has_Value'), branch_length),
440 445 ]
441   - # TODO: annotate with confidences?
  446 + if hasattr(clade, 'confidence') and not clade.confidence is None:
  447 + confidence = RDF.Node(literal=str(clade.confidence),
  448 + datatype=RDF.Uri('http://www.w3.org/2001/XMLSchema#decimal'))
  449 +
  450 + statements += [(nUri(edge_uri), qUri('cdao:has_Support_Value'), confidence)]
442 451
443 452 for stmt in statements:
444 453 yield RDF.Statement(*stmt)
1  Tests/CDAO/test.cdao
@@ -32,6 +32,7 @@
32 32 obo:CDAO_0000200 <tree0000001#tree0000001> ;
33 33 obo:CDAO_0000201 <tree0000001#node0000004> ;
34 34 obo:CDAO_0000209 <tree0000001#node0000005> ;
  35 + obo:CDAO_0000214 20.0 ;
35 36 a obo:CDAO_0000139 .
36 37
37 38 <tree0000001#edge0000005>

0 comments on commit b603a01

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