Module: ViralSeq::PID

Defined in:
lib/viral_seq/pid.rb

Class Method Summary collapse

Class Method Details

.generate_pool(l = 8) ⇒ Object

generate all Primer ID combinations given the length of Primer ID

Examples:

generate a pool of Primer IDs with length of 10

primer_id_pool = ViralSeq::PID.generate_pool(10) # 10 is the length of Primer ID
puts primer_id_pool.size  #should be 4^10
=> 1048576

Parameters:

  • l (Integer) (defaults to: 8)

    the length of the Primer ID.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/viral_seq/pid.rb', line 13

def self.generate_pool(l=8)
  nt = ['A','T','C','G']
  pid_pool = ['A','T','C','G']
  (l-1).times do
    pid_pool = pid_pool.product(nt)
    pid_pool.collect! do |v|
      v.join("")
    end
  end
  return pid_pool
end