comparison COBRAxy/src/ras_to_bounds.py @ 542:fcdbc81feb45 draft

Uploaded
author francesco_lapi
date Sun, 26 Oct 2025 19:27:41 +0000
parents 2fb97466e404
children
comparison
equal deleted inserted replaced
541:fa93040a75af 542:fcdbc81feb45
7 - Build a COBRA model from a tabular CSV 7 - Build a COBRA model from a tabular CSV
8 - Run FVA to initialize bounds, then scale per-sample based on RAS values 8 - Run FVA to initialize bounds, then scale per-sample based on RAS values
9 - Save bounds per sample and optionally export updated models in chosen formats 9 - Save bounds per sample and optionally export updated models in chosen formats
10 """ 10 """
11 import argparse 11 import argparse
12 import utils.general_utils as utils
13 from typing import Optional, Dict, Set, List, Tuple, Union 12 from typing import Optional, Dict, Set, List, Tuple, Union
14 import os 13 import os
15 import numpy as np 14 import numpy as np
16 import pandas as pd 15 import pandas as pd
17 import cobra 16 import cobra
18 from cobra import Model 17 from cobra import Model
19 import sys 18 import sys
20 from joblib import Parallel, delayed, cpu_count 19 from joblib import Parallel, delayed, cpu_count
21 import utils.model_utils as modelUtils 20
21 try:
22 from .utils import general_utils as utils
23 from .utils import model_utils as modelUtils
24 except:
25 import utils.general_utils as utils
26 import utils.model_utils as modelUtils
22 27
23 ################################# process args ############################### 28 ################################# process args ###############################
24 def process_args(args :List[str] = None) -> argparse.Namespace: 29 def process_args(args :List[str] = None) -> argparse.Namespace:
25 """ 30 """
26 Processes command-line arguments. 31 Processes command-line arguments.
41 parser.add_argument('-ol', '--out_log', 46 parser.add_argument('-ol', '--out_log',
42 help = "Output log") 47 help = "Output log")
43 48
44 parser.add_argument('-td', '--tool_dir', 49 parser.add_argument('-td', '--tool_dir',
45 type = str, 50 type = str,
46 required = True, 51 default = os.path.dirname(os.path.abspath(__file__)),
47 help = 'your tool directory') 52 help = 'your tool directory (default: auto-detected package location)')
48 53
49 parser.add_argument('-ir', '--input_ras', 54 parser.add_argument('-ir', '--input_ras',
50 type=str, 55 type=str,
51 required = False, 56 required = False,
52 help = 'input ras') 57 help = 'input ras')