55from carveme .reconstruction .utils import load_media_db
66
77
8- def maincall (inputfiles , flavor = None , split_pool = False , no_biomass = False , init = None , mediadb = None , ext_comp_id = None , outputfile = None ):
8+ def maincall (inputfiles , flavor = None , init = None , mediadb = None , outputfile = None ):
99
1010 if not flavor :
1111 flavor = config .get ('sbml' , 'default_flavor' )
@@ -16,17 +16,9 @@ def maincall(inputfiles, flavor=None, split_pool=False, no_biomass=False, init=N
1616 model_id = 'community'
1717 outputfile = 'community.xml'
1818
19- if ext_comp_id is None :
20- ext_comp_id = 'C_e'
21-
2219 models = [load_cbmodel (inputfile , flavor = flavor ) for inputfile in inputfiles ]
23-
24- community = Community (model_id , models ,
25- extracellular_compartment_id = ext_comp_id ,
26- merge_extracellular_compartments = (not split_pool ),
27- create_biomass = (not no_biomass ))
28-
29- merged = community .generate_merged_model ()
20+ community = Community (model_id , models )
21+ model = community .merged_model
3022
3123 if init :
3224 if not mediadb :
@@ -37,14 +29,10 @@ def maincall(inputfiles, flavor=None, split_pool=False, no_biomass=False, init=N
3729 except IOError :
3830 raise IOError ('Failed to load media library:' + mediadb )
3931
40- if split_pool :
41- fmt_func = lambda x : f"R_EX_M_{ x } _e_pool"
42- else :
43- fmt_func = lambda x : f"R_EX_{ x } _e"
44- init_env = Environment .from_compounds (media_db [init ], fmt_func = fmt_func )
45- init_env .apply (merged , inplace = True )
32+ init_env = Environment .from_compounds (media_db [init ])
33+ init_env .apply (model , inplace = True )
4634
47- save_cbmodel (merged , outputfile , flavor = flavor )
35+ save_cbmodel (model , outputfile , flavor = flavor )
4836
4937
5038def main ():
@@ -54,17 +42,10 @@ def main():
5442
5543 parser .add_argument ('-o' , '--output' , dest = 'output' , help = "SBML output file (community)" )
5644
57- parser .add_argument ('--split-pool' , action = 'store_true' , dest = 'split_pool' ,
58- help = 'Keep individual extracellular compartments separated from common metabolite pool.' )
59-
60- parser .add_argument ('--no-community-biomass' , action = 'store_true' , dest = 'no_biomass' ,
61- help = 'Do not create a common community biomass equation.' )
62-
6345 parser .add_argument ('-i' , '--init' , dest = 'init' ,
6446 help = "Initialize model with given medium" )
6547
6648 parser .add_argument ('--mediadb' , help = "Media database file" )
67- parser .add_argument ('--ext' , help = "Extracellular compartment identifier in the models (default 'C_e')." )
6849
6950 sbml = parser .add_mutually_exclusive_group ()
7051 sbml .add_argument ('--cobra' , action = 'store_true' , help = "SBML input/output in old cobra format" )
@@ -81,15 +62,12 @@ def main():
8162 elif args .cobra :
8263 flavor = 'cobra'
8364 else :
84- flavor = None
65+ flavor = config . get ( 'sbml' , 'default_flavor' )
8566
8667 maincall (inputfiles = args .input ,
8768 flavor = flavor ,
88- split_pool = args .split_pool ,
89- no_biomass = args .no_biomass ,
9069 init = args .init ,
9170 mediadb = args .mediadb ,
92- ext_comp_id = args .ext ,
9371 outputfile = args .output )
9472
9573
0 commit comments