Last active
September 26, 2017 06:05
-
-
Save standage/61af4af51608fa2d79ab310f4d8eb7d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import khmer | |
import pandas | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--counts', nargs='+') | |
parser.add_argument('--samples', nargs='+') | |
parser.add_argument('window', nargs='+') | |
args = parser.parse_args() | |
counts = [khmer.Counttable.load(cfile) for cfile in args.counts] | |
if not args.samples: | |
labels = ['Sample{:d}Abund'.format(i) for i in range(len(counts))] | |
else: | |
labels = ['{:s}Abund'.format(sample) for sample in args.samples] | |
assert len(labels) == len(counts) | |
for window in args.window: | |
data = pandas.DataFrame( | |
[[k] + [c.get(k) for c in counts] for k in counts[0].get_kmers(window)], | |
columns=['K-mer'] + labels, | |
) | |
print(data.to_string(index=False)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment