Mercurial > repos > bimib > cobraxy
diff COBRAxy/custom_data_generator.py @ 375:130043620f8d draft
Uploaded
author | francesco_lapi |
---|---|
date | Fri, 05 Sep 2025 06:06:08 +0000 |
parents | 72f592fe1f7d |
children | f4b83b3a3486 |
line wrap: on
line diff
--- a/COBRAxy/custom_data_generator.py Fri Sep 05 05:54:54 2025 +0000 +++ b/COBRAxy/custom_data_generator.py Fri Sep 05 06:06:08 2025 +0000 @@ -39,7 +39,10 @@ parser.add_argument("--output_format", type=str, choices=["tabular", "xlsx"], required=True, help="Output format: CSV (tabular) or Excel (xlsx)") - parser.add_argument("--out_data", type=str, + 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__), @@ -257,12 +260,15 @@ #### if ARGS.output_format == "xlsx": - #if not ARGS.out_xlsx.lower().endswith(".xlsx"): - # ARGS.out_xlsx += ".xlsx" - - merged.to_excel(ARGS.out_data, index=False) + if not ARGS.out_xlsx: + raise utils.ArgsErr("out_xlsx", "output path (--out_xlsx) is required when output_format == xlsx", ARGS.out_xlsx) + if not ARGS.out_xlsx.lower().endswith(".xlsx"): + ARGS.out_xlsx += ".xlsx" + merged.to_excel(ARGS.out_xlsx, index=False, sheet_name='Sheet_name_1') else: - merged.to_csv(ARGS.out_data, sep="\t", index=False) + if not ARGS.out_tabular: + raise utils.ArgsErr("out_tabular", "output path (--out_tabular) is required when output_format == tabular", ARGS.out_tabular) + merged.to_csv(ARGS.out_tabular, sep="\t", index=False) print("CustomDataGenerator: completed successfully")