BioSystemsUM / troppo

Reconstruction algorithms for Python
GNU General Public License v3.0
23 stars 5 forks source link

GIMME output doesn't make sense #12

Closed bpuniya closed 1 year ago

bpuniya commented 4 years ago

Hi Skapur,

I'm using GIMME method from troppo to construct a tissue-specific model. I mapped my gene expression data and created an object expVectore.

Now, I am running the following script.

idx_objective = rx_names.index('biomass_reaction') properties = GIMMEProperties(exp_vector=expVector, obj_frac=0.9, objectives= [{idx_objective:1}], preprocess=True, flux_threshold=0.9 ) algorithm = GIMME(S, lb.astype(float), ub.astype(float), properties) model_GIMME = algorithm.run()

model_GIMME_final = model_cobra.copy() r_ids = [r.id for r in model_GIMME_final.reactions] to_remove_ids = [r_ids[r] for r in np.where(model_GIMME==0)[0]] model_GIMME_final.remove_reactions(to_remove_ids,True)

In the model_GIMME_final, all the reactions assigned 0 in _expvector were removed, which means GIMMEProperties (obj_frac =0.9) has no impact. Ideally, GIMME should retain some reactions based on the obj_frac argument. model_GIMME_final.optimize() results in 0.

Would you please help me resolve why GIMME is not considering objective function when removing the model?

Thank you!

vvvieira commented 4 years ago

Hi @bpuniya and sorry for the delayed response,

Thanks for pointing this issue! Indeed there was a problem with the GIMME algorithm where the objective reaction bounds were not being set properly, leading to rubbish solutions with null objective values and no added reactions.

Since GIMME is still a part of cobamp we applied the fix in this commit. It should work now and your solutions should start including other reactions

I can't release a fix on PyPI today but if you want to use this right now, you can replace line 740 on cobamp/core/models.py with these two: lbs_id = objective_lbs[objective_ids] for id, lb in zip(objective_ids, lbs_id):

I will keep this issue open until we release a new version on PyPI.

Once again, thank you for taking the time to report this to us!

bpuniya commented 4 years ago

Hi @skapur

Thank you very much for your response and for resolving this issue.
It is working fine now.

Thanks again!