Class: Assemblotron::Sample
- Inherits:
-
Object
- Object
- Assemblotron::Sample
- Defined in:
- lib/assemblotron/sample.rb
Instance Method Summary collapse
-
#initialize(left, right) ⇒ Sample
constructor
Return a new Sample with left and right reads.
-
#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.
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 |