class BioDSL::ReverseSeq
Reverse sequences in the stream.¶ ↑
reverse_seq
reverses sequences in the stream. If a SCORES key is found then the SCORES are also reversed.
reverse_seq
can be used together with complment_seq
to reverse- complement sequences.
Usage¶ ↑
reverse_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 reverse the sequence simply do:
BD.new.read_fastq(input:"test.fq").reverse_seq.dump.run {:SEQ_NAME=>"M02529:88:000000000-AC0WY:1:1101:12879:1928 2:N:0:185", :SEQ=>"GTGACCGGCAGCAAAATGTT", :SEQ_LEN=>20, :SCORES=>"GF0EA0A?A@DFFFF>>>>>"}
Constants
- STATS
Public Class Methods
new(options)
click to toggle source
Constructor for ReverseSeq
.
@param options [Hash] Options hash.
@return [ReverseSeq] Class instance.
# File lib/BioDSL/commands/reverse_seq.rb, line 69 def initialize(options) @options = options check_options end
Public Instance Methods
lmb()
click to toggle source
Return command lambda for reverse_seq.
@return [Proc] Command
lambda.
# File lib/BioDSL/commands/reverse_seq.rb, line 78 def lmb lambda do |input, output, status| status_init(status, STATS) input.each do |record| @status[:records_in] += 1 reverse(record) if record[:SEQ] output << record @status[:records_out] += 1 end end end
Private Instance Methods
check_options()
click to toggle source
Check options.
# File lib/BioDSL/commands/reverse_seq.rb, line 94 def check_options options_allowed(@options, nil) end
reverse(record)
click to toggle source
Reverse sequence.
@param record [Hash] BioDSL
record.
# File lib/BioDSL/commands/reverse_seq.rb, line 101 def reverse(record) entry = BioDSL::Seq.new_bp(record) entry.reverse! @status[:sequences_in] += 1 @status[:sequences_out] += 1 @status[:residues_in] += entry.length @status[:residues_out] += entry.length record.merge! entry.to_bp end