Hello
I have a key error when I run the following code
import cobra
from cobra.io import read_sbml_model
from os.path import join
if __name__ == '__main__':
data_dir=('/Users/diana/OneDrive/Escritorio')
cobra.io.read_sbml_model(join(data_dir,"final12041.xml"))
model = cobra.io.read_sbml_model(join(data_dir,"final12041.xml"))
model.solver = ('glpk')
R1 = model.reactions.get_by_id('R_EX_C00031__extr')
growthRates = []
for i in range(20):
R1.lower_bound=-i
growthRates.append(model.objective.value)
print(growthRates)
This the key error
`Traceback (most recent call last):
File ~\OneDrive\Escritorio\untitled0.py:17 in <module>
print(model.reactions.get_by_id('R_EX_C00031__extr'))
File ~\anaconda3\lib\site-packages\cobra\core\dictlist.py:74 in get_by_id
return list.__getitem__(self, self._dict[id])
KeyError: 'R_EX_C00031__extr'`
Hello
I solved it. I had put the name of the reaction wrong because in the SBML format it appears R_EX_C00031__extr but in cobrapy it appears EX_C00031__extr.
Hello I have a key error when I run the following code
This the key error
Does everyone know how I can solve this issue?
Thanks.