Class: BioDSL::UchimeRef

Inherits:
Object
  • Object
show all
Includes:
AuxHelper
Defined in:
lib/BioDSL/commands/uchime_ref.rb

Overview

Run uchime_ref on sequences in the stream.

This is a wrapper for the usearch tool to run the program uchime_ref. Basically sequence type records are searched against a reference database or non-chimeric sequences, and chimirec sequences are filtered out so only non-chimeric sequences are output.

Please refer to the manual:

drive5.com/usearch/manual/uchime_ref.html

Usearch 7.0 must be installed for usearch to work. Read more here:

www.drive5.com/usearch/

Usage

uchime_ref(<database: <file>[cpus: <uint>])

Options

  • database: <file> - Database to search (in FASTA format).

  • cpus: <uint> - Number of CPU cores to use (default=1).

Examples

Constant Summary

STATS =
%i(records_in records_out sequences_in sequences_out residues_in
residues_out)

Instance Method Summary collapse

Methods included from AuxHelper

#aux_exist

Constructor Details

#initialize(options) ⇒ UchimeRef

Constructor for UchimeRef.

Parameters:

  • options (Hash)

    Options hash.

Options Hash (options):

  • :database (String)
  • :cpus (Integer)


70
71
72
73
74
75
76
# File 'lib/BioDSL/commands/uchime_ref.rb', line 70

def initialize(options)
  @options = options
  aux_exist('usearch')
  check_options
  @options[:cpus] ||= 1
  @options[:strand] ||= 'plus' # This option cant be changed in usearch7.0
end

Instance Method Details

#lmbProc

Return command lambda for uchime_ref.

Returns:

  • (Proc)

    Command lambda.



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/BioDSL/commands/uchime_ref.rb', line 81

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

    TmpDir.create('input', 'output') do |tmp_in, tmp_out|
      process_input(input, output, tmp_in)
      run_uchime_ref(tmp_in, tmp_out)

      process_output(output, tmp_out)
    end
  end
end