sys-bio/roadrunner

order of metabolites in stoichiometric matrix not consistent depending on where it is run

janisshin opened this issue · 5 comments

when I call r.getFullStoichiometryMatrix(), the order of the metabolites changes depending on whether the method is called in a class or in a Jupyter notebook. From what I can tell, the order of the reactions remains constant.

Since I am passing in the stoichiometry matrix back and forth for matrix operations, the consistency of the order of the metabolites is crucial. Can you make the order consistent like the order of reactions? Thanks.

hsauro commented

Also, when I call r.getFloatingSpeciesIds(), the order is different in a Jupyter notebook (first image) than when I call it in a class (second image).

image
image
In the second image, r.getIndependentFloatingSpeciesIds() is stored in variable a and r.getFloatingSpeciesIds() is stored in variable b.

Okay, I think I got to the bottom of the issue.

import tellurium as te

# load the Teusink model
ant_file = 'data/interim/Antimony/BIOMD0000000064_e.ant'
r = te.loada(ant_file)
print(r.getFullStoichiometryMatrix())

ant_file = 'data/interim/Antimony/BIOMD0000000064_e.ant'
s  = te.loada(ant_file)
s.steadyState()
print(s.getFullStoichiometryMatrix())

For some reason, running s.steadyState changes the order of the floating species.
image

hsauro commented

this generally works, but if I'm converting my antimony to sbml for running on Cobra, then Cobra uses the order of metabolites that is the same order as the one prior to running conservation on antimony. So, it would be nice if we could always just use one order instead of having the user be responsible for converting each time the model is loaded in both antimony and cobra.