Class: Bio::BioAlignment::Sequence

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bio-alignment/sequence.rb

Overview

A Sequence is a simple container for String sequences/lists

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



22
23
24
# File 'lib/bio-alignment/sequence.rb', line 22

def id
  @id
end

#seqObject (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

#eachObject



32
33
34
# File 'lib/bio-alignment/sequence.rb', line 32

def each
  @seq.each_char { | c | yield Element.new(c) }
end

#to_sObject



36
37
38
# File 'lib/bio-alignment/sequence.rb', line 36

def to_s
  @seq.to_s
end