Class: PluginKey

Inherits:
Plugin show all
Defined in:
lib/seqtrimnext/plugins/plugin_key.rb

Overview

Author: Almudena Bocinos Rioboo

Defines the main methods that are necessary to execute PluginKey

Inherit: Plugin

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



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

def self.check_params(params)
  errors=[]
  
  # self.check_param(errors,params,'blast_evalue_mids','Float')
  # self.check_param(errors,params,'blast_percent_mids','Integer')
  comment='sequences containing with diferent keys (barcodes) are saved to separate folders'
 default_value='false'
 params.check_param(errors,'use_independent_folder_for_each_key','String',default_value,comment)
  
  
  return errors
end

Instance Method Details

#exec_seq(seq, blast_query) ⇒ Object

Begins the pluginKey’s execution to warn where is a key in the sequence “seq”



14
15
16
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
43
44
45
# File 'lib/seqtrimnext/plugins/plugin_key.rb', line 14

def exec_seq(seq,blast_query)

  $LOG.debug "[#{self.class.to_s}, seq: #{seq.seq_name}]: marking key into the sequence" 
  # blast_table_results.inspect        
  
  actions=[]
  
  key_size=0
  # mid_size=0
  key_beg,key_end=[0,3]
  key_size=4
  key=seq.seq_fasta[0..3].upcase
  
  a = seq.new_action(key_beg,key_end,'ActionKey') # adds the actionKey to the sequence
  actions.push a       
  
  #Add actions  
  seq.add_actions(actions)
  
  
  if @group_by_key
    
    seq.add_file_tag(0,'key_' + key, :dir)
    add_stats('key_tag',key)
  end
  
  add_stats('key_size',key_size)
  # add_stats('mid_size',mid_size)
        

  
end