Created
April 18, 2013 00:48
-
-
Save buchanae/5408984 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
# maps names to OTU numbers | |
name_to_OTU = { | |
'name_1': 23, | |
'RIO12.3_44008': 93, | |
} | |
# contrived data to represent what you emailed | |
# this represents one sample's counts, | |
# e.g. the "('MID - OLD12.5',..." line | |
per_sample_counts = Counter({ | |
'name_1': 1, | |
'RIO12.3_44008': 3, | |
}) | |
# Print out the counts with updated names | |
for name, count in per_sample_counts: | |
print 'OTU({})'.format(name_to_OTU[name]), count | |
# Or, update the counts without printing | |
updated = {} | |
for name, count in per_sample_counts: | |
x = 'OTU({})'.format(name_to_OUT[name]) | |
updated[x] = count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment