Skip to content

Commit

Permalink
Support values are node-level attributes, not edge-level.
Browse files Browse the repository at this point in the history
  • Loading branch information
bendmorris authored and etal committed Feb 15, 2013
1 parent f9f4315 commit 2201c65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions Bio/Phylo/CDAOIO.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ def get_node_info(self, model, context=None):
if 'value' in annotation: if 'value' in annotation:
node_info['branch_length'] = float(annotation['value']) node_info['branch_length'] = float(annotation['value'])


if 'confidence' in edge:
node_info['confidence'] = float(edge['confidence'])

if 'tu' in obj: if 'tu' in obj:
# if this object points to a TU, we need the label of that TU # if this object points to a TU, we need the label of that TU
tu = self.obj_info[obj['tu']] tu = self.obj_info[obj['tu']]
Expand Down Expand Up @@ -425,6 +422,13 @@ def process_clade(self, clade, parent=None, root=False):
(nUri(clade.uri), qUri('cdao:has_Parent'), nUri(parent.uri)), (nUri(clade.uri), qUri('cdao:has_Parent'), nUri(parent.uri)),
(nUri(parent.uri), qUri('cdao:belongs_to_Edge_as_Parent'), nUri(edge_uri)), (nUri(parent.uri), qUri('cdao:belongs_to_Edge_as_Parent'), nUri(edge_uri)),
] ]

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(clade.uri), qUri('cdao:has_Support_Value'), confidence)]



if len(clade.ancestors) > 0: if len(clade.ancestors) > 0:
#ancestors = RDF.Node(literal=str(len(clade.ancestors)), #ancestors = RDF.Node(literal=str(len(clade.ancestors)),
Expand All @@ -443,11 +447,6 @@ def process_clade(self, clade, parent=None, root=False):
(nUri(edge_uri), qUri('cdao:has_Annotation'), nUri(edge_ann_uri)), (nUri(edge_uri), qUri('cdao:has_Annotation'), nUri(edge_ann_uri)),
(nUri(edge_ann_uri), qUri('cdao:has_Value'), branch_length), (nUri(edge_ann_uri), qUri('cdao:has_Value'), branch_length),
] ]
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: for stmt in statements:
yield RDF.Statement(*stmt) yield RDF.Statement(*stmt)
Expand Down
2 changes: 1 addition & 1 deletion Tests/CDAO/test.cdao
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
obo:CDAO_0000200 <tree0000001#tree0000001> ; obo:CDAO_0000200 <tree0000001#tree0000001> ;
obo:CDAO_0000201 <tree0000001#node0000004> ; obo:CDAO_0000201 <tree0000001#node0000004> ;
obo:CDAO_0000209 <tree0000001#node0000005> ; obo:CDAO_0000209 <tree0000001#node0000005> ;
obo:CDAO_0000214 20.0 ;
a obo:CDAO_0000139 . a obo:CDAO_0000139 .


<tree0000001#edge0000005> <tree0000001#edge0000005>
Expand Down Expand Up @@ -815,6 +814,7 @@
obo:CDAO_0000177 <tree0000001#edge0000004>, <tree0000001#edge0000053> ; obo:CDAO_0000177 <tree0000001#edge0000004>, <tree0000001#edge0000053> ;
obo:CDAO_0000179 <tree0000001#node0000003> ; obo:CDAO_0000179 <tree0000001#node0000003> ;
obo:CDAO_0000200 <tree0000001#tree0000001> ; obo:CDAO_0000200 <tree0000001#tree0000001> ;
obo:CDAO_0000214 20.0 ;
a obo:CDAO_0000026 . a obo:CDAO_0000026 .


<tree0000001#node0000005> <tree0000001#node0000005>
Expand Down

0 comments on commit 2201c65

Please sign in to comment.