comparison getcolumnnames.py @ 0:e77c9484b2d0 draft default tip

Uploaded
author saskia-hiltemann
date Thu, 22 Oct 2015 09:18:30 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e77c9484b2d0
1 import os, sys
2 import fnmatch
3 import csv
4
5 def get_headers(inputfile):
6 columnList=[]
7 #line=inputfile.readlines()[0]
8 filename=inputfile.get_file_name()
9 try:
10 f = open(filename)
11 line=f.readline()
12 while(line[0]=='#' or (not line.strip())): #remove header (starting with hash sign and empty lines to get to headerline
13 line=f.readline()
14 line = line.strip()
15 i=1;
16 for col in line.split("\t"):
17 label=str(i)+': '+str(col)
18 columnList.append([label,label,False])
19 i+=1
20
21 except IOError as e:
22 pass
23
24 return columnList
25
26
27
28
29
30