Class: PluginLowHighSize

Inherits:
Plugin
  • Object
show all
Defined in:
lib/seqtrimnext/plugins/plugin_low_high_size.rb

Instance Attribute Summary

Attributes inherited from Plugin

#stats

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Plugin

#add_plugin_stats, #add_stats, #add_text_stats, auto_setup, #can_execute?, check_param, #do_blasts, #execute, get_graph_filename, get_graph_title, graph_ignored?, ignored_graphs, #initialize, #merge_hits, #overlapX?, plot_setup, valid_graphs

Constructor Details

This class inherits a constructor from Plugin

Class Method Details

.check_params(params) ⇒ Object

Returns an array with the errors due to parameters are missing



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/seqtrimnext/plugins/plugin_low_high_size.rb', line 49

def self.check_params(params)
  errors=[]
  
  comment='Minimum size for a raw input sequence to be analysed (shorter reads are directly rejected without further analysis)'
default_value = 40
params.check_param(errors,'min_sequence_size_raw','Integer',default_value,comment)

  #self.check_param(errors,params,'max_sequence_size_raw','Integer')
  
  
  return errors
end

Instance Method Details

#exec_seq(seq, blast_query) ⇒ Object

Begins the plugin_low_high_size’s execution with the sequence “seq”



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/seqtrimnext/plugins/plugin_low_high_size.rb', line 17

def exec_seq(seq,blast_query)

  $LOG.debug "[#{self.class.to_s}, seq: #{seq.seq_name}]: checking low or high size of the sequence"    
  
  min_size = @params.get_param('min_sequence_size_raw').to_i #min_size is: mean - 2dev
  max_size = @params.get_param('max_sequence_size_raw').to_i #max_size is: mean + 2dev
  #add_stats('rejected_seqs',seq.seq_fasta.length)
  actions=[]
  
  if ((max_size>0 && (seq.seq_fasta.length>max_size)) || (seq.seq_fasta.length<min_size))  #if length of sequence is out of (-2dev,2dev)
    $LOG.debug "#{seq.seq_name} rejected by size #{seq.seq_fasta.length} "
    type='ActionLowHighSize'
    # seq.add_action(0,seq.seq_fasta.length,type)  
    a = seq.new_action(0,seq.seq_fasta.length,type)
    a.message = 'low or high size'
    seq.seq_rejected = true 
    seq.seq_rejected_by_message= 'size out of limits'
     
    add_stats('rejected_seqs',seq.seq_fasta.length)
    actions.push a
    seq.add_actions(actions)
  
  end  
  
  
end