Mercurial > repos > galaxyp > calisp
comparison feather2tsv.py @ 0:d158a7909193 draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/calisp commit 060699366b6dd19ad6c3ef3f332f63cc55d75dce
| author | galaxyp |
|---|---|
| date | Thu, 01 Jun 2023 08:33:58 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d158a7909193 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 """ | |
| 3 based on https://github.com/kinestetika/Calisp/blob/master/benchmarking/sip%20benchmarking.ipynb | |
| 4 """ | |
| 5 | |
| 6 import argparse | |
| 7 import os | |
| 8 | |
| 9 import pandas as pd | |
| 10 | |
| 11 | |
| 12 def load_calisp_data(filename): | |
| 13 | |
| 14 # (1) load data | |
| 15 if os.path.isdir(filename): | |
| 16 file_data = [] | |
| 17 for f in os.listdir(filename): | |
| 18 if not f.endswith(".feather"): | |
| 19 continue | |
| 20 f = os.path.join(filename, f) | |
| 21 file_data.append(pd.read_feather(f)) | |
| 22 base, _ = os.path.splitext(f) | |
| 23 file_data[-1].to_csv(f"{base}.tsv", sep="\t") | |
| 24 data = pd.concat(file_data) | |
| 25 else: | |
| 26 data = pd.read_feather(filename) | |
| 27 base, _ = os.path.splitext(filename) | |
| 28 data.to_csv(f"{base}.tsv", sep="\t") | |
| 29 | |
| 30 | |
| 31 parser = argparse.ArgumentParser(description='feather2tsv') | |
| 32 parser.add_argument('--calisp_output', required=True, help='feather file') | |
| 33 args = parser.parse_args() | |
| 34 | |
| 35 data = load_calisp_data(args.calisp_output) |
