Mercurial > repos > bimib > cobraxy
comparison COBRAxy/flux_simulation.py @ 159:898f2641d3f7 draft
Uploaded
| author | francesco_lapi |
|---|---|
| date | Tue, 12 Nov 2024 16:58:48 +0000 |
| parents | 30acaa01df61 |
| children | e1b0ddc770a9 |
comparison
equal
deleted
inserted
replaced
| 158:30acaa01df61 | 159:898f2641d3f7 |
|---|---|
| 86 parser.add_argument('-ota', '--output_type_analysis', | 86 parser.add_argument('-ota', '--output_type_analysis', |
| 87 type = str, | 87 type = str, |
| 88 required = False, | 88 required = False, |
| 89 help = 'output type analysis') | 89 help = 'output type analysis') |
| 90 | 90 |
| 91 parser.add_argument( | 91 parser.add_argument('-idop', '--output_path', |
| 92 '-idop', '--output_path', | 92 type = str, |
| 93 type = str, | 93 default='flux_simulation', |
| 94 default='flux_simulation', | 94 help = 'output path for maps') |
| 95 help = 'output path for maps') | |
| 96 | 95 |
| 97 ARGS = parser.parse_args(args) | 96 ARGS = parser.parse_args(args) |
| 98 return ARGS | 97 return ARGS |
| 99 | 98 |
| 100 ########################### warning ########################################### | 99 ########################### warning ########################################### |
| 237 bounds_df = read_dataset(bounds_path, "bounds dataset") | 236 bounds_df = read_dataset(bounds_path, "bounds dataset") |
| 238 for rxn_index, row in bounds_df.iterrows(): | 237 for rxn_index, row in bounds_df.iterrows(): |
| 239 model_input.reactions.get_by_id(rxn_index).lower_bound = row.lower_bound | 238 model_input.reactions.get_by_id(rxn_index).lower_bound = row.lower_bound |
| 240 model_input.reactions.get_by_id(rxn_index).upper_bound = row.upper_bound | 239 model_input.reactions.get_by_id(rxn_index).upper_bound = row.upper_bound |
| 241 | 240 |
| 242 name = cell_name | 241 name = cell_name.split('.')[0] |
| 243 | 242 |
| 244 if ARGS.algorithm == 'OPTGP': | 243 if ARGS.algorithm == 'OPTGP': |
| 245 OPTGP_sampler(model_input, name, ARGS.n_samples, ARGS.thinning, ARGS.n_batches, ARGS.seed) | 244 OPTGP_sampler(model_input, name, ARGS.n_samples, ARGS.thinning, ARGS.n_batches, ARGS.seed) |
| 246 | 245 |
| 247 elif ARGS.algorithm == 'CBS': | 246 elif ARGS.algorithm == 'CBS': |
| 380 num_processors = cpu_count() | 379 num_processors = cpu_count() |
| 381 | 380 |
| 382 global ARGS | 381 global ARGS |
| 383 ARGS = process_args(args) | 382 ARGS = process_args(args) |
| 384 | 383 |
| 385 if not os.path.exists('flux_simulation/'): | 384 if not os.path.exists(ARGS.output_path): |
| 386 os.makedirs('flux_simulation/') | 385 os.makedirs(ARGS.output_path) |
| 387 | |
| 388 | 386 |
| 389 model_type :utils.Model = ARGS.model_selector | 387 model_type :utils.Model = ARGS.model_selector |
| 390 if model_type is utils.Model.Custom: | 388 if model_type is utils.Model.Custom: |
| 391 model = model_type.getCOBRAmodel(customPath = utils.FilePath.fromStrPath(ARGS.model), customExtension = utils.FilePath.fromStrPath(ARGS.model_name).ext) | 389 model = model_type.getCOBRAmodel(customPath = utils.FilePath.fromStrPath(ARGS.model), customExtension = utils.FilePath.fromStrPath(ARGS.model_name).ext) |
| 392 else: | 390 else: |
