Class: PluginIgnoreRepeated
- Defined in:
- lib/seqtrimnext/plugins/plugin_ignore_repeated.rb
Constant Summary collapse
- SIZE_SEARCH_IN_IGNORE =
15
Instance Attribute Summary
Attributes inherited from Plugin
Class Method Summary collapse
-
.check_params(params) ⇒ Object
Returns an array with the errors due to parameters are missing.
Instance Method Summary collapse
- #exec_seq(seq) ⇒ Object
-
#execute(seqs) ⇒ Object
Begins the plugin1’s execution to warn that there are repeated sequences, and disables all but one“.
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
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/seqtrimnext/plugins/plugin_ignore_repeated.rb', line 89 def self.check_params(params) errors=[] # self.check_param(errors,params,'fasta_file_input','String') self.check_param(errors,params,'blast_evalue_ignore_repeated','Float') self.check_param(errors,params,'blast_percent_ignore_repeated','Integer') self.check_param(errors,params,'piro_repeated_start','Integer') self.check_param(errors,params,'piro_repeated_length','Integer') return errors end |
Instance Method Details
#exec_seq(seq) ⇒ Object
23 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/seqtrimnext/plugins/plugin_ignore_repeated.rb', line 23 def exec_seq(seq) $LOG.info "[#{self.class.to_s}, seq: #{seq.seq_name}]: searching sequence repeated at input file" fasta_input=@params.get_param('truncated_input_file') blast = BatchBlast.new("-db #{fasta_input}" ,'blastn'," -task blastn-short -searchsp #{SIZE_SEARCH_IN_IGNORE} -evalue #{@params.get_param('blast_evalue_ignore_repeated')} -perc_identity #{@params.get_param('blast_percent_ignore_repeated')}") #get contaminants p_start = @params.get_param('piro_repeated_start').to_i p_length = @params.get_param('piro_repeated_length').to_i blast_table_results = blast.do_blast(seq.seq_fasta[p_start,p_length]) #rise seq to contaminants executing over blast #blast_table_results = BlastTableResult.new(res) type = "ActionIgnoreRepeated" # @stats[:rejected_seqs]={} actions=[] blast_table_results.querys.each do |query| # puts "BLAST IGUALES:" # puts res.join("\n") if query.size>1 names = query.hits.collect{ |h| if h.align_len > (p_length-2) h.subject_id end } names.compact! # puts "IGUALES:" + names.size.to_s # puts names.join(',') if !names.empty? names.sort! if (names[0] != seq.seq_name) # Add action when the sequence is repeated # if true a = seq.new_action(0,0,type) a. = seq.seq_name + ' equal to ' + names[0] actions.push a seq.seq_rejected=true seq.='repeated' seq.seq_repeated=true # @stats[:rejected_seqs]={'rejected_seqs_by_repe' => 1} add_stats('rejected_seqs','rejected_seqs_by_repe') # puts "#{names[0]} != #{seq.seq_name} >>>>>>" end end end end seq.add_actions(actions) end |
#execute(seqs) ⇒ Object
Begins the plugin1’s execution to warn that there are repeated sequences, and disables all but one“
16 17 18 19 20 |
# File 'lib/seqtrimnext/plugins/plugin_ignore_repeated.rb', line 16 def execute(seqs) seqs.each do |s| exec_seq(s) end end |