# HG changeset patch # User luca_milaz # Date 1726734205 0 # Node ID 291721be77ade9c242ecf0bc65ebc5520bd146f4 # Parent b61fc7f1b6ab6f2eba745a92dfcc79554eed9867 Uploaded diff -r b61fc7f1b6ab -r 291721be77ad COBRAxy/custom_data_generator.py --- a/COBRAxy/custom_data_generator.py Thu Sep 19 08:23:15 2024 +0000 +++ b/COBRAxy/custom_data_generator.py Thu Sep 19 08:23:25 2024 +0000 @@ -147,7 +147,7 @@ ###############################- FILE SAVING -################################ def save_as_csv_filePath(data :dict, file_path :utils.FilePath, fieldNames :Tuple[str, str]) -> None: """ - Saves any dictionary-shaped data in a .csv file created at the given file_path. + Saves any dictionary-shaped data in a .csv file created at the given file_path as FilePath. Args: data : the data to be written to the file. @@ -166,7 +166,7 @@ def save_as_csv(data :dict, file_path :str, fieldNames :Tuple[str, str]) -> None: """ - Saves any dictionary-shaped data in a .csv file created at the given file_path. + Saves any dictionary-shaped data in a .csv file created at the given file_path as string. Args: data : the data to be written to the file. @@ -202,19 +202,17 @@ model = load_custom_model( utils.FilePath.fromStrPath(ARGS.input), utils.FilePath.fromStrPath(ARGS.name).ext) + # generate data rules = generate_rules(model, asParsed = False) reactions = generate_reactions(model, asParsed = False) bounds = generate_bounds(model) medium = get_medium(model) - + # save files out of collection: path coming from xml save_as_csv(rules, ARGS.out_rules, ("ReactionID", "Rule")) save_as_csv(reactions, ARGS.out_reactions, ("ReactionID", "Reaction")) bounds.to_csv(ARGS.out_bounds, sep = '\t') medium.to_csv(ARGS.out_medium, sep = '\t') - - # ^ Please if anyone works on this after updating python to 3.12 change the if/elif into a match statement!! - if __name__ == '__main__': main() \ No newline at end of file