Mercurial > repos > bimib > cobraxy
comparison COBRAxy/custom_data_generator.py @ 353:d13b39f183a5 draft
Uploaded
author | francesco_lapi |
---|---|
date | Thu, 04 Sep 2025 23:03:26 +0000 |
parents | 14be2a1071c7 |
children | 62de44378930 |
comparison
equal
deleted
inserted
replaced
352:14be2a1071c7 | 353:d13b39f183a5 |
---|---|
41 help="Output format: CSV (tabular) or Excel (xlsx)") | 41 help="Output format: CSV (tabular) or Excel (xlsx)") |
42 | 42 |
43 parser.add_argument('-idop', '--output_path', type = str, default='result', | 43 parser.add_argument('-idop', '--output_path', type = str, default='result', |
44 help = 'output path for the result files (default: result)') | 44 help = 'output path for the result files (default: result)') |
45 | 45 |
46 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), | |
47 help="Tool directory (passed from Galaxy as $__tool_directory__)") | |
48 | |
49 | |
46 | 50 |
47 return parser.parse_args(args) | 51 return parser.parse_args(args) |
48 | 52 |
49 ################################- INPUT DATA LOADING -################################ | 53 ################################- INPUT DATA LOADING -################################ |
50 def load_custom_model(file_path :utils.FilePath, ext :Optional[utils.FileFormat] = None) -> cobra.Model: | 54 def load_custom_model(file_path :utils.FilePath, ext :Optional[utils.FileFormat] = None) -> cobra.Model: |
215 except KeyError: | 219 except KeyError: |
216 raise utils.ArgsErr("model", "one of Recon/ENGRO2/HMRcore/Custom_model", ARGS.model) | 220 raise utils.ArgsErr("model", "one of Recon/ENGRO2/HMRcore/Custom_model", ARGS.model) |
217 | 221 |
218 # Load built-in model (Model.getCOBRAmodel uses tool_dir to locate local models) | 222 # Load built-in model (Model.getCOBRAmodel uses tool_dir to locate local models) |
219 try: | 223 try: |
220 model = model_enum.getCOBRAmodel() | 224 model = model_enum.getCOBRAmodel(toolDir=ARGS.tool_dir) |
221 except Exception as e: | 225 except Exception as e: |
222 # Wrap/normalize load errors as DataErr for consistency | 226 # Wrap/normalize load errors as DataErr for consistency |
223 raise utils.DataErr(ARGS.model, f"failed loading built-in model: {e}") | 227 raise utils.DataErr(ARGS.model, f"failed loading built-in model: {e}") |
224 | 228 |
225 # Determine final model name: explicit --name overrides, otherwise use the model id | 229 # Determine final model name: explicit --name overrides, otherwise use the model id |