File: bin_profiles.py

package info (click to toggle)
spades 3.13.1+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 22,172 kB
  • sloc: cpp: 136,213; ansic: 48,218; python: 16,809; perl: 4,252; sh: 2,115; java: 890; makefile: 507; pascal: 348; xml: 303
file content (17 lines) | stat: -rwxr-xr-x 554 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python3
from __future__ import (print_function)

import pandas
from pandas import DataFrame
import sys

has_var = False
if len(sys.argv) > 3 and sys.argv[3] == "var":
    has_var = True

profiles_in = pandas.read_table(sys.argv[1], index_col=0, header=None)
profiles_in = profiles_in[profiles_in.columns[::2 if has_var else 1]]
binning_out = pandas.read_table(sys.argv[2], index_col=0, names=["bin"], dtype=str)
table = profiles_in.join(binning_out)
profiles = table.groupby("bin").median()
profiles.to_csv(sys.stdout, sep="\t", header=False)