- # Method to convert the quality scores from a specified base
- # to another base.
- def convert_phred2illumina!
- self.qual.gsub!(/./) do |score|
- score_phred = score.ord - SCORE_PHRED
- raise SeqError, "Bad Phred score: #{score} (#{score_phred})" unless (0 .. 41).include? score_phred
- score_illumina = score_phred + SCORE_ILLUMINA
- score = score_illumina.chr
- end
- end
+ # Method to convert quality scores inbetween formats.
+ # Sanger base 33, range 0-40
+ # Solexa base 64, range -5-40
+ # Illumina13 base 64, range 0-40
+ # Illumina15 base 64, range 3-40
+ # Illumina18 base 33, range 0-41
+ def convert_scores!(from, to)
+ unless from == to
+ na_qual = NArray.to_na(self.qual, "byte")