AlmaasLab / AutoKEGGRec

AutoKEGGRec is an automated tool that creates first draft metabolic network reconstructions of single organisms, community reconstructions based on a list of organisms, and finally a consolidated reconstruction for a list of organisms. All reconstructions are based on data from KEGG.
GNU General Public License v3.0
7 stars 2 forks source link

Error using indexing #5

Closed niraito closed 5 months ago

niraito commented 5 months ago

Hey! It's nice to see this repository alive! 🤩

And here I am with an issue! 😁

I am trying to create a first draft reconstruction of A. thaliana metabolism with this code:

outputStructAth = AutoKEGGRec("T00041", 'ConsolidatedRec', 'writeSBML')

Here is the output:

This version of AutoKEGGRec is the published version, and might not be the most recent.
Please check the websites specified within the help function for the newest version.
The selected flags:
ConsolidatedRecflag
writeSBMLflag

KEGG organism codes:
T00041

Starting accessing the KEGG Database for the requested Organisms.
All organism URLs have been built, and the reactions, compound and EC number linkage have been downloaded.

Time so far running AutoKEGGRec: 123 seconds.

All organism gene-to-reaction linkages have been downloaded.
Compound-to-reaction and reaction-to-enzyme matrices built. Starting organism-to-reaction matrix now.
Error using indexing
The specified key is not present in this container.

Error in AutoKEGGRec (line 313)
        reactions = find(rxnEnzMat(:,enzRef(char(cellstr(organismGeneToECLists{i}(j,1)))))>0);

I included all output thinking that details can contribute some proof. But the last 4 lines are red 🙈

I might have only insufficient knowledge, please excuse me 🙈

niraito commented 5 months ago

I noticed that this is a repeat of the issue: Crash due to invalid EC number in organism annotation in AutoKEGGRec #4

emikar commented 5 months ago

Hi! Yes, we are hoping to continue maintaining and providing support as long as people keep using the tool. Thank you for your interest and feedback! Especially including all the printout really helps!

I was somewhat puzzled at the error you received, as the offending line should be within a try/catch block now to handle any issues with EC formatting, as that indeed addresses #4. If there is an issue with an EC number, the code should produce a Warning. Upon trying to reproduce the issue you posted, I got the following printout:

outputStructAth = AutoKEGGRec("T00041", 'ConsolidatedRec', 'writeSBML')
Running AutoKEGGRec...
Please check the websites specified within the help function for the newest version.
The selected flags:
ConsolidatedRecflag
writeSBMLflag

KEGG organism codes:
T00041

Starting accessing the KEGG Database for the requested organisms.
All organism URLs have been built, and the reactions, compound and EC number linkage have been downloaded.

Time so far running AutoKEGGRec: 31 seconds.

All organism gene-to-reaction linkages have been downloaded.
Compound-to-reaction and reaction-to-enzyme matrices built. Starting organism-to-reaction matrix now.
Warning: AutoKEGGRec: EC number: ec:5.6.2. not found in KEGG database. 
> In AutoKEGGRec (line 323) 
Matrices built.
Commencing assembly of reconstruction(s).
Number of KEGG reactions for the KEGG organism(s) queried:       2487
Downloading all reactions from KEGG (this takes a while).
Progress:

....................................................................................................
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

All reactions needed have been fetched.

Time so far running AutoKEGGRec: 1922 seconds.

Number of unque KEGG compounds for the organism(s) queried:       2345
Downloading all compounds from KEGG (this takes a while).
Progress: 

....................................................................................................
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

All compounds needed have been fetched.

Time so far running AutoKEGGRec: 3730 seconds.

Adding KEGG annotations to the compounds.
Building consolidated reconstruction.
Adding KEGG annotations to the reactions.
Adding protein annotations and updating gene names for each organism: 
     Organism: T00041 
Identifying major components and finding percentage of reactions present in them.
    Reactions in major component of the ConsolidatedRec:           99.12% 
Writing SBML file. This takes some time.
Writing ConsolidatedRec to file.
Each model.subSystems{x} has been changed to a character array.
Document written

AutoKEGGRec summary:

AutoKEGGRec completed its instructions in 3904 seconds. 

Organisms received as input:                                     1
KEGG reactions assessed:                                      2487
    Reactions marked as redundant:                              61
    Reactions marked as moved:                                  72
    Reactions containing glycans:                               65
    Reactions involving polymerization:                         12
    Reactions producing their own substrate:                    44
Unique compounds retrieved from KEGG:                         2345
Generic (massless) compounds identified:                       573
Reactions omitted for containing generic compounds:            714

Consolidated/generic reconstruction created for all the input organisms.

Thanks for using AutoKEGGRec. Please cite our paper:
 E.Karlsen, C.Schulz and E.Almaas 
 Automated generation of genome-scale metabolic draft reconstructions based on KEGG 
 BMC Bioinformatics 2018 

outputStructAth = 

  struct with fields:

    consolidatedStruct: [1×1 struct]

Note in particular the following:

Warning: AutoKEGGRec: EC number: ec:5.6.2. not found in KEGG database. 
> In AutoKEGGRec (line 323)

So it appears to correctly produce a Warning indicating that there is an issue with an EC number in the given organism's annotation, but the code runs its course. Is it possible you are using an old version?

We recommend you download the most recent version of the AutoKEGGRec.m script, try again with the same command, and get back to us. We hope this will resolve the issue, but if the problem persists, we will look further into it!

niraito commented 5 months ago

@emikar! You were right; I just had some confusion with using the path of the most recent version 🙈 It works very well! Thank you very much! ☺️🙏🏻

emikar commented 5 months ago

Happy to hear it worked out! Just let us know if you experience any other issues. Though do consider double-checking if you have the latest version first, haha; we strive to keep the most recent stable version on the main branch :)