def main(path2template, resultsPath, runs):
    import gzip
    tmpLP = metabolism.Metabolism(util.ImportCplex(path2template))
    tmpLP.setReactionObjectiveMinimizeRest('R("R_Ec_biomass_iAF1260_core_59p81M")')
    include = ('R("Mhb_Transp")',
             'R("Mna1b_Transp")',
             'R("Mkb_Transp")',
             'R("Mca2b_Transp")',
             'R("Mcu2b_Transp")',
             'R("Mmg2b_Transp")',
             'R("Mzn2b_Transp")',
             'R("Mmobdb_Transp")',
             'R("Mfe2b_Transp")',
             'R("Mfe3b_Transp")',
             'R("Mcobalt2b_Transp")',
             'R("Mmn2b_Transp")',
             'R("Mclb_Transp")')
    lp = randomMedia.Almaas(copy.copy(tmpLP), alwaysInc=include)
    print lp.lp
    f = lp.generateFluxdist()
    for item in range(runs):
        f = lp.generateFluxdist()
        stringDump = randomMedia.dict2tsv(lp.currDict) + "\n" + f.tsv()
        print stringDump
        path = resultsPath + "iAf1260_fluxDist_" + str(item) + ".tsv.gz"
        lp.lp.initialize()
        gzip.open(path, 'w').write(stringDump)
def main(path2template, resultsPath, runs):
    import gzip
    tmpLP = metabolism.Metabolism(util.ImportCplex(path2template))
    tmpLP.setReactionObjectiveMinimizeRest('R("R_Ec_biomass_iAF1260_core_59p81M")')
    lp = copy.copy(tmpLP)
    richMed = generateRichMedium(lp.getTransporters())
    print richMed
    lp.modifyColumnBounds(richMed)    
    richFluxDist = lp.fba()
    stringDump = randomMedia.dict2tsv(richMed) + "\n" + richFluxDist.tsv()
    print stringDump
    path = resultsPath + "iAf1260_fluxDist_RichMedium.tsv.gz"
    gzip.open(path, 'w').write(stringDump)
def main(lp, stub):
    include = ('R("Mhb_Transp")',
             'R("Mna1b_Transp")',
             'R("Mkb_Transp")',
             'R("Mca2b_Transp")',
             'R("Mcu2b_Transp")',
             'R("Mmg2b_Transp")',
             'R("Mzn2b_Transp")',
             'R("Mmobdb_Transp")',
             'R("Mfe2b_Transp")',
             'R("Mfe3b_Transp")',
             'R("Mcobalt2b_Transp")',
             'R("Mmn2b_Transp")',
             'R("Mclb_Transp")')
    lp = randomMedia.Almaas(lp, alwaysInc=include)
    f = lp.generateFluxdist()
    stringDump = randomMedia.dict2tsv(lp.currDict) + "\n" + f.active_tsv()
    path = "/Users/niko/tmp/" + "iAf1260_fluxDist_" + str(stub) + ".tsv.gz"
    gzip.open(path, 'w').write(stringDump)
    del(lp)
    return stub