cdanielmachado / carveme

CarveMe: genome-scale metabolic model reconstruction
Other
147 stars 50 forks source link

Error in running build_kegg_reactions #78

Closed yut8920 closed 4 years ago

yut8920 commented 4 years ago

Dear,

I use build_kegg_reactions function to translate reactions in iML1515.xml to KEGG reaction format.Here is my code: kegg_compounds = 'equilibrator_compounds.tsv' model = cobra.io.read_sbml_model('iML1515.xml') build_kegg_reactions(model, kegg_compounds) The error is: `TypeError Traceback (most recent call last)

in 1 kegg_compounds = 'equilibrator_compounds.tsv' 2 model = cobra.io.read_sbml_model('iML1515.xml') ----> 3 kegg_rxns = build_kegg_reactions(model, kegg_compounds) 4 kmodel = KeggModel.from_formulas(list(kegg_rxns.values()), raise_exception=True) 5 kmodel.add_thermo(CC.init()) in build_kegg_reactions(model, kegg_compounds) 10 11 for r_id in model.reactions: ---> 12 rxn_str = BiGG_to_KEGG_reaction(model, r_id, kegg_compounds) 13 if rxn_str: 14 kegg_rxns[r_id] = rxn_str in BiGG_to_KEGG_reaction(model, r_id, kegg_compounds) 12 No result is returned if unable to translate any compound. 13 """ ---> 14 reaction = model.reactions[r_id] 15 coeffs = [] 16 C:\Master\Python\anaconda\anaconda\lib\site-packages\cobra\core\dictlist.py in __getitem__(self, i) 404 return self.__class__(list.__getitem__(self, i)) 405 else: --> 406 return list.__getitem__(self, i) 407 408 def __setitem__(self, i, y): TypeError: list indices must be integers or slices, not Reaction` I try to use `load_cbmodel`to load model firstly,but it failed.It also made me confused. Thanks, Wentong
cdanielmachado commented 4 years ago

If you are just interested in doing thermodynamic calculations, it would be better for you to use the component-contribution package by @eladnoor directly:

https://gitlab.com/equilibrator/component-contribution

The code in CarveMe is using a very outdated version of the component contribution package.

eladnoor commented 4 years ago

Just a small update to what @cdanielmachado said, the python package is now called equilibrator-api and can be installed directly via pip.