- if record.has_key? :SEQ and record.has_key? :SCORES
- case options[:trim]
- when /both/
- record[:SCORES].match(regex_right) do |m|
- record[:SEQ] = record[:SEQ][0 ... record[:SEQ].length - m.to_s.length]
- record[:SCORES] = $`
- record[:SEQ_LEN] = record[:SEQ].length
- record[:TRIM_LEFT] = m.to_s.length
- end
- record[:SCORES].match(regex_left) do |m|
- record[:SEQ] = record[:SEQ][m.to_s.length ... record[:SEQ].length]
- record[:SCORES] = $'
- record[:SEQ_LEN] = record[:SEQ].length
- record[:TRIM_RIGHT] = $'.length - 1
- end
- when /left/
- record[:SCORES].match(regex_left) do |m|
- record[:SEQ] = record[:SEQ][m.to_s.length ... record[:SEQ].length]
- record[:SCORES] = $'
- record[:SEQ_LEN] = record[:SEQ].length
- record[:TRIM_LEFT] = m.to_s.length
- end
- when /right/
- record[:SCORES].match(regex_right) do |m|
- record[:SEQ] = record[:SEQ][0 ... record[:SEQ].length - m.to_s.length]
- record[:SCORES] = $`
- record[:SEQ_LEN] = record[:SEQ].length
- record[:TRIM_RIGHT] = $`.length - 1
- end
+ if record[:SEQ] and record[:SCORES]
+ entry = Seq.new_bp(record)
+
+ case trim
+ when :both then entry.quality_trim!(options[:min_qual], options[:min_len])
+ when :left then entry.quality_trim_left!(options[:min_qual], options[:min_len])
+ when :right then entry.quality_trim_right!(options[:min_qual], options[:min_len])