view 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
line wrap: on
line source

#!/usr/bin/env python

import sys

import pandas as pd


def tabular_to_csv(tabular_file, csv_file):
    """Convert tabular (TSV) to CSV"""
    data = pd.read_csv(tabular_file, sep="\t")
    data.to_csv(csv_file, index=False)


def csv_to_tabular(csv_file, tabular_file):
    """Convert CSV to tabular (TSV)"""
    data = pd.read_csv(csv_file)
    data.to_csv(tabular_file, sep="\t", index=False)


if __name__ == "__main__":
    input_file = sys.argv[1]
    output_file = sys.argv[2]

    if input_file.endswith('.csv'):
        csv_to_tabular(input_file, output_file)
    else:
        tabular_to_csv(input_file, output_file)