diff --git a/lib/galaxy/datatypes/interval.py b/lib/galaxy/datatypes/interval.py index e9b4454c49c..7380b2c8434 100644 --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -714,23 +714,16 @@ class CustomTrack ( Tabular ): for hdr in headers: if first_line: try: - if hdr[0].startswith('track'): - first_line = False - else: - return False - except: - return False + if hdr[0].startswith('track') and hdr[0].find('color') > -1 and hdr[0].find('visibility') > -1: first_line = False + else: return False + except: return False else: try: - if not (hdr[0] == '' or hdr[0].startswith( '#' )): - if len(hdr) < 3: - return False - try: - map( int, [hdr[1], hdr[2]] ) - except: - return False - except: - return False + if hdr[0] and not hdr[0].startswith( '#' ): + if len( hdr ) < 3: return False + try: map( int, [hdr[1], hdr[2]] ) + except: return False + except: return False return True class GBrowseTrack ( Tabular ): diff --git a/tools/new_operations/subtract_query.py b/tools/new_operations/subtract_query.py index 7befb9b428e..39fb232dd32 100644 --- a/tools/new_operations/subtract_query.py +++ b/tools/new_operations/subtract_query.py @@ -18,12 +18,16 @@ def get_lines(fname, begin_col='', end_col=''): i = 0 for i, line in enumerate(file(fname)): line = line.rstrip('\r\n') - if line != '' and not line.startswith('#'): + if line and not line.startswith('#'): if begin_col and end_col: """Both begin_col and end_col must be integers at this point.""" - line = line.split('\t') - line = '\t'.join([line[j] for j in range(begin_col-1, end_col)]) - lines.add( line ) + try: + line = line.split('\t') + line = '\t'.join([line[j] for j in range(begin_col-1, end_col)]) + lines.add( line ) + except: pass + else: + lines.add( line ) if i: return (i+1, lines) else: return (i, lines) @@ -89,7 +93,7 @@ def main(): info_msg += 'Restricted to columns c' + str(begin_col) + ' thru c' + str(end_col) + '. ' if diff1 > 0: - info_msg += 'Eliminated %d duplicate/blank/comment lines from first query.' %diff1 + info_msg += 'Eliminated %d duplicate/blank/comment/invalid lines from first query.' %diff1 print info_msg