Mercurial > repos > bgruening > flexynesis_plot
comparison flexynesis_utils.py @ 2:3c5d82bf6e8a draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/flexynesis commit 1afbaf45449e25238935e222f983da62392c067a
| author | bgruening |
|---|---|
| date | Fri, 04 Jul 2025 14:57:52 +0000 |
| parents | bb91bf19eb40 |
| children | 52b6f2ac38c7 |
comparison
equal
deleted
inserted
replaced
| 1:262c2132b392 | 2:3c5d82bf6e8a |
|---|---|
| 154 os.makedirs(os.path.join(output_dir, 'test'), exist_ok=True) | 154 os.makedirs(os.path.join(output_dir, 'test'), exist_ok=True) |
| 155 | 155 |
| 156 # Save train and test data | 156 # Save train and test data |
| 157 for key in data.keys(): | 157 for key in data.keys(): |
| 158 try: | 158 try: |
| 159 train_data[key].to_csv(os.path.join(output_dir, 'train', f'{key}.csv')) | 159 train_data[key].to_csv(os.path.join(output_dir, 'train', f'{key}.tabular'), sep='\t') |
| 160 test_data[key].to_csv(os.path.join(output_dir, 'test', f'{key}.csv')) | 160 test_data[key].to_csv(os.path.join(output_dir, 'test', f'{key}.tabular'), sep='\t') |
| 161 except Exception as e: | 161 except Exception as e: |
| 162 print(f"Error saving {key}: {e}") | 162 print(f"Error saving {key}: {e}") |
| 163 continue | 163 continue |
| 164 | 164 |
| 165 | 165 |
| 242 if mutations_df.empty: | 242 if mutations_df.empty: |
| 243 raise ValueError("Mutation data file is empty") | 243 raise ValueError("Mutation data file is empty") |
| 244 | 244 |
| 245 binarized_matrix = binarize_mutations(mutations_df, gene_idx=args.gene_idx, sample_idx=args.sample_idx) | 245 binarized_matrix = binarize_mutations(mutations_df, gene_idx=args.gene_idx, sample_idx=args.sample_idx) |
| 246 # Save binarized matrix | 246 # Save binarized matrix |
| 247 output_file = os.path.join(args.out, 'binarized_mutations.csv') | 247 output_file = os.path.join(args.out, 'binarized_mutations.tabular') |
| 248 binarized_matrix.to_csv(output_file) | 248 binarized_matrix.to_csv(output_file, sep='\t') |
| 249 print(f"Binarized mutation matrix saved to {output_file}") | 249 print(f"Binarized mutation matrix saved to {output_file}") |
| 250 | 250 |
| 251 except Exception as e: | 251 except Exception as e: |
| 252 print(f"Error: {e}", file=sys.stderr) | 252 print(f"Error: {e}", file=sys.stderr) |
| 253 sys.exit(1) | 253 sys.exit(1) |
