PNNL-CompBio / CONCERTO

Continuous integration and validation for genome-scale metabolic model consortia
Apache License 2.0
3 stars 3 forks source link

gapfill one false negative in rhodosporidium #18

Open djinnome opened 1 year ago

JamesPino commented 1 year ago

@mcnaughtonadm

While working on building the class to store/organize memote biolog results, I created a simple function to gapfill using the cobras. Are you implementing the actual one in a similar manner? Will it be possible to iterate through a list of false negatives to gather the reactions, or do you think a function call, add to model, validate? Can adding two or more reactions at the same time lead to erroneous results? Not sure if I should design the memote result class around multiple changes to a model. I am thinking that doing it with memote, but not through the html output would be the easiest to interpret, but not sure what to expect when updating the model. Mainly thinking out loud.

def find_rxns(model, universal, to_fix, source_met):

    with model:
        med = model.medium
        med[source_met] = 0
        med[to_fix] = 1
        model.medium = med
        result = gapfill(
            model, 
            universal,
            demand_reactions=False, 
            exchange_reactions =False,
            iterations=4
        )
        for i, entries in enumerate(result):
            print("---- Run %d ----" % (i + 1))
            for e in entries:
                print(e.id)
    return result
find_rxns(rt, universal, 'EX_succ_e', 'EX_glc__D_e')

which works for my testing purposes, but not sure how the actual updates will occur.

---- Run 1 ----
ATPS4rpp
Htex
SUCCt2_2pp
SUCCtex
---- Run 2 ----
ATPS4rpp
Htex
SUCCt2_3pp
SUCCtex
---- Run 3 ----
GLYCTO3
ICDHyr
QMO3
SUCCtex
TARTRt7pp
TARTRtpp
---- Run 4 ----
GLYCTO2
ICDHyr
NADH16pp
QMO2
SUCCt2_2pp
SUCCtex
mcnaughtonadm commented 1 year ago

Yep, this is essentially the same way I was going about running the COBRA gapfill on my end!

It's probably not going to be desirable to try and gapfill multiple False Negatives at the same time (at least with the COBRA implementation), I would worry that some downstream reactions may conflict between the selected. You should be fully able to just iterate through False Negatives but you'd probably need to make sure you are keeping a copy of the models original medium so that each false negative isn't causing further and further distortions to the medium and potentially causing some error that way.

djinnome commented 1 year ago

The main problem with gapfilling is that we need to check each time to see if adding reactions introduces false positives. Once a false positive is created, it is computationally hard to remove. Thus, the best solution is not to include reactions that create false positives in the first place by including the set of "cannot-grow" conditions in the constraints of the gapfill algorithm.