Fixed a weakness in sniff where all whitespace on lines were stripped, in some cases eliminating desired blank columns.

This commit is contained in:
Greg Von Kuster
2007-07-11 18:03:39 +00:00
parent 80474d6a60
commit 3ce9f86358
2 changed files with 13 additions and 2 deletions
+5 -2
View File
@@ -81,7 +81,7 @@ def get_headers(fname, sep, count=30):
"""
headers = []
for idx, line in enumerate(file(fname)):
line = line.strip()
line = line.rstrip('\n\r')
if idx == count:
break
headers.append( line.split(sep) )
@@ -105,8 +105,11 @@ def is_column_based(fname, sep='\t'):
False
>>> is_column_based(fname, sep=' ')
True
>>> fname = get_test_fname('test_ensembl.tab')
>>> is_column_based(fname)
True
"""
headers = get_headers(fname, sep=sep)
headers = get_headers(fname, sep=sep)
if not headers:
return False
@@ -0,0 +1,8 @@
Ensembl Gene ID Ensembl Transcript ID Chicken Ensembl Gene ID Orthology Type
ENSOANG00000013952 ENSOANT00000021996 ENSGALG00000012404 ortholog_one2one
ENSOANG00000013954 ENSOANT00000021998 ENSGALG00000012401 ortholog_one2one
ENSOANG00000013954 ENSOANT00000021999 ENSGALG00000012401 ortholog_one2one
ENSOANG00000013954 ENSOANT00000022000 ENSGALG00000012401 ortholog_one2one
ENSOANG00000013955 ENSOANT00000022001
ENSOANG00000013955 ENSOANT00000022002
ENSOANG00000013956 ENSOANT00000022005 ENSGALG00000012400