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
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
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