Mercurial > repos > bimib > cobraxy
comparison 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 |
comparison
equal
deleted
inserted
replaced
374:5c98a5cd8bd8 | 375:130043620f8d |
---|---|
37 help="Custom medium file if medium_selector=Custom") | 37 help="Custom medium file if medium_selector=Custom") |
38 | 38 |
39 parser.add_argument("--output_format", type=str, choices=["tabular", "xlsx"], required=True, | 39 parser.add_argument("--output_format", type=str, choices=["tabular", "xlsx"], required=True, |
40 help="Output format: CSV (tabular) or Excel (xlsx)") | 40 help="Output format: CSV (tabular) or Excel (xlsx)") |
41 | 41 |
42 parser.add_argument("--out_data", type=str, | 42 parser.add_argument("--out_tabular", type=str, |
43 help="Output file for the merged dataset (CSV or XLSX)") | |
44 | |
45 parser.add_argument("--out_xlsx", type=str, | |
43 help="Output file for the merged dataset (CSV or XLSX)") | 46 help="Output file for the merged dataset (CSV or XLSX)") |
44 | 47 |
45 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), | 48 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), |
46 help="Tool directory (passed from Galaxy as $__tool_directory__)") | 49 help="Tool directory (passed from Galaxy as $__tool_directory__)") |
47 | 50 |
255 | 258 |
256 | 259 |
257 #### | 260 #### |
258 | 261 |
259 if ARGS.output_format == "xlsx": | 262 if ARGS.output_format == "xlsx": |
260 #if not ARGS.out_xlsx.lower().endswith(".xlsx"): | 263 if not ARGS.out_xlsx: |
261 # ARGS.out_xlsx += ".xlsx" | 264 raise utils.ArgsErr("out_xlsx", "output path (--out_xlsx) is required when output_format == xlsx", ARGS.out_xlsx) |
262 | 265 if not ARGS.out_xlsx.lower().endswith(".xlsx"): |
263 merged.to_excel(ARGS.out_data, index=False) | 266 ARGS.out_xlsx += ".xlsx" |
267 merged.to_excel(ARGS.out_xlsx, index=False, sheet_name='Sheet_name_1') | |
264 else: | 268 else: |
265 merged.to_csv(ARGS.out_data, sep="\t", index=False) | 269 if not ARGS.out_tabular: |
270 raise utils.ArgsErr("out_tabular", "output path (--out_tabular) is required when output_format == tabular", ARGS.out_tabular) | |
271 merged.to_csv(ARGS.out_tabular, sep="\t", index=False) | |
266 | 272 |
267 print("CustomDataGenerator: completed successfully") | 273 print("CustomDataGenerator: completed successfully") |
268 | 274 |
269 if __name__ == '__main__': | 275 if __name__ == '__main__': |
270 main() | 276 main() |