Mercurial > repos > bgruening > flexynesis
comparison convert.py @ 8:9c91d13827ef draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/flexynesis commit 6b520305ec30e6dc37eba92c67a5368cea0fc5ad
author | bgruening |
---|---|
date | Wed, 23 Jul 2025 07:50:31 +0000 |
parents | 9450286c42ab |
children |
comparison
equal
deleted
inserted
replaced
7:9450286c42ab | 8:9c91d13827ef |
---|---|
6 | 6 |
7 | 7 |
8 def tabular_to_csv(tabular_file, csv_file): | 8 def tabular_to_csv(tabular_file, csv_file): |
9 """Convert tabular (TSV) to CSV""" | 9 """Convert tabular (TSV) to CSV""" |
10 data = pd.read_csv(tabular_file, sep="\t") | 10 data = pd.read_csv(tabular_file, sep="\t") |
11 if data.columns[0] == '' or data.columns[0].startswith('Unnamed:'): | |
12 data.columns = ['ID'] + list(data.columns[1:]) | |
11 data.to_csv(csv_file, index=False) | 13 data.to_csv(csv_file, index=False) |
12 | 14 |
13 | 15 |
14 def csv_to_tabular(csv_file, tabular_file): | 16 def csv_to_tabular(csv_file, tabular_file): |
15 """Convert CSV to tabular (TSV)""" | 17 """Convert CSV to tabular (TSV)""" |
16 data = pd.read_csv(csv_file) | 18 data = pd.read_csv(csv_file) |
19 if data.columns[0] == '' or data.columns[0].startswith('Unnamed:'): | |
20 data.columns = ['ID'] + list(data.columns[1:]) | |
17 data.to_csv(tabular_file, sep="\t", index=False) | 21 data.to_csv(tabular_file, sep="\t", index=False) |
18 | 22 |
19 | 23 |
20 if __name__ == "__main__": | 24 if __name__ == "__main__": |
21 input_file = sys.argv[1] | 25 input_file = sys.argv[1] |