Sha256: 301305de2ce60c66b2d1f851749745b6bd7bb0ca6ce07b89729fd66ac0369f9d

Contents?: true

Size: 1.81 KB

Versions: 12

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.info "[#{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

12 entries across 12 versions & 1 rubygems

Version Path
seqtrimnext-2.0.45 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.42 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.41 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.39 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.38 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.36 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.35 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.33 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.32 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.31 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.30 lib/seqtrimnext/plugins/plugin_key.rb
seqtrimnext-2.0.29 lib/seqtrimnext/plugins/plugin_key.rb