Class: OligoEnumerator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/oligo_enumerator.rb

Overview

Class OligoEnumerator provides a simple means of generating unique tag sequences for testing and development

Author:

  • Genome Research Ltd.

Instance Method Summary collapse

Constructor Details

#initialize(size, initial = 0) ⇒ OligoEnumerator

Generate an oligo enumerator

Parameters:

  • size (Integer)

    The number of tags to generate



16
17
18
19
# File 'lib/oligo_enumerator.rb', line 16

def initialize(size, initial = 0)
  @size = size
  @initial = initial
end

Instance Method Details

#eachObject



25
26
27
# File 'lib/oligo_enumerator.rb', line 25

def each
  @size.times { |i| yield tag(i + @initial) }
end

#lastObject



21
22
23
# File 'lib/oligo_enumerator.rb', line 21

def last
  tag(@size)
end

#tag(i) ⇒ Object



29
30
31
# File 'lib/oligo_enumerator.rb', line 29

def tag(i)
  i.to_s(4).tr('0123', 'ATCG')
end