Mercurial > repos > bimib > cobraxy
comparison COBRAxy/custom_data_generator.py @ 373:72f592fe1f7d draft
Uploaded
| author | francesco_lapi | 
|---|---|
| date | Fri, 05 Sep 2025 05:54:35 +0000 | 
| parents | d0a307c3ae36 | 
| children | 130043620f8d | 
   comparison
  equal
  deleted
  inserted
  replaced
| 372:d0a307c3ae36 | 373:72f592fe1f7d | 
|---|---|
| 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_tabular", type=str, | 42 parser.add_argument("--out_data", type=str, | 
| 43 help="Output file for the merged dataset (CSV or XLSX)") | |
| 44 | |
| 45 parser.add_argument("--out_xlsx", type=str, | |
| 46 help="Output file for the merged dataset (CSV or XLSX)") | 43 help="Output file for the merged dataset (CSV or XLSX)") | 
| 47 | 44 | 
| 48 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), | 45 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), | 
| 49 help="Tool directory (passed from Galaxy as $__tool_directory__)") | 46 help="Tool directory (passed from Galaxy as $__tool_directory__)") | 
| 50 | 47 | 
| 261 | 258 | 
| 262 if ARGS.output_format == "xlsx": | 259 if ARGS.output_format == "xlsx": | 
| 263 #if not ARGS.out_xlsx.lower().endswith(".xlsx"): | 260 #if not ARGS.out_xlsx.lower().endswith(".xlsx"): | 
| 264 # ARGS.out_xlsx += ".xlsx" | 261 # ARGS.out_xlsx += ".xlsx" | 
| 265 | 262 | 
| 266 merged.to_excel(ARGS.out_xlsx, index=False) | 263 merged.to_excel(ARGS.out_data, index=False) | 
| 267 else: | 264 else: | 
| 268 merged.to_csv(ARGS.out_tabular, sep="\t", index=False) | 265 merged.to_csv(ARGS.out_data, sep="\t", index=False) | 
| 269 | 266 | 
| 270 print("CustomDataGenerator: completed successfully") | 267 print("CustomDataGenerator: completed successfully") | 
| 271 | 268 | 
| 272 if __name__ == '__main__': | 269 if __name__ == '__main__': | 
| 273 main() | 270 main() | 
