]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed quality score validity check
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 8 Feb 2013 07:48:39 +0000 (07:48 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 8 Feb 2013 07:48:39 +0000 (07:48 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2091 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/read_fastq
code_ruby/lib/maasha/seq.rb
code_ruby/test/maasha/test_seq.rb

index 44a69ed871cd40f686d4f9be675258377b4c6ebf..96be2c3a06f8b2762fdfa3e918fe68f091c74fce 100755 (executable)
@@ -65,12 +65,15 @@ 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')
+
+          if first
+            raise SeqError, "Quality score outside valid range" unless entry.qual_valid?('illumina13')
+            first = false
+          end
+
           output.puts entry.to_bp
           num += 1
 
index f2d93d1fc5bbf86b6611e56e9eb9ce98d9185795..8833acba2f54ca3eb22407912f8421d324e6ff52 100644 (file)
@@ -552,12 +552,12 @@ class Seq
     raise SeqError, "Missing qual" if self.qual.nil?
 
     case encoding.downcase
-    when "sanger"     then return true if self.qual.match(/^[!-I]*$/)
-    when "454"        then return true if self.qual.match(/^[@-h]*$/)
-    when "solexa"     then return true if self.qual.match(/^[;-h]*$/)
-    when "illumina13" then return true if self.qual.match(/^[@-h]*$/)
-    when "illumina15" then return true if self.qual.match(/^[@-h]*$/)
-    when "illumina18" then return true if self.qual.match(/^[!-J]*$/)
+    when "sanger"     then return true if self.qual.match(/^[!-~]*$/)
+    when "454"        then return true if self.qual.match(/^[@-~]*$/)
+    when "solexa"     then return true if self.qual.match(/^[;-~]*$/)
+    when "illumina13" then return true if self.qual.match(/^[@-~]*$/)
+    when "illumina15" then return true if self.qual.match(/^[@-~]*$/)
+    when "illumina18" then return true if self.qual.match(/^[!-~]*$/)
     else raise SeqError, "unknown quality score encoding: #{encoding}"
     end
 
index 171e6b1ae9157205527a0613ef68fe65686bf4e7..a7145ef009beb5ebf35e4f48eeb7becf5d5ae4d3 100755 (executable)
@@ -520,12 +520,12 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_qual_valid_returns_correctly
-    tests = [["sanger",      0, 40, 33],
-             ["454",         0, 40, 64],
-             ["solexa",     -5, 40, 64],
-             ["illumina13",  0, 40, 64],
-             ["illumina15",  0, 40, 64],
-             ["illumina18",  0, 41, 33]]
+    tests = [["sanger",      0, 93, 33],
+             ["454",         0, 62, 64],
+             ["solexa",     -5, 62, 64],
+             ["illumina13",  0, 62, 64],
+             ["illumina15",  0, 62, 64],
+             ["illumina18",  0, 93, 33]]
 
     tests.each do |test|
       @entry.qual = (test[1] + test[-1]).chr + (test[2] + test[-1]).chr