Class: PluginRemAditArtifacts
- Defined in:
- lib/seqtrimnext/plugins_old/plugin_rem_adit_artifacts.rb
Overview
Inherit: Plugin
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, blast_query) ⇒ Object
-
#execute_old(seq) ⇒ Object
———————————————————————.
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
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/seqtrimnext/plugins_old/plugin_rem_adit_artifacts.rb', line 211 def self.check_params(params) errors=[] # if !params.exists?('ta') # errors.push " The param <ta> doesn't exist" # end # if !params.exists?('poly_at_length') # errors.push " The param <poly_at_length> doesn't exist" # end return errors end |
Instance Method Details
#exec_seq(seq, blast_query) ⇒ Object
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 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/seqtrimnext/plugins_old/plugin_rem_adit_artifacts.rb', line 17 def exec_seq(seq,blast_query) $LOG.debug "[#{self.class.to_s}, seq: #{seq.seq_name}]: removing artifacts into the sequence" seq2 = seq.seq_fasta first = 0 last = seq2.size-1 old_first=first old_last=last while (seq2 =~ /^(GCGGGG|CCCCGC)/i) first += 6 seq2.slice!(0..5) end while (seq2 =~ /(GCGGGG|CCCCGC)$/i) last -= 6 seq2.slice!(seq2.size-1-5..seq2.size-1) end #is_forward, is_cDNA, #TrimExtremeNXs(first,last) is_forward = @params.get_param('is_forward')=='true' is_cDNA = @params.get_param('is_cDNA')=='true' previous_first,previous_last =0,0 until ((previous_first == first) && (previous_last == last)) previous_first,previous_last = first, last if (is_cDNA) if (is_forward) nTs = 0 nTs = $1.length if (seq2 =~ /^(T+)/i) if (nTs > 3) seq2.slice!(0..nTs -1) first += nTs #-1 end nAs = 0 nAs = $1.length if (seq2 =~ /(A+)$/i) if (nAs > 3) seq2.slice!(seq2.size - nAs..seq2.size - 1) last -= nAs end else #si es backward nTs = 0 nTs = $1.length if (seq2 =~ /(T+)$/i) if (nTs > 3) seq2.slice!(seq2.size-nTs..seq2.size-1) last -= nTs end nAs = 0 nAs = $1.length if (seq2 =~ /^(A+)/i) if (nAs > 3) seq2.slice!(0..nAs -1) first += nAs end end end end if (((first>=0) && (first>old_first)) || ((last>=0) && (last<old_last))) type='ActionRemAditArtifacts' actions = [] # seq.add_action(first,last,type) a=seq.new_action(first,last,type) actions.push a seq.add_actions(actions) end end |
#execute_old(seq) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/seqtrimnext/plugins_old/plugin_rem_adit_artifacts.rb', line 107 def execute_old(seq) seq2 = seq.seq_fasta #seq2 = 'dGCGGGG' first = 0 last = seq2.size-1 old_first=first old_last=last # puts '1 '+seq2 # puts 'POS '+first.to_s # puts 'POS '+last.to_s while (seq2 =~ /^(GCGGGG|CCCCGC)/i) first += 6 seq2.slice!(0..5) # puts '2 '+seq2 # already = true end while (seq2 =~ /(GCGGGG|CCCCGC)$/i) last -= 6 seq2.slice!(seq2.size-1-5..seq2.size-1) # puts '3 '+seq2 # already = true end #is_forward, is_cDNA, #TrimExtremeNXs(first,last) is_forward = @params.get_param('is_forward') is_cDNA = @params.get_param('is_cDNA') # puts '4 '+seq2 previous_first,previous_last =0,0 until ((previous_first == first) && (previous_last == last)) previous_first,previous_last = first, last # puts 'POS5-F '+first.to_s # puts 'POS5-L '+last.to_s if (is_cDNA) if (is_forward) # puts '5 '+seq2 nTs = 0 nTs = $1.length if (seq2 =~ /^(T+)/i) if (nTs > 3) seq2.slice!(0..nTs -1) # puts '6 '+seq2 first += nTs #-1 # puts 'POS6-F '+first.to_s end nAs = 0 nAs = $1.length if (seq2 =~ /(A+)$/i) # puts '6-7 '+seq2 + nAs.to_s if (nAs > 3) # puts '7 '+seq2 seq2.slice!(seq2.size - nAs..seq2.size - 1) last -= nAs#seq2.size-nAs-2 # puts 'POS7-L '+last.to_s end else #si es backward # puts '5b '+seq2 nTs = 0 nTs = $1.length if (seq2 =~ /(T+)$/i) if (nTs > 3) # puts '6b '+seq2 seq2.slice!(seq2.size-nTs..seq2.size-1) last -= nTs#seq2.size-nTs -2 # puts 'POS6b-L '+last.to_s end nAs = 0 nAs = $1.length if (seq2 =~ /^(A+)/i) if (nAs > 3) # puts '7b '+seq2 seq2.slice!(0..nAs -1) first += nAs#nAs -1 # puts 'POS7b-f '+first.to_s end end end end #first -= 1 if (old_first!= first) #last += 1 if (old_last!= last) # puts 'POS7-8 '+first.to_s # puts 'POS7-8 '+last.to_s if (((first>=0) && (first>old_first)) || ((last>=0) && (last<old_last))) type='ActionRemAditArtifacts' # puts '8 '+seq2 seq.add_action(first,last,type) end # puts '9 '+seq2 end |