BioDSL 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/BioDSL.gemspec +64 -0
- data/LICENSE +339 -0
- data/README.md +205 -0
- data/Rakefile +94 -0
- data/examples/fastq_to_fasta.rb +8 -0
- data/lib/BioDSL/cary.rb +242 -0
- data/lib/BioDSL/command.rb +133 -0
- data/lib/BioDSL/commands/add_key.rb +110 -0
- data/lib/BioDSL/commands/align_seq_mothur.rb +194 -0
- data/lib/BioDSL/commands/analyze_residue_distribution.rb +222 -0
- data/lib/BioDSL/commands/assemble_pairs.rb +336 -0
- data/lib/BioDSL/commands/assemble_seq_idba.rb +230 -0
- data/lib/BioDSL/commands/assemble_seq_ray.rb +345 -0
- data/lib/BioDSL/commands/assemble_seq_spades.rb +252 -0
- data/lib/BioDSL/commands/classify_seq.rb +217 -0
- data/lib/BioDSL/commands/classify_seq_mothur.rb +226 -0
- data/lib/BioDSL/commands/clip_primer.rb +318 -0
- data/lib/BioDSL/commands/cluster_otus.rb +181 -0
- data/lib/BioDSL/commands/collapse_otus.rb +170 -0
- data/lib/BioDSL/commands/collect_otus.rb +150 -0
- data/lib/BioDSL/commands/complement_seq.rb +117 -0
- data/lib/BioDSL/commands/count.rb +135 -0
- data/lib/BioDSL/commands/count_values.rb +149 -0
- data/lib/BioDSL/commands/degap_seq.rb +253 -0
- data/lib/BioDSL/commands/dereplicate_seq.rb +168 -0
- data/lib/BioDSL/commands/dump.rb +157 -0
- data/lib/BioDSL/commands/filter_rrna.rb +239 -0
- data/lib/BioDSL/commands/genecall.rb +237 -0
- data/lib/BioDSL/commands/grab.rb +535 -0
- data/lib/BioDSL/commands/index_taxonomy.rb +226 -0
- data/lib/BioDSL/commands/mask_seq.rb +175 -0
- data/lib/BioDSL/commands/mean_scores.rb +168 -0
- data/lib/BioDSL/commands/merge_pair_seq.rb +175 -0
- data/lib/BioDSL/commands/merge_table.rb +225 -0
- data/lib/BioDSL/commands/merge_values.rb +113 -0
- data/lib/BioDSL/commands/plot_heatmap.rb +233 -0
- data/lib/BioDSL/commands/plot_histogram.rb +306 -0
- data/lib/BioDSL/commands/plot_matches.rb +282 -0
- data/lib/BioDSL/commands/plot_residue_distribution.rb +278 -0
- data/lib/BioDSL/commands/plot_scores.rb +285 -0
- data/lib/BioDSL/commands/random.rb +153 -0
- data/lib/BioDSL/commands/read_fasta.rb +222 -0
- data/lib/BioDSL/commands/read_fastq.rb +414 -0
- data/lib/BioDSL/commands/read_table.rb +329 -0
- data/lib/BioDSL/commands/reverse_seq.rb +113 -0
- data/lib/BioDSL/commands/slice_align.rb +400 -0
- data/lib/BioDSL/commands/slice_seq.rb +151 -0
- data/lib/BioDSL/commands/sort.rb +223 -0
- data/lib/BioDSL/commands/split_pair_seq.rb +220 -0
- data/lib/BioDSL/commands/split_values.rb +165 -0
- data/lib/BioDSL/commands/trim_primer.rb +314 -0
- data/lib/BioDSL/commands/trim_seq.rb +192 -0
- data/lib/BioDSL/commands/uchime_ref.rb +170 -0
- data/lib/BioDSL/commands/uclust.rb +286 -0
- data/lib/BioDSL/commands/unique_values.rb +145 -0
- data/lib/BioDSL/commands/usearch_global.rb +171 -0
- data/lib/BioDSL/commands/usearch_local.rb +171 -0
- data/lib/BioDSL/commands/write_fasta.rb +207 -0
- data/lib/BioDSL/commands/write_fastq.rb +191 -0
- data/lib/BioDSL/commands/write_table.rb +419 -0
- data/lib/BioDSL/commands/write_tree.rb +167 -0
- data/lib/BioDSL/commands.rb +31 -0
- data/lib/BioDSL/config.rb +55 -0
- data/lib/BioDSL/csv.rb +307 -0
- data/lib/BioDSL/debug.rb +42 -0
- data/lib/BioDSL/fasta.rb +133 -0
- data/lib/BioDSL/fastq.rb +77 -0
- data/lib/BioDSL/filesys.rb +137 -0
- data/lib/BioDSL/fork.rb +145 -0
- data/lib/BioDSL/hamming.rb +128 -0
- data/lib/BioDSL/helpers/aux_helper.rb +44 -0
- data/lib/BioDSL/helpers/email_helper.rb +66 -0
- data/lib/BioDSL/helpers/history_helper.rb +40 -0
- data/lib/BioDSL/helpers/log_helper.rb +55 -0
- data/lib/BioDSL/helpers/options_helper.rb +405 -0
- data/lib/BioDSL/helpers/status_helper.rb +132 -0
- data/lib/BioDSL/helpers.rb +35 -0
- data/lib/BioDSL/html_report.rb +200 -0
- data/lib/BioDSL/math.rb +55 -0
- data/lib/BioDSL/mummer.rb +216 -0
- data/lib/BioDSL/pipeline.rb +354 -0
- data/lib/BioDSL/seq/ambiguity.rb +66 -0
- data/lib/BioDSL/seq/assemble.rb +240 -0
- data/lib/BioDSL/seq/backtrack.rb +252 -0
- data/lib/BioDSL/seq/digest.rb +99 -0
- data/lib/BioDSL/seq/dynamic.rb +263 -0
- data/lib/BioDSL/seq/homopolymer.rb +59 -0
- data/lib/BioDSL/seq/kmer.rb +293 -0
- data/lib/BioDSL/seq/levenshtein.rb +113 -0
- data/lib/BioDSL/seq/translate.rb +109 -0
- data/lib/BioDSL/seq/trim.rb +188 -0
- data/lib/BioDSL/seq.rb +742 -0
- data/lib/BioDSL/serializer.rb +98 -0
- data/lib/BioDSL/stream.rb +113 -0
- data/lib/BioDSL/taxonomy.rb +691 -0
- data/lib/BioDSL/test.rb +42 -0
- data/lib/BioDSL/tmp_dir.rb +68 -0
- data/lib/BioDSL/usearch.rb +301 -0
- data/lib/BioDSL/verbose.rb +42 -0
- data/lib/BioDSL/version.rb +31 -0
- data/lib/BioDSL.rb +81 -0
- data/test/BioDSL/commands/test_add_key.rb +105 -0
- data/test/BioDSL/commands/test_align_seq_mothur.rb +99 -0
- data/test/BioDSL/commands/test_analyze_residue_distribution.rb +134 -0
- data/test/BioDSL/commands/test_assemble_pairs.rb +459 -0
- data/test/BioDSL/commands/test_assemble_seq_idba.rb +50 -0
- data/test/BioDSL/commands/test_assemble_seq_ray.rb +51 -0
- data/test/BioDSL/commands/test_assemble_seq_spades.rb +50 -0
- data/test/BioDSL/commands/test_classify_seq.rb +50 -0
- data/test/BioDSL/commands/test_classify_seq_mothur.rb +59 -0
- data/test/BioDSL/commands/test_clip_primer.rb +377 -0
- data/test/BioDSL/commands/test_cluster_otus.rb +128 -0
- data/test/BioDSL/commands/test_collapse_otus.rb +81 -0
- data/test/BioDSL/commands/test_collect_otus.rb +82 -0
- data/test/BioDSL/commands/test_complement_seq.rb +78 -0
- data/test/BioDSL/commands/test_count.rb +103 -0
- data/test/BioDSL/commands/test_count_values.rb +85 -0
- data/test/BioDSL/commands/test_degap_seq.rb +96 -0
- data/test/BioDSL/commands/test_dereplicate_seq.rb +92 -0
- data/test/BioDSL/commands/test_dump.rb +109 -0
- data/test/BioDSL/commands/test_filter_rrna.rb +128 -0
- data/test/BioDSL/commands/test_genecall.rb +50 -0
- data/test/BioDSL/commands/test_grab.rb +398 -0
- data/test/BioDSL/commands/test_index_taxonomy.rb +62 -0
- data/test/BioDSL/commands/test_mask_seq.rb +98 -0
- data/test/BioDSL/commands/test_mean_scores.rb +111 -0
- data/test/BioDSL/commands/test_merge_pair_seq.rb +115 -0
- data/test/BioDSL/commands/test_merge_table.rb +131 -0
- data/test/BioDSL/commands/test_merge_values.rb +83 -0
- data/test/BioDSL/commands/test_plot_heatmap.rb +185 -0
- data/test/BioDSL/commands/test_plot_histogram.rb +194 -0
- data/test/BioDSL/commands/test_plot_matches.rb +157 -0
- data/test/BioDSL/commands/test_plot_residue_distribution.rb +309 -0
- data/test/BioDSL/commands/test_plot_scores.rb +308 -0
- data/test/BioDSL/commands/test_random.rb +88 -0
- data/test/BioDSL/commands/test_read_fasta.rb +229 -0
- data/test/BioDSL/commands/test_read_fastq.rb +552 -0
- data/test/BioDSL/commands/test_read_table.rb +327 -0
- data/test/BioDSL/commands/test_reverse_seq.rb +79 -0
- data/test/BioDSL/commands/test_slice_align.rb +218 -0
- data/test/BioDSL/commands/test_slice_seq.rb +131 -0
- data/test/BioDSL/commands/test_sort.rb +128 -0
- data/test/BioDSL/commands/test_split_pair_seq.rb +164 -0
- data/test/BioDSL/commands/test_split_values.rb +95 -0
- data/test/BioDSL/commands/test_trim_primer.rb +329 -0
- data/test/BioDSL/commands/test_trim_seq.rb +150 -0
- data/test/BioDSL/commands/test_uchime_ref.rb +113 -0
- data/test/BioDSL/commands/test_uclust.rb +139 -0
- data/test/BioDSL/commands/test_unique_values.rb +98 -0
- data/test/BioDSL/commands/test_usearch_global.rb +123 -0
- data/test/BioDSL/commands/test_usearch_local.rb +125 -0
- data/test/BioDSL/commands/test_write_fasta.rb +159 -0
- data/test/BioDSL/commands/test_write_fastq.rb +166 -0
- data/test/BioDSL/commands/test_write_table.rb +411 -0
- data/test/BioDSL/commands/test_write_tree.rb +122 -0
- data/test/BioDSL/helpers/test_options_helper.rb +272 -0
- data/test/BioDSL/seq/test_assemble.rb +98 -0
- data/test/BioDSL/seq/test_backtrack.rb +176 -0
- data/test/BioDSL/seq/test_digest.rb +71 -0
- data/test/BioDSL/seq/test_dynamic.rb +133 -0
- data/test/BioDSL/seq/test_homopolymer.rb +58 -0
- data/test/BioDSL/seq/test_kmer.rb +134 -0
- data/test/BioDSL/seq/test_translate.rb +75 -0
- data/test/BioDSL/seq/test_trim.rb +101 -0
- data/test/BioDSL/test_cary.rb +176 -0
- data/test/BioDSL/test_command.rb +45 -0
- data/test/BioDSL/test_csv.rb +514 -0
- data/test/BioDSL/test_debug.rb +42 -0
- data/test/BioDSL/test_fasta.rb +154 -0
- data/test/BioDSL/test_fastq.rb +46 -0
- data/test/BioDSL/test_filesys.rb +145 -0
- data/test/BioDSL/test_fork.rb +85 -0
- data/test/BioDSL/test_math.rb +41 -0
- data/test/BioDSL/test_mummer.rb +79 -0
- data/test/BioDSL/test_pipeline.rb +187 -0
- data/test/BioDSL/test_seq.rb +790 -0
- data/test/BioDSL/test_serializer.rb +72 -0
- data/test/BioDSL/test_stream.rb +55 -0
- data/test/BioDSL/test_taxonomy.rb +336 -0
- data/test/BioDSL/test_test.rb +42 -0
- data/test/BioDSL/test_tmp_dir.rb +58 -0
- data/test/BioDSL/test_usearch.rb +33 -0
- data/test/BioDSL/test_verbose.rb +42 -0
- data/test/helper.rb +82 -0
- data/www/command.html.haml +14 -0
- data/www/css.html.haml +55 -0
- data/www/input_files.html.haml +3 -0
- data/www/layout.html.haml +12 -0
- data/www/output_files.html.haml +3 -0
- data/www/overview.html.haml +15 -0
- data/www/pipeline.html.haml +4 -0
- data/www/png.html.haml +2 -0
- data/www/status.html.haml +9 -0
- data/www/time.html.haml +11 -0
- metadata +503 -0
@@ -0,0 +1,229 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
3
|
+
|
4
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
5
|
+
# #
|
6
|
+
# Copyright (C) 2007-2015 Martin Asser Hansen (mail@maasha.dk). #
|
7
|
+
# #
|
8
|
+
# This program is free software; you can redistribute it and/or #
|
9
|
+
# modify it under the terms of the GNU General Public License #
|
10
|
+
# as published by the Free Software Foundation; either version 2 #
|
11
|
+
# of the License, or (at your option) any later version. #
|
12
|
+
# #
|
13
|
+
# This program is distributed in the hope that it will be useful, #
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
16
|
+
# GNU General Public License for more details. #
|
17
|
+
# #
|
18
|
+
# You should have received a copy of the GNU General Public License #
|
19
|
+
# along with this program; if not, write to the Free Software #
|
20
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, #
|
21
|
+
# USA. #
|
22
|
+
# #
|
23
|
+
# http://www.gnu.org/copyleft/gpl.html #
|
24
|
+
# #
|
25
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
26
|
+
# #
|
27
|
+
# This software is part of BioDSL (www.github.com/maasha/BioDSL). #
|
28
|
+
# #
|
29
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
30
|
+
|
31
|
+
require 'test/helper'
|
32
|
+
|
33
|
+
# Test class for the read_fasta command.
|
34
|
+
# rubocop:disable ClassLength
|
35
|
+
class TestReadFasta < Test::Unit::TestCase
|
36
|
+
def setup
|
37
|
+
@tmpdir = Dir.mktmpdir('BioDSL')
|
38
|
+
|
39
|
+
write_fasta_data1
|
40
|
+
write_fasta_data2
|
41
|
+
|
42
|
+
@input, @output = BioDSL::Stream.pipe
|
43
|
+
@input2, @output2 = BioDSL::Stream.pipe
|
44
|
+
|
45
|
+
write_stream_data
|
46
|
+
|
47
|
+
@p = BioDSL::Pipeline.new
|
48
|
+
@err = BioDSL::OptionError
|
49
|
+
end
|
50
|
+
|
51
|
+
def write_fasta_data1
|
52
|
+
@file = File.join(@tmpdir, 'test.fna')
|
53
|
+
|
54
|
+
File.open(@file, 'w') do |ios|
|
55
|
+
ios.puts <<-EOF.gsub(/^\s+\|/, '')
|
56
|
+
|>test1
|
57
|
+
|atgcagcac
|
58
|
+
|>test2
|
59
|
+
|acagcactgA
|
60
|
+
EOF
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def write_fasta_data2
|
65
|
+
@file2 = File.join(@tmpdir, 'test2.fna')
|
66
|
+
|
67
|
+
File.open(@file2, 'w') do |ios|
|
68
|
+
ios.puts <<-EOF.gsub(/^\s+\|/, '')
|
69
|
+
|>test3
|
70
|
+
|acGTAagcac
|
71
|
+
|>test4
|
72
|
+
|aCCAgcactgA
|
73
|
+
EOF
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def write_stream_data
|
78
|
+
@output.write(SEQ_NAME: 'test1', SEQ: 'atgcagcac', SEQ_LEN: 9)
|
79
|
+
@output.write(SEQ_NAME: 'test2', SEQ: 'acagcactgA', SEQ_LEN: 10)
|
80
|
+
@output.close
|
81
|
+
end
|
82
|
+
|
83
|
+
def teardown
|
84
|
+
FileUtils.rm_r @tmpdir
|
85
|
+
end
|
86
|
+
|
87
|
+
test 'BioDSL::Pipeline::ReadFasta with invalid options raises' do
|
88
|
+
assert_raise(@err) { @p.read_fasta(foo: 'bar') }
|
89
|
+
end
|
90
|
+
|
91
|
+
test 'BioDSL::Pipeline::ReadFasta without required options raises' do
|
92
|
+
assert_raise(@err) { @p.read_fasta }
|
93
|
+
end
|
94
|
+
|
95
|
+
test 'BioDSL::Pipeline::ReadFasta with bad first raises' do
|
96
|
+
assert_raise(@err) { @p.read_fasta(input: @file, first: -1) }
|
97
|
+
end
|
98
|
+
|
99
|
+
test 'BioDSL::Pipeline::ReadFasta with bad last raises' do
|
100
|
+
assert_raise(@err) { @p.read_fasta(input: @file, last: -1) }
|
101
|
+
end
|
102
|
+
|
103
|
+
test 'BioDSL::Pipeline::ReadFasta with exclusive unique options raises' do
|
104
|
+
assert_raise(@err) { @p.read_fasta(input: @file, first: 1, last: 1) }
|
105
|
+
end
|
106
|
+
|
107
|
+
test 'BioDSL::Pipeline::ReadFasta with non-existing input file raises' do
|
108
|
+
assert_raise(@err) { @p.read_fasta(input: '___adsf') }
|
109
|
+
end
|
110
|
+
|
111
|
+
test 'BioDSL::Pipeline::ReadFasta returns correctly' do
|
112
|
+
@p.read_fasta(input: @file).run(output: @output2)
|
113
|
+
|
114
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
115
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
116
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
117
|
+
EXP
|
118
|
+
|
119
|
+
assert_equal(expected, collect_result)
|
120
|
+
end
|
121
|
+
|
122
|
+
test 'BioDSL::Pipeline::ReadFasta status returns correctly' do
|
123
|
+
@p.read_fasta(input: @file).run(output: @output2)
|
124
|
+
|
125
|
+
assert_equal(0, @p.status.first[:records_in])
|
126
|
+
assert_equal(2, @p.status.first[:records_out])
|
127
|
+
assert_equal(0, @p.status.first[:sequences_in])
|
128
|
+
assert_equal(2, @p.status.first[:sequences_out])
|
129
|
+
assert_equal(0, @p.status.first[:residues_in])
|
130
|
+
assert_equal(19, @p.status.first[:residues_out])
|
131
|
+
end
|
132
|
+
|
133
|
+
test 'BioDSL::Pipeline::ReadFasta with gzipped data returns correctly' do
|
134
|
+
`gzip #{@file}`
|
135
|
+
|
136
|
+
@p.read_fasta(input: "#{@file}.gz").run(output: @output2)
|
137
|
+
|
138
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
139
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
140
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
141
|
+
EXP
|
142
|
+
|
143
|
+
assert_equal(expected, collect_result)
|
144
|
+
end
|
145
|
+
|
146
|
+
test 'BioDSL::Pipeline::ReadFasta with bzip2\'ed data returns correctly' do
|
147
|
+
`bzip2 #{@file}`
|
148
|
+
|
149
|
+
@p.read_fasta(input: "#{@file}.bz2").run(output: @output2)
|
150
|
+
|
151
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
152
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
153
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
154
|
+
EXP
|
155
|
+
|
156
|
+
assert_equal(expected, collect_result)
|
157
|
+
end
|
158
|
+
|
159
|
+
test 'BioDSL::Pipeline::ReadFasta with multiple files returns correctly' do
|
160
|
+
@p.read_fasta(input: [@file, @file2]).run(output: @output2)
|
161
|
+
|
162
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
163
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
164
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
165
|
+
|{:SEQ_NAME=>"test3", :SEQ=>"acGTAagcac", :SEQ_LEN=>10}
|
166
|
+
|{:SEQ_NAME=>"test4", :SEQ=>"aCCAgcactgA", :SEQ_LEN=>11}
|
167
|
+
EXP
|
168
|
+
|
169
|
+
assert_equal(expected, collect_result)
|
170
|
+
end
|
171
|
+
|
172
|
+
test 'BioDSL::Pipeline::ReadFasta with input glob returns correctly' do
|
173
|
+
@p.read_fasta(input: File.join(@tmpdir, 'test*.fna')).run(output: @output2)
|
174
|
+
|
175
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
176
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
177
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
178
|
+
|{:SEQ_NAME=>"test3", :SEQ=>"acGTAagcac", :SEQ_LEN=>10}
|
179
|
+
|{:SEQ_NAME=>"test4", :SEQ=>"aCCAgcactgA", :SEQ_LEN=>11}
|
180
|
+
EXP
|
181
|
+
|
182
|
+
assert_equal(expected, collect_result)
|
183
|
+
end
|
184
|
+
|
185
|
+
test 'BioDSL::Pipeline::ReadFasta with :first returns correctly' do
|
186
|
+
@p.read_fasta(input: [@file, @file2], first: 3).run(output: @output2)
|
187
|
+
|
188
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
189
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
190
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
191
|
+
|{:SEQ_NAME=>"test3", :SEQ=>"acGTAagcac", :SEQ_LEN=>10}
|
192
|
+
EXP
|
193
|
+
|
194
|
+
assert_equal(expected, collect_result)
|
195
|
+
end
|
196
|
+
|
197
|
+
test 'BioDSL::Pipeline::ReadFasta#to_s with :first returns correctly' do
|
198
|
+
@p.read_fasta(input: @file, first: 3)
|
199
|
+
|
200
|
+
expected = %{BP.new.read_fasta(input: "#{@file}", first: 3)}
|
201
|
+
|
202
|
+
assert_equal(expected, @p.to_s)
|
203
|
+
end
|
204
|
+
|
205
|
+
test 'BioDSL::Pipeline::ReadFasta with :last returns correctly' do
|
206
|
+
@p.read_fasta(input: [@file, @file2], last: 3).run(output: @output2)
|
207
|
+
|
208
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
209
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
210
|
+
|{:SEQ_NAME=>"test3", :SEQ=>"acGTAagcac", :SEQ_LEN=>10}
|
211
|
+
|{:SEQ_NAME=>"test4", :SEQ=>"aCCAgcactgA", :SEQ_LEN=>11}
|
212
|
+
EXP
|
213
|
+
|
214
|
+
assert_equal(expected, collect_result)
|
215
|
+
end
|
216
|
+
|
217
|
+
test 'BioDSL::Pipeline::ReadFasta with flux returns correctly' do
|
218
|
+
@p.read_fasta(input: @file2).run(input: @input, output: @output2)
|
219
|
+
|
220
|
+
expected = <<-EXP.gsub(/^\s+\|/, '')
|
221
|
+
|{:SEQ_NAME=>"test1", :SEQ=>"atgcagcac", :SEQ_LEN=>9}
|
222
|
+
|{:SEQ_NAME=>"test2", :SEQ=>"acagcactgA", :SEQ_LEN=>10}
|
223
|
+
|{:SEQ_NAME=>"test3", :SEQ=>"acGTAagcac", :SEQ_LEN=>10}
|
224
|
+
|{:SEQ_NAME=>"test4", :SEQ=>"aCCAgcactgA", :SEQ_LEN=>11}
|
225
|
+
EXP
|
226
|
+
|
227
|
+
assert_equal(expected, collect_result)
|
228
|
+
end
|
229
|
+
end
|