comparison convert.py @ 5:466b593fd87e draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/flexynesis commit 1afbaf45449e25238935e222f983da62392c067a
author bgruening
date Fri, 04 Jul 2025 14:57:40 +0000
parents
children
comparison
equal deleted inserted replaced
4:1a5f8cedda43 5:466b593fd87e
1 #!/usr/bin/env python
2
3 import sys
4
5 import pandas as pd
6
7
8 def tabular_to_csv(tabular_file, csv_file):
9 """Convert tabular (TSV) to CSV"""
10 data = pd.read_csv(tabular_file, sep="\t")
11 data.to_csv(csv_file, index=False)
12
13
14 def csv_to_tabular(csv_file, tabular_file):
15 """Convert CSV to tabular (TSV)"""
16 data = pd.read_csv(csv_file)
17 data.to_csv(tabular_file, sep="\t", index=False)
18
19
20 if __name__ == "__main__":
21 input_file = sys.argv[1]
22 output_file = sys.argv[2]
23
24 if input_file.endswith('.csv'):
25 csv_to_tabular(input_file, output_file)
26 else:
27 tabular_to_csv(input_file, output_file)