mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #12280 from bernt-matthias/topic/mothur-tabular
This commit is contained in:
@@ -494,21 +494,33 @@ class PairwiseDistanceMatrix(DistanceMatrix, Tabular):
|
||||
"""
|
||||
headers = iter_headers(file_prefix, sep='\t')
|
||||
count = 0
|
||||
names = [False, False]
|
||||
for line in headers:
|
||||
if not line[0].startswith('@'):
|
||||
if len(line) != 3:
|
||||
return False
|
||||
if line[0].startswith('@'):
|
||||
continue
|
||||
if len(line) != 3:
|
||||
return False
|
||||
# check if col3 contains distances (floats)
|
||||
try:
|
||||
float(line[2])
|
||||
try:
|
||||
float(line[2])
|
||||
try:
|
||||
# See if it's also an integer
|
||||
int(line[2])
|
||||
except ValueError:
|
||||
# At least one value is not an integer
|
||||
all_ints = False
|
||||
# See if it's also an integer
|
||||
int(line[2])
|
||||
except ValueError:
|
||||
return False
|
||||
count += 1
|
||||
# At least one value is not an integer
|
||||
all_ints = False
|
||||
except ValueError:
|
||||
return False
|
||||
count += 1
|
||||
# check if col1 and col2 likely contain names
|
||||
for c in [0, 1]:
|
||||
try:
|
||||
float(line[c])
|
||||
except ValueError:
|
||||
names[c] = True
|
||||
|
||||
if not names[0] or not names[1]:
|
||||
return False
|
||||
|
||||
if count > 2:
|
||||
return not all_ints
|
||||
|
||||
@@ -270,7 +270,7 @@ def guess_ext(fname, sniff_order, is_binary=False):
|
||||
>>> fname = get_test_fname('2.txt')
|
||||
>>> guess_ext(fname, sniff_order)
|
||||
'txt'
|
||||
>>> fname = get_test_fname('2.tabular')
|
||||
>>> fname = get_test_fname('test_tab2.tabular')
|
||||
>>> guess_ext(fname, sniff_order)
|
||||
'tabular'
|
||||
>>> fname = get_test_fname('3.txt')
|
||||
|
||||
@@ -719,7 +719,7 @@ class Pileup(Tabular):
|
||||
>>> fname = get_test_fname( '2.txt' )
|
||||
>>> Pileup().sniff( fname ) # 2.txt
|
||||
False
|
||||
>>> fname = get_test_fname( '2.tabular' )
|
||||
>>> fname = get_test_fname( 'test_tab2.tabular' )
|
||||
>>> Pileup().sniff( fname )
|
||||
False
|
||||
"""
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
a 2
|
||||
c 1
|
||||
d 0
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../../test-data/2.tabular
|
||||
@@ -0,0 +1,3 @@
|
||||
a 2
|
||||
c 1
|
||||
d 0
|
||||
Reference in New Issue
Block a user