Class: Bio::BioAlignment::Sequence
- Inherits:
-
Object
- Object
- Bio::BioAlignment::Sequence
- Includes:
- Enumerable
- Defined in:
- lib/bio-alignment/sequence.rb
Overview
A Sequence is a simple container for String sequences/lists
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each ⇒ Object
-
#initialize(id, seq) ⇒ Sequence
constructor
A new instance of Sequence.
- #to_s ⇒ Object
Constructor Details
#initialize(id, seq) ⇒ Sequence
Returns a new instance of Sequence.
23 24 25 26 |
# File 'lib/bio-alignment/sequence.rb', line 23 def initialize id, seq @id = id @seq = seq end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
22 23 24 |
# File 'lib/bio-alignment/sequence.rb', line 22 def id @id end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
22 23 24 |
# File 'lib/bio-alignment/sequence.rb', line 22 def seq @seq end |
Instance Method Details
#[](index) ⇒ Object
28 29 30 |
# File 'lib/bio-alignment/sequence.rb', line 28 def [] index @seq[index] end |
#each ⇒ Object
32 33 34 |
# File 'lib/bio-alignment/sequence.rb', line 32 def each @seq.each_char { | c | yield Element.new(c) } end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/bio-alignment/sequence.rb', line 36 def to_s @seq.to_s end |