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_stats, #add_text_stats, auto_setup, check_param, 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



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/seqtrimnext/plugins/plugin_low_high_size.rb', line 59

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) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/seqtrimnext/plugins/plugin_low_high_size.rb', line 24

def exec_seq(seq)   
  $LOG.info "[#{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 ((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

#execute(seqs) ⇒ Object

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



17
18
19
20
21
# File 'lib/seqtrimnext/plugins/plugin_low_high_size.rb', line 17

def execute(seqs)
 seqs.each do |s|
     exec_seq(s)
  end
end