Class: BioDSL::ComplementSeq

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

Overview

Complment sequences in the stream.

complement_seq complements sequences in the stream. The sequence type - DNA or RNA - is guessed by inspected the first sequence in the stream.

complement_seq can be used together with reverse_seq to reverse- complement sequences.

Usage

complement_seq()

Options

Examples

Consider the following FASTQ entry in the file test.fq:

@M02529:88:000000000-AC0WY:1:1101:12879:1928 2:N:0:185
TTGTAAAACGACGGCCAGTG
+
>>>>>FFFFD@A?A0AE0FG

To complement the sequence do:

BD.new.read_fastq(input:"test.fq").complement_seq.dump.run

{:SEQ_NAME=>"M02529:88:000000000-AC0WY:1:1101:12879:1928 2:N:0:185",
 :SEQ=>"AACATTTTGCTGCCGGTCAC",
 :SEQ_LEN=>20,
 :SCORES=>">>>>>FFFFD@A?A0AE0FG"}

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ComplementSeq

Constructor for ComplementSeq.

Parameters:

  • options (Hash)

    Options hash.



67
68
69
70
71
72
# File 'lib/BioDSL/commands/complement_seq.rb', line 67

def initialize(options)
  @options = options
  @type    = nil

  check_options
end

Instance Method Details

#lmbProc

Return the command lambda for ComplementSeq.

Returns:

  • (Proc)

    Command lambda



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/BioDSL/commands/complement_seq.rb', line 77

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

    input.each do |record|
      @status[:records_in] += 1

      complement(record) if record.key? :SEQ

      output << record

      @status[:records_out] += 1
    end
  end
end