Class: SeqtrimAction
- Inherits:
-
Object
show all
- Defined in:
- lib/seqtrimnext/actions/seqtrim_action.rb
Direct Known Subclasses
ActionAbAdapter, ActionAbFarAdapter, ActionAbLeftAdapter, ActionEmptyInsert, ActionIgnoreRepeated, ActionIndetermination, ActionInducedLowComplexity, ActionInsert, ActionIsContaminated, ActionKey, ActionLeftAdapter, ActionLeftPrimer, ActionLinker, ActionLowComplexity, ActionLowHighSize, ActionLowQuality, ActionMid, ActionMiddleAdapter, ActionMultipleLinker, ActionPairedReads, ActionPolyA, ActionPolyT, ActionRemAditArtifacts, ActionRightAdapter, ActionRightPrimer, ActionSangerLeftAdapter, ActionSangerRightAdapter, ActionShortInsert, ActionTrim, ActionUnexpectedPolyT, ActionUnexpectedVector, ActionUserContaminant, ActionVectors
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(start_pos, end_pos) ⇒ SeqtrimAction
Creates the nexts values from an action: start_position, end_position, type
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 16
def initialize(start_pos,end_pos)
@start_pos = start_pos.to_i
@end_pos = end_pos.to_i
@left_action = false
@right_action = false
@message = ''
@found_definition=[] @cut = false
@informative = false
@reversed = false
@tag_id =''
end
|
Instance Attribute Details
#cut ⇒ Object
Returns the value of attribute cut.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def cut
@cut
end
|
#end_pos ⇒ Object
Returns the value of attribute end_pos.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def end_pos
@end_pos
end
|
#found_definition ⇒ Object
Returns the value of attribute found_definition.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def found_definition
@found_definition
end
|
Returns the value of attribute informative.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def informative
@informative
end
|
#left_action ⇒ Object
Returns the value of attribute left_action.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def left_action
@left_action
end
|
#message ⇒ Object
Returns the value of attribute message.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def message
@message
end
|
#reversed ⇒ Object
Returns the value of attribute reversed.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def reversed
@reversed
end
|
#right_action ⇒ Object
Returns the value of attribute right_action.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def right_action
@right_action
end
|
#start_pos ⇒ Object
Returns the value of attribute start_pos.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def start_pos
@start_pos
end
|
#tag_id ⇒ Object
Returns the value of attribute tag_id.
13
14
15
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 13
def tag_id
@tag_id
end
|
Instance Method Details
#action_type ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
|
# 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) ⇒ Object
61
62
63
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 61
def apply_decoration(char)
return char
end
|
#apply_to(seq) ⇒ Object
35
36
37
38
39
|
# 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) ⇒ Boolean
51
52
53
|
# 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) ⇒ Boolean
56
57
58
59
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 56
def contains_action?(start_pos,end_pos,margin=10)
return ((start_pos>=@start_pos-margin) && (end_pos<=@end_pos+margin))
end
|
#decorate(char, pos) ⇒ Object
67
68
69
70
71
72
73
|
# 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 ⇒ Object
41
42
43
44
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 41
def description
return "Action Type: #{self.class} Begin: #{start_pos} End: #{end_pos}"
end
|
#inspect ⇒ Object
46
47
48
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 46
def inspect
description
end
|
#left_action?(seq_fasta_size) ⇒ Boolean
111
112
113
114
115
116
|
# 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)))
return res
end
|
#near_left?(seq_fasta_size) ⇒ Boolean
106
107
108
|
# 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) ⇒ Boolean
118
119
120
121
122
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 118
def right_action?(seq_fasta_size)
res= (@right_action || !left_action?(seq_fasta_size))
return res
end
|
#title ⇒ Object
102
103
104
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 102
def title
return to_human(type.gsub('Action',''))
end
|
#to_hash ⇒ Object
124
125
126
127
128
129
130
131
132
133
|
# 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) ⇒ Object
91
92
93
94
95
96
97
98
99
100
|
# 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 ⇒ Object
75
76
77
|
# File 'lib/seqtrimnext/actions/seqtrim_action.rb', line 75
def type
return self.class.to_s
end
|