Mercurial > repos > bimib > cobraxy
diff COBRAxy/custom_data_generator.py @ 147:3fca9b568faf draft
Uploaded
author | bimib |
---|---|
date | Wed, 06 Nov 2024 13:57:24 +0000 |
parents | 7e703e546998 |
children |
line wrap: on
line diff
--- a/COBRAxy/custom_data_generator.py Wed Nov 06 10:12:52 2024 +0000 +++ b/COBRAxy/custom_data_generator.py Wed Nov 06 13:57:24 2024 +0000 @@ -6,11 +6,11 @@ import pandas as pd import utils.general_utils as utils import utils.rule_parsing as rulesUtils -from typing import Optional, Tuple, Union, Dict +from typing import Optional, Tuple, Union, List, Dict import utils.reaction_parsing as reactionUtils ARGS : argparse.Namespace -def process_args() -> argparse.Namespace: +def process_args(args:List[str] = None) -> argparse.Namespace: """ Interfaces the script of a module with its frontend, making the user's choices for various parameters available as values in code. @@ -35,9 +35,8 @@ parser.add_argument("-id", "--input", type = str, required = True, help = "Input model") parser.add_argument("-mn", "--name", type = str, required = True, help = "Input model name") # ^ I need this because galaxy converts my files into .dat but I need to know what extension they were in - - argsNamespace = parser.parse_args() - argsNamespace.out_dir = "result" + parser.add_argument('-idop', '--output_path', type = str, default='result', help = 'output path for maps') + argsNamespace = parser.parse_args(args) # ^ can't get this one to work from xml, there doesn't seem to be a way to get the directory attribute from the collection return argsNamespace @@ -184,7 +183,7 @@ writer.writerow({ fieldNames[0] : key, fieldNames[1] : value }) ###############################- ENTRY POINT -################################ -def main() -> None: +def main(args:List[str] = None) -> None: """ Initializes everything and sets the program in motion based on the fronted input arguments. @@ -193,10 +192,10 @@ """ # get args from frontend (related xml) global ARGS - ARGS = process_args() + ARGS = process_args(args) # this is the worst thing I've seen so far, congrats to the former MaREA devs for suggesting this! - if os.path.isdir(ARGS.out_dir) == False: os.makedirs(ARGS.out_dir) + if os.path.isdir(ARGS.output_path) == False: os.makedirs(ARGS.output_path) # load custom model model = load_custom_model(