Skip to content

Instantly share code, notes, and snippets.

@azmfaridee
Created July 20, 2012 15:00
Show Gist options
  • Save azmfaridee/3151179 to your computer and use it in GitHub Desktop.
Save azmfaridee/3151179 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
f = open('uniq.design')
design = {}
for x in f:
row = x.strip().split()
if len(row) < 2: continue
design[row[0]] = row[1]
f.close()
# print design
data = []
# f = open('inpatient.final.an.0.03.subsample.avg.shared')
f = open('outin.final.an.0.03.subsample.avg.shared')
for x in f:
row = x.strip().split()
data.append(row)
f.close()
processed = []
for x in data[1:]:
newrow = x[3:]
group = x[1]
otuClass = design[group]
newrow.append(otuClass)
processed.append(newrow)
for row in processed:
for x in row: print x,
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment