Class: BioDSL::ReverseSeq
- Inherits:
-
Object
- Object
- BioDSL::ReverseSeq
- Defined in:
- lib/BioDSL/commands/reverse_seq.rb
Overview
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>>>>>"}
Constant Summary collapse
- STATS =
%i(records_in records_out sequences_in sequences_out residues_in residues_out)
Instance Method Summary collapse
-
#initialize(options) ⇒ ReverseSeq
constructor
Constructor for ReverseSeq.
-
#lmb ⇒ Proc
Return command lambda for reverse_seq.
Constructor Details
#initialize(options) ⇒ ReverseSeq
Constructor for ReverseSeq.
69 70 71 72 73 |
# File 'lib/BioDSL/commands/reverse_seq.rb', line 69 def initialize() @options = end |
Instance Method Details
#lmb ⇒ Proc
Return command lambda for reverse_seq.
78 79 80 81 82 83 84 85 86 87 88 89 |
# 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 |