from pyscescbm import CBRead, CBWrite, CBTools from pyscescbm import CBSolver as slv ### Active script ### model_file = model_name + '.xml' data_dir = os.path.join(cDir, 'data', model_name) model_dir = os.path.join(data_dir,'models','sbml') work_dir2 = os.path.join(data_dir,'models','h-format') if not os.path.exists(work_dir2): os.makedirs(work_dir2) if sbml_level == 3: print('Trying level 3') cmod = CBRead.readSBML3FBC(model_file, work_dir=model_dir) else: cmod = CBRead.readSBML2FBA(model_file, work_dir=model_dir) cmod.id = model_name print('\nAttempting to delete bounds for biomass reaction,', cmod.getActiveObjective().getFluxObjectiveReactions()[0]) cmod.deleteBoundsForReactionId(cmod.getActiveObjective().getFluxObjectiveReactions()[0]) mLP = slv.analyzeModel(cmod, return_lp_obj=True) CBWrite.printFBASolution(cmod) tmp_mid = cmod.id+'_cplex' CBTools.countedPause(1) cmod.id = tmp_mid
if not os.path.exists(work_dir): os.mkdir(work_dir) if os.listdir(work_dir) == []: raise UserWarning("No files to analyze in directory {0:s}".format(work_dir)) for file_in in os.listdir(work_dir): if file_in.endswith('noinf_r.ine.all'): subnetwork_name = file_in.replace('.noinf_r.ine.all','') model_file = "{0:s}.xml".format(subnetwork_name) vertex_file = os.path.join(work_dir, '{0:s}.noinf_r.ine.all'.format(subnetwork_name) ) rfva_file = os.path.join(work_dir, '{0:s}.noinf_r.ine.opt.fva'.format(subnetwork_name) ) if sbml_level == 3: try: cmod = CBRead.readSBML3FBC(model_file, work_dir=model_dir) except: cmod = CBRead.readSBML2FBA(model_file, work_dir=model_dir) else: cmod = CBRead.readSBML2FBA(model_file, work_dir=model_dir) cmod.id = subnetwork_name CBTools.addStoichToFBAModel(cmod) CBTools.processBiGGchemFormula(cmod) if USE_COLUMN_CROSSCHECK: mismatch = [] F = open(os.path.join(H_format_dir, '{0:s}.noinf_r.columns.txt'.format(subnetwork_name) ), 'r') indx_lst = [] for L in F: l = [i.strip() for i in L.split(',')] if len(l) == 2: