class SeqtrimAction
Attributes
cut[RW]
end_pos[RW]
found_definition[RW]
informative[RW]
left_action[RW]
message[RW]
reversed[RW]
right_action[RW]
start_pos[RW]
tag_id[RW]
Public Class Methods
new(start_pos,end_pos)
click to toggle source
Creates the nexts values from an action: start_position, end_position, type
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 16 def initialize(start_pos,end_pos) # puts " #{start_pos} #{end_pos} #{self.class.to_s}" @start_pos = start_pos.to_i @end_pos = end_pos.to_i #@notes = '' @left_action = false @right_action = false @message = '' @found_definition=[] #array when contaminant or vectors definitions are saved, each separately @cut = false @informative = false @reversed = false # puts " #{@start_pos} #{@end_pos} #{self.class.to_s}" @tag_id ='' end
Public Instance Methods
action_type()
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 78 def action_type a_type='INFO' if !@informative a_type = 'LEFT' if right_action a_type = 'RIGHT' end end return a_type end
apply_decoration(char)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 61 def apply_decoration(char) return char end
apply_to(seq)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 35 def apply_to(seq) $LOG.debug " Applying #{self.class} to seq #{seq.seq_name} . BEGIN: #{@start_pos} END: #{@end_pos} " end
contains?(pos)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 51 def contains?(pos) return ((pos>=@start_pos) && (pos<=@end_pos)) end
contains_action?(start_pos,end_pos,margin=10)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 56 def contains_action?(start_pos,end_pos,margin=10) #puts "#{start_pos}>=#{@start_pos-margin} && #{end_pos}<=#{@end_pos+margin} " return ((start_pos>=@start_pos-margin) && (end_pos<=@end_pos+margin)) end
decorate(char,pos)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 67 def decorate(char,pos) if contains?(pos) return apply_decoration(char) else return char end end
description()
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 41 def description return "Action Type: #{self.class} Begin: #{start_pos} End: #{end_pos}" end
inspect()
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 46 def inspect description end
left_action?(seq_fasta_size)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 111 def left_action?(seq_fasta_size) res = (@left_action || (!@right_action && near_left?(seq_fasta_size))) # @left_action = res return res end
near_left?(seq_fasta_size)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 106 def near_left?(seq_fasta_size) return ((@start_pos - 0 ) < (seq_fasta_size - @end_pos)) end
right_action?(seq_fasta_size)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 118 def right_action?(seq_fasta_size) res= (@right_action || !left_action?(seq_fasta_size)) # @right_action = res return res end
title()
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 102 def title return to_human(type.gsub('Action','')) end
to_hash()
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 124 def to_hash a = {} a[:type]=type a[:start_pos]=@start_pos a[:end_pos]=@end_pos a[:message]=@message return a end
to_human(camel_cased_word)
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 91 def to_human(camel_cased_word) word = camel_cased_word.to_s.dup word.gsub!(/::/, '/') word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1 \2') word.gsub!(/([a-z\d])([A-Z])/,'\1 \2') word.tr!("-", " ") word.downcase! word.capitalize! word end
type()
click to toggle source
# File lib/seqtrimnext/actions/seqtrim_action.rb, line 75 def type return self.class.to_s end