details: http://www.bx.psu.edu/hg/galaxy/rev/9cc57a489be0 changeset: 3246:9cc57a489be0 user: Kelly Vincent <kpvincent@bx.psu.edu> date: Fri Jan 15 12:51:45 2010 -0500 description: Corrected counting of sequences in fastq set_meta diffstat: lib/galaxy/datatypes/sequence.py | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diffs (35 lines): diff -r fa318a093bf2 -r 9cc57a489be0 lib/galaxy/datatypes/sequence.py --- a/lib/galaxy/datatypes/sequence.py Thu Jan 14 17:49:20 2010 -0500 +++ b/lib/galaxy/datatypes/sequence.py Fri Jan 15 12:51:45 2010 -0500 @@ -160,16 +160,28 @@ """ data_lines = 0 sequences = 0 + seq_counter = 0 # blocks should be 4 lines long for line in file( dataset.file_name ): line = line.strip() if line and line.startswith( '#' ): # We don't count comment lines for sequence data types continue - if line and line.startswith( '@' ): - sequences += 1 - data_lines +=1 + if line and line.startswith( '@' ): + if seq_counter >= 4: + # count previous block + # blocks should be 4 lines long + sequences += 1 + seq_counter = 1 + else: + # in case quality line starts with @ + seq_counter += 1 + data_lines += 1 else: data_lines += 1 + seq_counter += 1 + if seq_counter >= 4: + # count final block + sequences += 1 dataset.metadata.data_lines = data_lines dataset.metadata.sequences = sequences def sniff ( self, filename ):