Class: Assemblotron::Sample

Inherits:
Object
  • Object
show all
Defined in:
lib/assemblotron/sample.rb

Instance Method Summary collapse

Constructor Details

#initialize(left, right) ⇒ Sample

Return a new Sample with left and right reads



8
9
10
11
# File 'lib/assemblotron/sample.rb', line 8

def initialize(left, right)
  @left = left
  @right = right
end

Instance Method Details

#subsample(n, seed = 1337) ⇒ Object

Take a uniform random subsample of n reads from each of the input FASTQ files @left and @right using reservoir sampling. Return an array of length 2, containing the paths to the left and right subsampled read files.



134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/assemblotron/sample.rb', line 134

def subsample(n, seed = 1337)
  ldir = File.dirname(@left)
  loutfile = File.join(ldir, "subset.#{File.basename @left}")

  rdir = File.dirname(@right)
  routfile = File.join(rdir, "subset.#{File.basename @right}")

  subsampleC(n, seed, @left, @right, loutfile, routfile)

  puts "Subsampled #{n} reads. Sampled read files:\n#{loutfile}\n#{routfile}"

  [loutfile, routfile]
end