althonos / pronto

A Python frontend to (Open Biomedical) Ontologies.
https://pronto.readthedocs.io
MIT License
229 stars 48 forks source link

Impossible getting synonym type #218

Closed CarMoreno closed 7 months ago

CarMoreno commented 7 months ago

I am using ChEBI Ontology to get synonym type from a compound, however, when I try to use synonym.type I am getting None. I found this related issue #12 , and I guess this should not be happening in version 2.5.5 because it seems issue was resolved in version 1.0.0

<owl:Class rdf:about="http://purl.obolibrary.org/obo/CHEBI_4508">
        <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/CHEBI_26218"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://purl.obolibrary.org/obo/BFO_0000051"/>
                <owl:someValuesFrom rdf:resource="http://purl.obolibrary.org/obo/CHEBI_48311"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The potassium salt of diclofenac.</obo:IAO_0000115>
        <chebi:charge rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</chebi:charge>
        <chebi:formula rdf:datatype="http://www.w3.org/2001/XMLSchema#string">C14H10Cl2NO2.K</chebi:formula>
        <chebi:inchi rdf:datatype="http://www.w3.org/2001/XMLSchema#string">InChI=1S/C14H11Cl2NO2.K/c15-10-5-3-6-11(16)14(10)17-12-7-2-1-4-9(12)8-13(18)19;/h1-7,17H,8H2,(H,18,19);/q;+1/p-1</chebi:inchi>
        <chebi:inchikey rdf:datatype="http://www.w3.org/2001/XMLSchema#string">KXZOIWWTXOCYKR-UHFFFAOYSA-M</chebi:inchikey>
        <chebi:mass rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">334.243</chebi:mass>
        <chebi:monoisotopicmass rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">332.97257</chebi:monoisotopicmass>
        <chebi:smiles rdf:datatype="http://www.w3.org/2001/XMLSchema#string">O=C([O-])Cc1ccccc1Nc1c(Cl)cccc1Cl.[K+]</chebi:smiles>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Beilstein:6625757</oboInOwl:hasDbXref>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CAS:15307-81-0</oboInOwl:hasDbXref>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DrugBank:DB00586</oboInOwl:hasDbXref>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">KEGG:D00903</oboInOwl:hasDbXref>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PMID:1502708</oboInOwl:hasDbXref>
        <oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">potassium {2-[(2,6-dichlorophenyl)amino]phenyl}acetate</oboInOwl:hasExactSynonym>
        <oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">chebi_ontology</oboInOwl:hasOBONamespace>
        <oboInOwl:hasRelatedSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2-((2,6-dichlorophenyl)amino)benzeneacetic acid, monopotassium salt</oboInOwl:hasRelatedSynonym>
        <oboInOwl:hasRelatedSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Cataflam</oboInOwl:hasRelatedSynonym>
        <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CHEBI:4508</oboInOwl:id>
        <oboInOwl:inSubset rdf:resource="http://purl.obolibrary.org/obo/chebi/3_STAR"/>
        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">diclofenac potassium</rdfs:label>
</owl:Class>
<owl:Axiom>
        <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/CHEBI_4508"/>
        <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasExactSynonym"/>
        <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">potassium {2-[(2,6-dichlorophenyl)amino]phenyl}acetate</owl:annotatedTarget>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">IUPAC</oboInOwl:hasDbXref>
        <oboInOwl:hasSynonymType rdf:resource="http://purl.obolibrary.org/obo/chebi/IUPAC_NAME"/>
</owl:Axiom>
<owl:Axiom>
        <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/CHEBI_4508"/>
        <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
        <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2-((2,6-dichlorophenyl)amino)benzeneacetic acid, monopotassium salt</owl:annotatedTarget>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ChemIDplus</oboInOwl:hasDbXref>
</owl:Axiom>
<owl:Axiom>
        <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/CHEBI_4508"/>
        <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
        <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Cataflam</owl:annotatedTarget>
        <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DrugBank</oboInOwl:hasDbXref>
        <oboInOwl:hasSynonymType rdf:resource="http://purl.obolibrary.org/obo/chebi/BRAND_NAME"/>
</owl:Axiom>

I am waiting something like:

[
  frozenset({
      Synonym('Cataflam', scope='RELATED', xrefs={Xref('DrugBank')}, type="BRAND_NAME"), 
      Synonym('2-((2,6-dichlorophenyl)amino)benzeneacetic acid, monopotassium salt', scope='RELATED', xrefs={Xref('ChemIDplus')}, type=None), 
      Synonym('potassium {2-[(2,6-dichlorophenyl)amino]phenyl}acetate', scope='EXACT', xrefs={Xref('IUPAC')}, type="IUPAC_NAME")
  })
]

However, I am getting None for all synonym types.

Maybe I am doing something wrong? Thanks for your help

CarMoreno commented 7 months ago

Hi @althonos 👋 , Have you had a chance to take a look? 😄 Thank you

althonos commented 7 months ago

Hi @CarMoreno, I'll have a look :+1:

althonos commented 7 months ago

Ok so this was actually two bugs in one:

I'll push a patch release!

CarMoreno commented 7 months ago

It works like a charm! thank you very much 👍