]> git.donarmstrong.com Git - biopieces.git/commitdiff
added quality score check to read_fastq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 4 Feb 2013 13:50:07 +0000 (13:50 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 4 Feb 2013 13:50:07 +0000 (13:50 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2089 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/read_fastq

index c2f74cd7bb7a07219ac43ecfd574ad726f5b8f00..494797cae6f3b5f32bdbbd896817fb8cb889f4be 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# Copyright (C) 2007-2011 Martin A. Hansen.
+# Copyright (C) 2007-2013 Martin A. Hansen.
 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -40,8 +40,9 @@ casts << {:long=>'encoding', :short=>'e', :type=>'string', :mandatory=>false, :d
 
 options = Biopieces.options_parse(ARGV, casts)
 
-num  = 0
-last = false
+num   = 0
+first = true
+last  = false
 
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   unless options[:data_in] and options[:data_in].first == '-'
@@ -64,6 +65,9 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
             else
               raise SeqError, "Could not auto-detect quality score encoding"
             end
+          elsif first
+            raise SeqError, "Quality score outside valid range" unless entry.qual_valid?(encoding)
+            first = false
           end
 
           entry.convert_scores!(encoding, 'illumina13')