Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access property_value tags? #227

Open
chrishmorris opened this issue May 15, 2024 · 1 comment
Open

How to access property_value tags? #227

chrishmorris opened this issue May 15, 2024 · 1 comment
Labels
question A question about the library.

Comments

@chrishmorris
Copy link
Contributor

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?

@althonos
Copy link
Owner

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')}

@althonos althonos added the question A question about the library. label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question about the library.
Projects
None yet
Development

No branches or pull requests

2 participants