[hg] galaxy 2493: Only search up to the first 100 lines in an in...
details: http://www.bx.psu.edu/hg/galaxy/rev/d51e2ea0daf9 changeset: 2493:d51e2ea0daf9 user: Dan Blankenberg <dan@bx.psu.edu> date: Thu Jul 23 12:24:12 2009 -0400 description: Only search up to the first 100 lines in an interval file when setting metadata. 1 file(s) affected in this change: lib/galaxy/datatypes/interval.py diffs (25 lines): diff -r 2177d6f7bf80 -r d51e2ea0daf9 lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py Thu Jul 23 12:16:44 2009 -0400 +++ b/lib/galaxy/datatypes/interval.py Thu Jul 23 12:24:12 2009 -0400 @@ -75,6 +75,8 @@ """Tries to guess from the line the location number of the column for the chromosome, region start-end and strand""" if dataset.has_data(): + empty_line_count = 0 + num_check_lines = 100 # only check up to this many non empty lines for i, line in enumerate( file( dataset.file_name ) ): line = line.rstrip( '\r\n' ) if line: @@ -131,8 +133,10 @@ dataset.metadata.strandCol = 6 metadata_is_set = True break - if metadata_is_set: - break # Our metadata is set, so break out of the outer loop + if metadata_is_set or ( i - empty_line_count ) > num_check_lines: + break # Our metadata is set or we examined 100 non-empty lines, so break out of the outer loop + else: + empty_line_count += 1 def get_estimated_display_viewport( self, dataset ): """Return a chrom, start, stop tuple for viewing a file."""
participants (1)
-
Greg Von Kuster