dhimmel / obonet

OBO-formatted ontologies → networkx (Python 3)
https://github.com/dhimmel/obonet/blob/main/examples/go-obonet.ipynb
Other
136 stars 28 forks source link

Parse failure when `name` key is used in ontology header #20

Closed cthoyt closed 3 years ago

cthoyt commented 3 years ago

The latest version of OMRSE includes both the ontology and name key in its header. This breaks the following lines:

https://github.com/dhimmel/obonet/blob/0ce7c81d7206ada2bff5204f3158847aa195dfe2/obonet/read.py#L29-L31

Minimal example:

>>> import obonet
>>> url = 'https://github.com/ufbmi/OMRSE/raw/master/omrse-full.obo'
>>> graph = obonet.read_obo(url)
Traceback (most recent call last):
  File "/Users/cthoyt/dev/obonet/examples/ex.py", line 4, in <module>
    obonet.read_obo(url)
  File "/Users/cthoyt/dev/obonet/obonet/read.py", line 26, in read_obo
    graph = networkx.MultiDiGraph(
TypeError: networkx.classes.multidigraph.MultiDiGraph() got multiple values for keyword argument 'name'

Possible solutions:

dhimmel commented 3 years ago

Here's the offending header:

format-version: 1.2
data-version: omrse/releases/2021-03-22/omrse-base.owl
remark: This ontology grew out of efforts to represent the reality underlying the demographic information required by the US federal government's \"meaningful use\" criteria for electronic medical records and a presentation by Dr. William Hogan at the Electronic Health Record of the Future conference in Buffalo, NY http://ontology.buffalo.edu/EHR/Demographics_Hogan_Buffalo_2010_09_22.ppt
ontology: omrse/omrse-base
property_value: http://purl.org/dc/elements/1.1/contributor "Daniel Welch" xsd:string
property_value: http://purl.org/dc/elements/1.1/creator "Amanda Hicks" xsd:string
property_value: http://purl.org/dc/elements/1.1/creator "Mathias Brochhausen" xsd:string
property_value: http://purl.org/dc/elements/1.1/creator "Shariq Tariq" xsd:string
property_value: http://purl.org/dc/elements/1.1/creator "Swetha Garimalla" xsd:string
property_value: http://purl.org/dc/elements/1.1/creator "William Hogan" xsd:string
property_value: http://purl.org/dc/elements/1.1/type IAO:8000001
property_value: http://purl.org/dc/terms/license https://creativecommons.org/licenses/by/4.0/ xsd:string
property_value: owl:versionInfo "2020-10-27" xsd:string
property_value: owl:versionInfo "2021-03-22" xsd:string
name: The Ontology of Medically Related Social Entities