"name" Data Type Property in BioPAX format

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"name" Data Type Property in BioPAX format

sam.regenbogen
Hello, I apologize if this is a very basic question.
I'm trying to work with the BioPAX Level 3 ontology format with owlready2.  Specifically, I'm wanting to use biopax-formatted files that define various biological entities as individuals.

I was able to import the biopax-level3 ontology itself into owlready2 as-is, and I've gotten the individuals files to import too (after loading into protégé and re-exporting).

My trouble now is that BioPAX uses a "bp:name" datatype property to define synonyms for an entity. The "displayName" and "standardName" sub-properties are functional, but a given entity can have an arbitrary number of "name" properties -- and these are the synonyms that I need to access.

For example:

...
                <bp:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">hydrogen ion</bp:name>
                <bp:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">proton</bp:name>
                <bp:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">H</bp:name>
              </bp:SmallMoleculeReference>
...

The problem is that owlready2 uses ".name" as an attribute, and is using the RDF IDs as the "bp.name" property for entities. As far as I can tell, those <bp:name> datatype properties are never getting imported.

Is that correct, and is this portion of the biopax specification not compatible with owlready?  Or is there something obvious and simple that I'm just missing?

Thanks for any help and patience!

Sam Regenbogen
Data Scientist
Mercury Data Science
Reply | Threaded
Open this post in threaded view
|

Re: "name" Data Type Property in BioPAX format

Jiba
Administrator
Hello,

Owlready uses the "name" attribute, so there is indeed a name-clash.

You can solve the problem using one of these two approaches:

 * Declare a Python-alias attribute name for the BioPAX name property.

bp = get_ontology("http://www.biopax.org/release /biopax-level3.owl").load()
bp.name.python_name = "biopax_name"

    And then use "biopax_name" instead of "name" :

print(obj.biopax_name)

 * Use the alternative syntax "property[obj]".

bp = get_ontology("http://www.biopax.org/release /biopax-level3.owl").load()
print(bp.name[obj])


Best regards,
Jiba
Reply | Threaded
Open this post in threaded view
|

Re: "name" Data Type Property in BioPAX format

sam.regenbogen
Hi Jiba, thank you so much for your reply.

Using a Python-alias for the attribute seems perfect; however, I'm getting errors indicating that it's trying to assign to the owlready "name" attribute:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-5c6217fc54e4> in <module>
      1 bp = get_ontology("http://www.biopax.org/release/biopax-level3.owl").load()
----> 2 bp.name.python_name = "biopax_name"

AttributeError: 'str' object has no attribute 'python_name'

-----

It seems like I would need to assign the alias before the owlready "name" attribute gets created, which I am guessing would require some pretty deep hacking into the owlready2 code...
Alternatively, I could rename the BioPAX "name" property in a local copy of the biopax-level3.owl file and point my biopax-formatted individuals files to import the local copy instead?

Does that seem like my best option?

Thank you for your support!
Sam
Reply | Threaded
Open this post in threaded view
|

Re: "name" Data Type Property in BioPAX format

Jiba
Administrator
Hi,

The ontology object also has a "name" attribute, so there was a mistake in my answer.
You can use the alternative ontology["name"] syntax to get the "name" entity, as follows:

bp["name"].python_name = "biopax_name"

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: "name" Data Type Property in BioPAX format

sam.regenbogen
That worked, thank you so much!!