diff tablemerger.py @ 7:8de0ffc2166f draft default tip

Uploaded
author rreumerman
date Mon, 10 Jun 2013 09:40:54 -0400
parents bd5692103d5b
children
line wrap: on
line diff
--- a/tablemerger.py	Fri Apr 05 05:06:42 2013 -0400
+++ b/tablemerger.py	Mon Jun 10 09:40:54 2013 -0400
@@ -16,11 +16,14 @@
         continue
 
 # Fetch headers and print them to output file;
-headers = [header.readline()[:-1].split('\t')[2:] for header in files]
-columns = [len(strains) for strains in headers]
-for strain in [a for b in headers for a in b]:
-    output.write('\t'+strain)
-    output.flush()
+headers = [File.readline()[:-1].split('\t')[1:] for File in files]
+columns = [len(strains[1:]) for strains in headers]
+output.write('\t'.join(['Position']+[headers[0][0]]+[a for b in headers for a in b[1:]]))
+##headers = [header.readline()[:-1].split('\t')[2:] for header in files]
+##columns = [len(strains) for strains in headers]
+##for strain in [a for b in headers for a in b]:
+##    output.write('\t'+strain)
+##    output.flush()
 
 file_active = [True]*len(files)
 snps = [row.readline()[:-1].split('\t') for row in files]