Skip to content

Commit

Permalink
Only add an edge annotation/branch length if the clade specifies a br…
Browse files Browse the repository at this point in the history
…anch length.
  • Loading branch information
bendmorris committed Aug 26, 2013
1 parent dce183e commit b8b630b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Bio/Phylo/CDAOIO.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -379,16 +379,17 @@ def process_clade(self, clade, parent=None, root=False):
statements += [(nUri(clade.uri), pUri('cdao:has_Ancestor'), nUri(ancestor)) statements += [(nUri(clade.uri), pUri('cdao:has_Ancestor'), nUri(ancestor))
for ancestor in clade.ancestors] for ancestor in clade.ancestors]


# add branch length if not clade.branch_length is None:
edge_ann_uri = 'edge_annotation%s' % str(self.edge_counter).zfill(ZEROES) # add branch length

edge_ann_uri = 'edge_annotation%s' % str(self.edge_counter).zfill(ZEROES)
branch_length = rdflib.Literal(clade.branch_length, datatype=rdflib.URIRef('http://www.w3.org/2001/XMLSchema#decimal'))
statements += [ branch_length = rdflib.Literal(clade.branch_length, datatype=rdflib.URIRef('http://www.w3.org/2001/XMLSchema#decimal'))
(nUri(edge_ann_uri), qUri('rdf:type'), qUri('cdao:EdgeLength')), statements += [
(nUri(edge_uri), qUri('cdao:has_Annotation'), nUri(edge_ann_uri)), (nUri(edge_ann_uri), pUri('rdf:type'), pUri('cdao:EdgeLength')),
(nUri(edge_ann_uri), qUri('cdao:has_Value'), branch_length), (nUri(edge_uri), pUri('cdao:has_Annotation'), nUri(edge_ann_uri)),
] (nUri(edge_ann_uri), pUri('cdao:has_Value'), branch_length),

]

try: edge_attributes = clade.edge_attributes try: edge_attributes = clade.edge_attributes
except AttributeError: edge_attributes = [] except AttributeError: edge_attributes = []


Expand Down

0 comments on commit b8b630b

Please sign in to comment.