Skip to content

Instantly share code, notes, and snippets.

@buchanae
Created April 29, 2013 21:19
Show Gist options
  • Save buchanae/5484866 to your computer and use it in GitHub Desktop.
Save buchanae/5484866 to your computer and use it in GitHub Desktop.
from __future__ import print_function
otu_list = ['otu1', 'otu2', 'otu15']
d = {'nice name': {'otu1': 24, 'otu15': 57}}
for name, otu_counts in d.items():
cols = []
for otu_key in otu_list:
count = otu_counts.get(otu_key, 0)
cols.append(count)
print(name, sum(cols), *cols, sep='\t')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment