Mercurial > repos > rreumerman > snptools
comparison tablemerger.py @ 7:8de0ffc2166f draft default tip
Uploaded
| author | rreumerman |
|---|---|
| date | Mon, 10 Jun 2013 09:40:54 -0400 |
| parents | bd5692103d5b |
| children |
comparison
equal
deleted
inserted
replaced
| 6:e711f63e99ff | 7:8de0ffc2166f |
|---|---|
| 14 files.append(open(name, "rU")) | 14 files.append(open(name, "rU")) |
| 15 except: | 15 except: |
| 16 continue | 16 continue |
| 17 | 17 |
| 18 # Fetch headers and print them to output file; | 18 # Fetch headers and print them to output file; |
| 19 headers = [header.readline()[:-1].split('\t')[2:] for header in files] | 19 headers = [File.readline()[:-1].split('\t')[1:] for File in files] |
| 20 columns = [len(strains) for strains in headers] | 20 columns = [len(strains[1:]) for strains in headers] |
| 21 for strain in [a for b in headers for a in b]: | 21 output.write('\t'.join(['Position']+[headers[0][0]]+[a for b in headers for a in b[1:]])) |
| 22 output.write('\t'+strain) | 22 ##headers = [header.readline()[:-1].split('\t')[2:] for header in files] |
| 23 output.flush() | 23 ##columns = [len(strains) for strains in headers] |
| 24 ##for strain in [a for b in headers for a in b]: | |
| 25 ## output.write('\t'+strain) | |
| 26 ## output.flush() | |
| 24 | 27 |
| 25 file_active = [True]*len(files) | 28 file_active = [True]*len(files) |
| 26 snps = [row.readline()[:-1].split('\t') for row in files] | 29 snps = [row.readline()[:-1].split('\t') for row in files] |
| 27 | 30 |
| 28 while True in file_active: | 31 while True in file_active: |
