Mercurial > repos > bgruening > flexynesis_utils
comparison convert.py @ 3:f413f828ef30 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:03 +0000 |
| parents | e5ecfffcfe45 |
| children |
comparison
equal
deleted
inserted
replaced
| 2:e5ecfffcfe45 | 3:f413f828ef30 |
|---|---|
| 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] |
