klamt-lab / straindesign

StrainDesign is a python package for the computational design of metabolic networks and based on COBRApy
Apache License 2.0
36 stars 6 forks source link

Could not find MCS within reactions in ko_cost #15

Closed liaochen1988 closed 10 months ago

liaochen1988 commented 10 months ago

Hi, I am trying to identify minimal cut sets that exclusively consist of reactions in a pre-defined set. I tested this idea in the toy example described in the tutorial Example 7. There are 7 minimal cut sets and one of them is {R6, R8}. I was thinking that, if I restrict the ko reactions to be {R6, R8}, I would get only one minimal cut set (i.e., {R6, R8}). However, I got none. See below for my code:

toy_model = cobra.io.read_sbml_model('model_small_example.xml') toy_model.solver = 'cplex' modules = [sd.SDModule(toy_model, sd.names.SUPPRESS, constraints='R4 >= 0.01')] sols = sd.compute_strain_designs(toy_model, sd_modules = modules, ko_cost={'R8':1,'R6':1}) for s in sols.reaction_sd: print(s)

The output is shown below INFO:root:Preparing strain design computation. INFO:root: Using cplex for solving LPs during preprocessing. INFO:root: FVA to identify blocked reactions and irreversibilities. INFO:root: FVA(s) to identify essential reactions. INFO:root:Compressing Network (10 reactions). INFO:root: Removing blocked reactions. INFO:root: Translating stoichiometric coefficients to rationals. INFO:root: Removing conservation relations. INFO:root: Compression 1: Applying compression from EFM-tool module. INFO:root: Reduced to 8 reactions. INFO:root: Compression 2: Lumping parallel reactions. INFO:root: Last step could not reduce size further (8 reactions). INFO:root: Network compression completed. (1 compression iterations) INFO:root: Translating stoichiometric coefficients back to float. INFO:root: FVA(s) in compressed model to identify essential reactions. INFO:root:Finished preprocessing: INFO:root: Model size: 8 reactions, 4 metabolites INFO:root: 2 targetable reactions INFO:root:Constructing strain design MILP for solver: cplex. INFO:root: Bounding MILP. INFO:root:Finding optimal strain designs ... INFO:root:Finished solving strain design MILP. INFO:root: No solutions exist. INFO:root: Decompressing. INFO:root:0 solutions found.

I am wondering what is the correct way to identify minimal cut sets that consist of only reactions from a pre-defined set? I really enjoying using your package and thank you in advance!

VonAlphaBisZulu commented 10 months ago

Hi, thank you for opening the issue. You did everything correctly. It's not a solver issue, it's not a compression issue. The MCS MILP is infeasible, and I still have to find out why. Just wanted to let you know I'm working on it. Hope to get it done this week.

I've additionally allowed the KO of R1, and then it finds both possible MCS [R1], [R6, R8] without issues. So it's most certainly a bug.

liaochen1988 commented 10 months ago

Hi, thank you for opening the issue. You did everything correctly. It's not a solver issue, it's not a compression issue. The MCS MILP is infeasible, and I still have to find out why. Just wanted to let you know I'm working on it. Hope to get it done this week.

I've additionally allowed the KO of R1, and then it finds both possible MCS [R1], [R6, R8] without issues. So it's most certainly a bug.

Thank you very much. I certainly love this work and hope it can be resolved soon. I hope it is a small bug and look forward to using your tool in my research!

VonAlphaBisZulu commented 10 months ago

I found the problem. Some things in the construction and bounding of the MILP were off. Thank you again for opening the issue. This was a crucial fix/improvement.

It's merged with main in pull request #16 and will be part of the next release.

The release is coming soon, but there are some more things to still fix, before. You are welcome to check out main branch or look at the changes from PR16 and copy them to your installation.

liaochen1988 commented 10 months ago

I found the problem. Some things in the construction and bounding of the MILP were off. Thank you again for opening the issue. This was a crucial fix/improvement.

It's merged with main in pull request #16 and will be part of the next release.

The release is coming soon, but there are some more things to still fix, before. You are welcome to check out main branch or look at the changes from PR16 and copy them to your installation.

Thank you very much and it is very quick! I appreciate your efforts and I will let you know if I have any feedback in the future.