Mercurial > repos > bimib > cobraxy
comparison COBRAxy/fromCSVtoCOBRA_beta.py @ 455:4e2bc80764b6 draft
Uploaded
| author | francesco_lapi |
|---|---|
| date | Fri, 12 Sep 2025 15:05:54 +0000 |
| parents | 3654c08668f1 |
| children | a6e45049c1b9 |
comparison
equal
deleted
inserted
replaced
| 454:3654c08668f1 | 455:4e2bc80764b6 |
|---|---|
| 61 # Basic sanity checks | 61 # Basic sanity checks |
| 62 if not os.path.exists(ARGS.input): | 62 if not os.path.exists(ARGS.input): |
| 63 logging.error('Input file not found: %s', ARGS.input) | 63 logging.error('Input file not found: %s', ARGS.input) |
| 64 | 64 |
| 65 out_dir = os.path.dirname(os.path.abspath(ARGS.output)) | 65 out_dir = os.path.dirname(os.path.abspath(ARGS.output)) |
| 66 | |
| 66 if out_dir and not os.path.isdir(out_dir): | 67 if out_dir and not os.path.isdir(out_dir): |
| 67 try: | 68 try: |
| 68 os.makedirs(out_dir, exist_ok=True) | 69 os.makedirs(out_dir, exist_ok=True) |
| 69 logging.info('Created missing output directory: %s', out_dir) | 70 logging.info('Created missing output directory: %s', out_dir) |
| 70 except Exception as e: | 71 except Exception as e: |
| 71 logging.exception('Cannot create output directory: %s', out_dir) | 72 logging.exception('Cannot create output directory: %s', out_dir) |
| 72 | 73 |
| 73 # Build the model from the CSV (NOTE: use ARGS.input here) | |
| 74 model = modelUtils.build_cobra_model_from_csv(ARGS.input) | 74 model = modelUtils.build_cobra_model_from_csv(ARGS.input) |
| 75 | 75 |
| 76 # Save model in requested format | 76 # Save model in requested format |
| 77 if ARGS.format == "sbml": | 77 if ARGS.format == "sbml": |
| 78 cobra.io.write_sbml_model(model, ARGS.output) | 78 cobra.io.write_sbml_model(model, ARGS.output) |
