opencobra / cobrapy

COBRApy is a package for constraint-based modeling of metabolic networks.
http://opencobra.github.io/cobrapy/
GNU General Public License v2.0
461 stars 216 forks source link

Implement model reduction #592

Closed pstjohn closed 1 year ago

pstjohn commented 7 years ago

I think this would be an awesome addition to the cobrapy package. Specifically if we ever get to #293 we'll probably want something to reversibly compress / expand cobra models.

@jlerman44, hopefully you don't mind me sharing your gist from the gitter.

cdiener commented 7 years ago

Yes definitely. I would be particularly interested in reductions that:

so basically all internal reactions can be lumped as long as those requirements are kept.

Midnighter commented 7 years ago

In a far future we should get redGEM and lumpGEM from Hatzimanikati's lab in Python but this is a good start indeed!

pstjohn commented 7 years ago

So I think there's probably two applications here. If you look at what they do in EFMtool, they compress the model's stoichiometric matrix so that you can calculate EFMs on the reduced model, and then easily rescale them back to the full model:

The compress(ReadableBigIntegerRationalMatrix, boolean[], String[], String[], Set) method uses mainly the stoichiometric matrix and reaction reversibilities as input, and returns 3 matrices pre, post and cmp, such that pre * stoich * post == cmp. Fba and flux analysis methods can be performed on the compressed matrix. Resulting flux vectors such as elementary modes can easily be mapped back to the original network.

Then they uncompress with

       pre * stoich * post * efmc = 0
             stoich * efm         = 0
                              efm = post * efmc

If we can do FBA/FVA on the compressed model too, I wonder how much of our existing algorithms we could speed up with a pre/post processing compression step.

But yeah, redGEM and lumpGEM certainly seem interesting as well. but that seems more like a modeling technique and less of a numerical method, which might indicate it would live better outside the core cobrapy package?

sulheim commented 3 years ago

If anyone else comes across this issue - it seems like both redGEM and lumpGEM are implemented in the pyTFA pacakge: https://github.com/EPFL-LCSB/pytfa (see e.g. tutorials)