# HG changeset patch # User francesco_lapi # Date 1757066020 0 # Node ID 8a1213d1393d33e17214b7ac375fd76bd2e78c90 # Parent d2e36a8ab451a8437f6d4c6e00deec27b012be38 Uploaded diff -r d2e36a8ab451 -r 8a1213d1393d COBRAxy/custom_data_generator.py --- a/COBRAxy/custom_data_generator.py Fri Sep 05 09:32:38 2025 +0000 +++ b/COBRAxy/custom_data_generator.py Fri Sep 05 09:53:40 2025 +0000 @@ -36,15 +36,9 @@ parser.add_argument("--medium", type=str, help="Custom medium file if medium_selector=Custom") - parser.add_argument("--output_format", type=str, choices=["tabular", "xlsx"], required=True, - help="Output format: CSV (tabular) or Excel (xlsx)") - parser.add_argument("--out_tabular", type=str, help="Output file for the merged dataset (CSV or XLSX)") - parser.add_argument("--out_xlsx", type=str, - help="Output file for the merged dataset (CSV or XLSX)") - parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), help="Tool directory (passed from Galaxy as $__tool_directory__)") @@ -199,14 +193,6 @@ except Exception as e: raise utils.DataErr(path, f"failed writing tabular output: {e}") -def save_as_xlsx_df(df: pd.DataFrame, path: str) -> None: - try: - if not path.lower().endswith(".xlsx"): - path += ".xlsx" - os.makedirs(os.path.dirname(path) or ".", exist_ok=True) - df.to_excel(path, index=False) - except Exception as e: - raise utils.DataErr(path, f"failed writing xlsx output: {e}") ###############################- ENTRY POINT -################################ def main(args:List[str] = None) -> None: @@ -272,17 +258,11 @@ #### - # write only the requested output - if ARGS.output_format == "xlsx": - if not ARGS.out_xlsx: - raise utils.ArgsErr("out_xlsx", "output path (--out_xlsx) is required when output_format == xlsx", ARGS.out_xlsx) - save_as_xlsx_df(merged, ARGS.out_xlsx) - expected = ARGS.out_xlsx - else: - if not ARGS.out_tabular: - raise utils.ArgsErr("out_tabular", "output path (--out_tabular) is required when output_format == tabular", ARGS.out_tabular) - save_as_tabular_df(merged, ARGS.out_tabular) - expected = ARGS.out_tabular + + if not ARGS.out_tabular: + raise utils.ArgsErr("out_tabular", "output path (--out_tabular) is required when output_format == tabular", ARGS.out_tabular) + save_as_tabular_df(merged, ARGS.out_tabular) + expected = ARGS.out_tabular # verify output exists and non-empty if not expected or not os.path.exists(expected) or os.path.getsize(expected) == 0: diff -r d2e36a8ab451 -r 8a1213d1393d COBRAxy/custom_data_generator.xml --- a/COBRAxy/custom_data_generator.xml Fri Sep 05 09:32:38 2025 +0000 +++ b/COBRAxy/custom_data_generator.xml Fri Sep 05 09:53:40 2025 +0000 @@ -4,20 +4,18 @@ marea_macros.xml - + numpy pandas - cobra + cobra lxml - openpyxl - + - + + + + + + @@ -97,20 +93,6 @@ - - - - - - - - - - - - - - @@ -118,16 +100,7 @@ - - - - - + optional="true"/>