cobrapy icon indicating copy to clipboard operation
cobrapy copied to clipboard

Implement model reduction

Open pstjohn opened this issue 6 years ago • 4 comments

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.

pstjohn avatar Sep 13 '17 14:09 pstjohn

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

  • maintain all original imports/exports
  • maintain the objective

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

cdiener avatar Sep 13 '17 16:09 cdiener

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

Midnighter avatar Sep 13 '17 20:09 Midnighter

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?

pstjohn avatar Sep 16 '17 14:09 pstjohn

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)

sulheim avatar Sep 02 '21 06:09 sulheim