pronto
pronto copied to clipboard
How to access property_value tags?
taxslim.obo has e.g.
[Term]
id: NCBITaxon:10
name: Cellvibrio
namespace: ncbi_taxonomy
xref: GC_ID:11
xref: PMID:12710603
xref: PMID:24105943
is_a: NCBITaxon:1706371 ! Cellvibrionaceae
property_value: has_rank NCBITaxon:genus
If I read it and export it again with pronto.Ontology("download/taxslim.obo").dumps(format="obo") then property_value lines correctly appear in the output, so they are clearly parsed and incorporated into the Ontology instance.
But I can't figure out how to access them. Both ontology.relationships()
and ontology["NCBITaxon:10"].relationships
are empty.
What am I missing, please?
Hi @chrishmorris,
Property values get written to the annotations
of each entity, as a set of PropertyValue
objects:
>>> taxslim = pronto.Ontology.from_obo_library("ncbitaxon/subsets/taxslim.obo")
>>> taxslim["NCBITaxon:10"].annotations
{ResourcePropertyValue('has_rank', 'NCBITaxon:genus')}