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

Impossible getting synonym type #218

Closed
CarMoreno opened this issue Feb 16, 2024 · 4 comments
Closed

Impossible getting synonym type #218

CarMoreno opened this issue Feb 16, 2024 · 4 comments
Labels
bug Issues or pull requests that specify a bug.

Comments

@CarMoreno
Copy link

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
Copy link
Author

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

@althonos
Copy link
Owner

Hi @CarMoreno, I'll have a look 👍

@althonos althonos added the bug Issues or pull requests that specify a bug. label Feb 21, 2024
@althonos
Copy link
Owner

Ok so this was actually two bugs in one:

  • the synonym type extraction in the RDF/XML parser was using the element text instead of the rdf:resource when extracting the synonym type; so this would work:
    <oboInOwl:hasSynonymType>BRAND_NAME</oboInOwl:hasSynonymType>
    but not this:
    <oboInOwl:hasSynonymType rdf:resource="http://purl.obolibrary.org/obo/chebi/BRAND_NAME"/>
  • the synonym type was not updated if a synonym was already declared previous: in here, for instance, the Cataflam synonym was declared without a synonym type inside the owl:class element, but then was redeclared as part of its own owl:Axiom; in that case the previously created Synonym was updated, but not its type.

I'll push a patch release!

@CarMoreno
Copy link
Author

It works like a charm! thank you very much 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or pull requests that specify a bug.
Projects
None yet
Development

No branches or pull requests

2 participants