Class: Bio::Big::FrameCodonHelpers::FrameCodonSequence
- Inherits:
-
Object
- Object
- Bio::Big::FrameCodonHelpers::FrameCodonSequence
show all
- Includes:
- TrackSequenceTrait, Enumerable
- Defined in:
- lib/bigbio/db/emitters/orf_emitter.rb
Instance Attribute Summary collapse
#track_ntseq_pos
Instance Method Summary
collapse
update_reversed_sequence_pos, update_sequence_pos
Constructor Details
Returns a new instance of FrameCodonSequence.
76
77
78
79
80
81
82
83
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 76
def initialize seq, pos=0
if seq.kind_of?(String)
@codons = seq.upcase.scan(/(\w\w\w)/).flatten
else
@codons = seq
end
@pos = pos
end
|
Instance Attribute Details
#codons ⇒ Object
Returns the value of attribute codons.
75
76
77
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 75
def codons
@codons
end
|
#pos ⇒ Object
codon position in short parent sequence
74
75
76
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 74
def pos
@pos
end
|
Instance Method Details
#[](index) ⇒ Object
90
91
92
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 90
def [] index
@codons[index]
end
|
#each ⇒ Object
101
102
103
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 101
def each
@codons.each { | c| yield c }
end
|
#rpos ⇒ Object
87
88
89
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 87
def rpos
pos + size
end
|
#shift ⇒ Object
93
94
95
96
97
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 93
def shift
list = @codons
list.shift
FrameCodonSequence.new(list,@pos+1)
end
|
#size ⇒ Object
84
85
86
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 84
def size
@codons.size
end
|
#to_seq ⇒ Object
98
99
100
|
# File 'lib/bigbio/db/emitters/orf_emitter.rb', line 98
def to_seq
@codons.join
end
|