Mercurial > repos > bimib > cobraxy
comparison COBRAxy/rps_generator.py @ 147:3fca9b568faf draft
Uploaded
author | bimib |
---|---|
date | Wed, 06 Nov 2024 13:57:24 +0000 |
parents | 41f35c2f0c7b |
children |
comparison
equal
deleted
inserted
replaced
146:88cf4543e210 | 147:3fca9b568faf |
---|---|
14 import utils.general_utils as utils | 14 import utils.general_utils as utils |
15 import utils.reaction_parsing as reactionUtils | 15 import utils.reaction_parsing as reactionUtils |
16 | 16 |
17 ########################## argparse ########################################## | 17 ########################## argparse ########################################## |
18 ARGS :argparse.Namespace | 18 ARGS :argparse.Namespace |
19 def process_args() -> argparse.Namespace: | 19 def process_args(args:List[str] = None) -> argparse.Namespace: |
20 """ | 20 """ |
21 Processes command-line arguments. | 21 Processes command-line arguments. |
22 | 22 |
23 Args: | 23 Args: |
24 args (list): List of command-line arguments. | 24 args (list): List of command-line arguments. |
49 parser.add_argument('-rp', '--rps_output', | 49 parser.add_argument('-rp', '--rps_output', |
50 type = str, | 50 type = str, |
51 required = True, | 51 required = True, |
52 help = 'rps output') | 52 help = 'rps output') |
53 | 53 |
54 args = parser.parse_args() | 54 args = parser.parse_args(args) |
55 return args | 55 return args |
56 | 56 |
57 ############################ dataset name ##################################### | 57 ############################ dataset name ##################################### |
58 def name_dataset(name_data :str, count :int) -> str: | 58 def name_dataset(name_data :str, count :int) -> str: |
59 """ | 59 """ |
220 df = pd.DataFrame.from_dict(rps_scores) | 220 df = pd.DataFrame.from_dict(rps_scores) |
221 df.rename(columns={'Unnamed: 0': 'Reactions'}, inplace=True) | 221 df.rename(columns={'Unnamed: 0': 'Reactions'}, inplace=True) |
222 df.to_csv(ARGS.rps_output, sep = '\t', na_rep = "None", index = False) | 222 df.to_csv(ARGS.rps_output, sep = '\t', na_rep = "None", index = False) |
223 | 223 |
224 ############################ main #################################### | 224 ############################ main #################################### |
225 def main() -> None: | 225 def main(args:List[str] = None) -> None: |
226 """ | 226 """ |
227 Initializes everything and sets the program in motion based on the fronted input arguments. | 227 Initializes everything and sets the program in motion based on the fronted input arguments. |
228 | 228 |
229 Returns: | 229 Returns: |
230 None | 230 None |
231 """ | 231 """ |
232 global ARGS | 232 global ARGS |
233 ARGS = process_args() | 233 ARGS = process_args(args) |
234 | 234 |
235 # TODO:use utils functions vvv | 235 # TODO:use utils functions vvv |
236 with open(ARGS.tool_dir + '/local/pickle files/black_list.pickle', 'rb') as bl: | 236 with open(ARGS.tool_dir + '/local/pickle files/black_list.pickle', 'rb') as bl: |
237 black_list = pk.load(bl) | 237 black_list = pk.load(bl) |
238 | 238 |