Sha256: e7ce9d6ee8fd5ade216abb83f714fa539e5486774119c6715fac0c6754c928bf

Contents?: true

Size: 1.81 KB

Versions: 5

Compression:

Stored size: 1.81 KB

Contents

require "plugin"

########################################################
# Author: Almudena Bocinos Rioboo                      
# 
# Defines the main methods that are necessary to execute PluginKey                                                     
# Inherit: Plugin
########################################################

class PluginKey < Plugin   
  
  
   #Begins the pluginKey's execution to warn where is a key in the sequence "seq"    
  def execute(seqs)
     @group_by_key=(@params.get_param('use_independent_folder_for_each_key')=='true')
     
     seqs.each do |s|
         exec_seq(s)
     end
   end


   def exec_seq(seq)
     $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
 
  #Returns an array with the errors due to parameters are missing 
  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
  
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
seqtrimnext-2.0.51 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.50 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.49 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.48 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.46 lib/seqtrimnext/plugins/plugin_key.rb