Class: BioDSL::CollectOtus

Inherits:
Object
  • Object
show all
Defined in:
lib/BioDSL/commands/collect_otus.rb

Overview

Collect OTU data from records in the stream.

collect_otus count the number of times each OTU is found in a set of samples. OTUs are given by the :S_ID key and samples by the :SAMPLE key. If a :SEQ_COUNT key is present it will be used to increment the OTU count, allowing for dereplicated sequences to be used.

Usage

collect_otus()

Options

Examples

Constant Summary collapse

STATS =
%i(records_in records_out hits_in hits_out)

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CollectOtus

Constructor for CollectOtus.

Parameters:

  • options (Hash)

    Options hash.



52
53
54
55
56
# File 'lib/BioDSL/commands/collect_otus.rb', line 52

def initialize(options)
  @options = options

  check_options
end

Instance Method Details

#lmbProc

Return lambda for CollectOtus command.

Returns:

  • (Proc)

    Command lambda.



61
62
63
64
65
66
67
68
69
# File 'lib/BioDSL/commands/collect_otus.rb', line 61

def lmb
  lambda do |input, output, status|
    status_init(status, STATS)

    count_hash = process_input(input, output)
    samples    = collect_samples(count_hash)
    process_output(count_hash, samples, output)
  end
end