draeger-lab / ModelPolisher

ModelPolisher accesses the BiGG Models knowledgebase to annotate SBML models.
23 stars 7 forks source link

Polished model read with errors in cobrapy #103

Closed EnuhBlaise closed 1 year ago

EnuhBlaise commented 3 years ago

Hello, I am developed an draft model reconstruction with Carveme and used ModelPolisher with docker for the annotations. I got the model output but on opening with CobraPy I got errors as below.

"MNXR98569 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98641 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98003 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98012 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98643 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98639 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98014 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98700 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98047 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98061 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR97540 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98062 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98256 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98349 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98180 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98086 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98278 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id", "MNXR98058 does not conform to 'http(s)://identifiers.org/collection/id' or'http(s)://identifiers.org/COLLECTION:id",

There are several more lines. Using the SBML validator in cobrapy these are the errors that appear as well under 'COBRA_WARNING', other tests look fine Is it something wrong I am doing or is there another step to do in order to get rid of the errors.

Thank you for considering

Enuh

mephenor commented 3 years ago

Could you provide one of the respective annotations from the ModelPolisher Output?

EnuhBlaise commented 3 years ago
Gene identifier | fig_29330_40_peg_3551 -- | -- Name | G_fig_29330_40_peg_3551 Memory address | 0x07ff361790650 Functional | True In 1 reaction(s) | ACCOAC

This is what the gene annotation from a random gene in the output model shows.

mephenor commented 3 years ago

Sorry, I meant the annotation in the SBML file

EnuhBlaise commented 3 years ago

ohh Sorry for that. image

mephenor commented 3 years ago

What I need from that is the URI it produces, e.g. I have https://identifiers.org/metanetx.reaction/MNXR98569 in one my output models. This should be present in the SBML XML file and the surrounding parts should look something like this:

 135497           <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/">
 135498             <rdf:Description rdf:about="#EX_glc__D_e">
 135499               <bqbiol:is>
 135500                 <rdf:Bag>
 135501                   <rdf:li rdf:resource="https://identifiers.org/metanetx.reaction/MNXR98569" />
 135502                   <rdf:li rdf:resource="https://identifiers.org/bigg.reaction/EX_glc__D_e" />
 135503                   <rdf:li rdf:resource="https://identifiers.org/sbo/SBO:0000627" />
 135504                   <rdf:li rdf:resource="https://identifiers.org/biocyc/META:TRANS-RXN0-574" />
 135505                   <rdf:li rdf:resource="https://identifiers.org/metanetx.reaction/MNXR100188" />
 135506                   <rdf:li rdf:resource="https://identifiers.org/seed.reaction/rxn08617" />
 135507                   <rdf:li rdf:resource="https://identifiers.org/seed.reaction/rxn09679" />
 135508                   <rdf:li rdf:resource="https://identifiers.org/seed.reaction/rxn09875" />
 135509                 </rdf:Bag>
 135510               </bqbiol:is>
 135511             </rdf:Description>
 135512           </rdf:RDF>
 135513         </annotation>
EnuhBlaise commented 3 years ago

Sorry for the mix up. I hope I got it right this time.

mephenor commented 3 years ago

I don't see an issue with this annotation. <rdf:li rdf:resource="https://identifiers.org/metanetx.reaction/MNXR100381" /> -> is this one of the identifiers you get the errors/warnings for? If so, this might rather be an issue with CobraPy

EnuhBlaise commented 3 years ago

Yes it was and this is still another. In that case, I will try opening the model in matlab as well to see if anything comes up

Midnighter commented 3 years ago

Hi, from what you posted above, I think the issue is with

<rdf:li rdf:resource="MNXR99051" />

The other annotations look fine.

EnuhBlaise commented 3 years ago

Hello @Midnighter, What are you recommendations about the fields with same issue?

Midnighter commented 3 years ago

I don't know how they are created, i.e., whether it was carveme, you, or model polisher who created that annotation. They should look like this field:

<rdf:li rdf:resource="https://identifiers.org/metanetx.reaction/MNXR105270" />
mephenor commented 3 years ago

ModelPolisher should not add such annotations, as there is some code to check with the identifiers.org registry to validate that identifiers match the collection pattern, i.e. you would get a warning message that there is a mismatch and the annotation was not added. However, annotations that are already present are not removed if they can't be fixed.

EnuhBlaise commented 3 years ago

Ok I understand now. I had not put in any annotations manually myself. I will go over the reconstruction process again and verify closely.

Thank you @mephenor and @Midnighter for your help.

EnuhBlaise commented 3 years ago

Hello @mephenor and @Midnighter I succeeded to resolve the issue. I had to restart the building process and manually handle the annotations.

Thank you

GwennyGit commented 1 year ago

The same problem occurs with my model. I used CarveMe version 1.5.1 to build the draft model. Then I applied the not yet published refineGEMs python package from the Dräger lab GitHub using the modules polish, KEGG pathways as groups, charge correction and SBO annotation. Each module creates a new model which is checked by the function cobra.io.sbml.validate_sbml_model from COBRApy version 0.22.0 which gave me for each of the steps neither errors nor warnings. After using ModelPolisher with docker as described in the README, I get the following warnings with cobra.io.sbml.validate_sbml_model for 165 entries. Example warning: MNXR98014 does not conform to 'http(s):[//identifiers.org/collection/id](https://compsysbio-group.slack.com//identifiers.org/collection/id)' or'http(s):[//identifiers.org/COLLECTION:id](https://compsysbio-group.slack.com//identifiers.org/COLLECTION:id) Additionally, I compared the models before and after ModelPolisher. Before ModelPolisher the reaction looked like this:

      </reaction>
      <reaction metaid="R_EX_2hxmp_e" sboTerm="SBO:0000627" id="R_EX_2hxmp_e" name="R_EX_2hxmp_e" reversible="true" fast="false" fbc:lowerFluxBound="cobra_default_lb" fbc:upperFluxBound="cobra_default_ub">
        <notes>
          <html xmlns="http://www.w3.org/1999/xhtml">
            <p>SBOTerm: SBO:0000627</p>
          </html>
        </notes>
        <annotation>
          <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
            <rdf:Description rdf:about="#R_EX_2hxmp_e">
              <bqbiol:is>
                <rdf:Bag>
                  <rdf:li rdf:resource="https://identifiers.org/bigg.reaction/EX_2hxmp_e"/>
                </rdf:Bag>
              </bqbiol:is>
            </rdf:Description>
          </rdf:RDF>
        </annotation>
        <listOfReactants>
          <speciesReference species="M_2hxmp_e" stoichiometry="1" constant="true"/>
        </listOfReactants>
      </reaction>

And after ModelPolisher the same reaction looks like this:

      <reaction compartment="e" fast="false" fbc:lowerFluxBound="cobra_default_lb" fbc:upperFluxBound="cobra_default_ub" id="R_EX_2hxmp_e" metaid="R_EX_2hxmp_e" name="2  Hydroxymethyl phenol exchange" reversible="true" sboTerm="SBO:0000627">
        <notes>
          <body xmlns="http://www.w3.org/1999/xhtml">
            <p>SBOTerm: SBO:0000627</p>
          </body>
        </notes>
        <annotation>
          <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
            <rdf:Description rdf:about="#R_EX_2hxmp_e">
              <bqbiol:is>
                <rdf:Bag>
                  <rdf:li rdf:resource="https://identifiers.org/bigg.reaction/EX_2hxmp_e" />
                  <rdf:li rdf:resource="MNXR98014" />
                  <rdf:li rdf:resource="https://identifiers.org/biocyc/META:TRANS-RXN0-528" />
                  <rdf:li rdf:resource="https://identifiers.org/metanetx.reaction/MNXR124044" />
                </rdf:Bag>
              </bqbiol:is>
            </rdf:Description>
          </rdf:RDF>
        </annotation>
        <listOfReactants>
          <speciesReference constant="true" sboTerm="SBO:0000010" species="M_2hxmp_e" stoichiometry="1" />
        </listOfReactants>
      </reaction>

I realised that two metanetx.reaction identifiers were added, namely MNXR98014 and MNXR124044. From both of these only one was added correctly: <rdf:li rdf:resource="https://identifiers.org/metanetx.reaction/MNXR124044" /> while the other one was added like this: <rdf:li rdf:resource="MNXR98014" />. I looked at three different warnings randomly and each looked similar to the reaction mentioned before. Hence, I think the warnings come from the wrongly added metanetx.reaction identifiers. Though, I do not know why two are added and one is added correctly while the other one is not.

GwennyGit commented 1 year ago

I just realised that this problem was also discussed in issue #106, hence I will close this issue again.

draeger commented 1 year ago

It looks like the prefix (i.e., https://identifiers.org...) for the annotation resource <rdf:li rdf:resource="MNXR98014" /> is missing or anything else? If so, this could be fixed using a simple search and replace because the identifiers from MetaNetX start with MNXR. If this is a general problem of ModelPolisher, an issue should be raised there as well.