# HG changeset patch # User luca_milaz # Date 1720123689 0 # Node ID 6f3a092f0a0e5733a6769175657fdc0a6c329452 # Parent f9bb6887b6841d40c77adbe664ea3ea0ee8915ee Uploaded diff -r f9bb6887b684 -r 6f3a092f0a0e marea_2_0/flux_sampling.py --- a/marea_2_0/flux_sampling.py Thu Jul 04 14:27:49 2024 +0000 +++ b/marea_2_0/flux_sampling.py Thu Jul 04 20:08:09 2024 +0000 @@ -32,11 +32,6 @@ required = True, help = 'your tool directory') - parser.add_argument( - "-of", "--output_format", - type = utils.FileFormat.fromExt, - choices = [utils.FileFormat.CSV, utils.FileFormat.PICKLE], - required = True, help = "Extension of all output files") parser.add_argument('-in', '--input', required = True, @@ -95,12 +90,7 @@ def write_to_file(dataset: pd.DataFrame, name: str)->None: - - if ARGS.output_format is utils.FileFormat.PICKLE: - save_path = utils.FilePath(name, ARGS.output_format, prefix = ARGS.output_folder) - utils.writePickle(save_path, dataset) - elif ARGS.output_format is utils.FileFormat.CSV: - dataset.to_csv(ARGS.output_folder + name + ".csv", sep = '\t', index = False) + dataset.to_csv(ARGS.output_folder + name + ".csv", sep = '\t', index = False) diff -r f9bb6887b684 -r 6f3a092f0a0e marea_2_0/flux_sampling.xml --- a/marea_2_0/flux_sampling.xml Thu Jul 04 14:27:49 2024 +0000 +++ b/marea_2_0/flux_sampling.xml Thu Jul 04 20:08:09 2024 +0000 @@ -29,7 +29,8 @@ --n_batches $n_batches --n_samples $n_samples --seed $seed - --output_format $output_format + --output_type "${",".join(map(str, $output_types))}" + --toMerge toMerge --out_log $log ]]> @@ -51,15 +52,21 @@ - + + + + + + + + + + - - - - + diff -r f9bb6887b684 -r 6f3a092f0a0e marea_2_0/statistics.py --- a/marea_2_0/statistics.py Thu Jul 04 14:27:49 2024 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -import argparse -import utils.general_utils as utils -from typing import Optional, List -import os -import numpy as np -import pandas as pd -import cobra -import utils.flux_analysis as flux_analysis -from joblib import Parallel, delayed, cpu_count -import sys - -################################# process args ############################### -def process_args(args :List[str]) -> argparse.Namespace: - """ - Processes command-line arguments. - - Args: - args (list): List of command-line arguments. - - Returns: - Namespace: An object containing parsed arguments. - """ - parser = argparse.ArgumentParser(usage = '%(prog)s [options]', - description = 'process some value\'s') - - parser.add_argument('-ol', '--out_log', - help = "Output log") - - parser.add_argument('-td', '--tool_dir', - type = str, - required = True, - help = 'your tool directory') - - parser.add_argument('-in', '--input', - required = True, - type=str, - help = 'inputs data') - - parser.add_argument('-nm', '--name', - required = True, - type=str, - help = 'inputs data ids') - - parser.add_argument('-st', '--statistics', - required = True, - type=str, - help = 'statistics') - - parser.add_argument('-tm', '--toMerge', - required = True, - type=bool, - help = 'Merge output datasets') - - - ARGS = parser.parse_args() - return ARGS - -########################### warning ########################################### -def warning(s :str) -> None: - """ - Log a warning message to an output log file and print it to the console. - - Args: - s (str): The warning message to be logged and printed. - - Returns: - None - """ - with open(ARGS.out_log, 'a') as log: - log.write(s + "\n\n") - print(s) - - - -############################# main ########################################### -def main() -> None: - """ - Initializes everything and sets the program in motion based on the fronted input arguments. - - Returns: - None - """ - if not os.path.exists('statistics'): - os.makedirs('statistics') - - num_processors = cpu_count() - - global ARGS - ARGS = process_args(sys.argv) - - ARGS.output_folder = 'statistics/' - - data_inputs = ARGS.input.split(",") - data_names = ARGS.name.split(",") - - utils.logWarning( - ARGS.statistics, - ARGS.out_log) - - pass - -############################################################################## -if __name__ == "__main__": - main() \ No newline at end of file diff -r f9bb6887b684 -r 6f3a092f0a0e marea_2_0/statistics.xml --- a/marea_2_0/statistics.xml Thu Jul 04 14:27:49 2024 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ - - - - marea_macros.xml - - - - cobra - lxml - joblib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file