Mercurial > repos > bimib > cobraxy
diff COBRAxy/custom_data_generator.py @ 28:291721be77ad draft
Uploaded
author | luca_milaz |
---|---|
date | Thu, 19 Sep 2024 08:23:25 +0000 |
parents | 4c9ade74c4d7 |
children |
line wrap: on
line diff
--- 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