Method: PluginLowQuality#exec_seq

Defined in:
lib/seqtrimnext/plugins/plugin_low_quality.rb,
lib/seqtrimnext/plugins_old/plugin_low_quality_old.rb

#exec_seq(seq, blast_query) ⇒ Object

Begins the plugin1’s execution whit the sequence “seq” Creates an action by each subsequence with low quality to eliminate it A subsequence has low quality if (the add of all its qualitis < subsequence_size*20)

Creates the qualities windows from the sequence, looks for the subsequence with high quality and mark, with an action, the before part to the High Quality Subsequence like a low quality part Finally mark, with an action, the after part to the High Quality Subsequence like a low quality part




118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/seqtrimnext/plugins/plugin_low_quality.rb', line 118

def exec_seq(seq,blast_query)

  if ((self.class.to_s=='PluginLowQuality') && seq.seq_qual.nil? ) 
    $LOG.debug " Quality File haven't been provided. It's impossible to execute " + self.class.to_s     
  elsif ((seq.seq_qual.size>0) && (@params.get_param('use_qual').to_s=='true'))
       
       $LOG.debug "[#{self.class.to_s}, seq: #{seq.seq_name}]: checking low quality of the sequence"
       
       min_quality=@params.get_param('min_quality').to_i
       min_length_inside_seq=@params.get_param('min_length_inside_seq').to_i
       max_consecutive_good_bases=@params.get_param('max_consecutive_good_bases').to_i
       
       type='ActionLowQuality'
       actions=[]
       
       regions=get_low_qual_regions(seq.seq_qual,min_quality,min_length_inside_seq,max_consecutive_good_bases)
       
       regions.each do |r|
         low_qual_size=r.last-r.first+1
         
         # puts "(#{low_qual_size}) = [#{r.first},#{r.last}]: #{a[r.first..r.last].map{|e| ("%2d" % e.to_s)}.join(' ')}"
        
        
        add_stats('low_qual',low_qual_size)
        
        
        # create action
        a = seq.new_action(r.first,r.last,type) # adds the correspondent action to the sequence
        actions.push a
        
        
        
       end

       # add quals
       seq.add_actions(actions)
  end       

end