BioDSL 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/BioDSL.gemspec +64 -0
  4. data/LICENSE +339 -0
  5. data/README.md +205 -0
  6. data/Rakefile +94 -0
  7. data/examples/fastq_to_fasta.rb +8 -0
  8. data/lib/BioDSL/cary.rb +242 -0
  9. data/lib/BioDSL/command.rb +133 -0
  10. data/lib/BioDSL/commands/add_key.rb +110 -0
  11. data/lib/BioDSL/commands/align_seq_mothur.rb +194 -0
  12. data/lib/BioDSL/commands/analyze_residue_distribution.rb +222 -0
  13. data/lib/BioDSL/commands/assemble_pairs.rb +336 -0
  14. data/lib/BioDSL/commands/assemble_seq_idba.rb +230 -0
  15. data/lib/BioDSL/commands/assemble_seq_ray.rb +345 -0
  16. data/lib/BioDSL/commands/assemble_seq_spades.rb +252 -0
  17. data/lib/BioDSL/commands/classify_seq.rb +217 -0
  18. data/lib/BioDSL/commands/classify_seq_mothur.rb +226 -0
  19. data/lib/BioDSL/commands/clip_primer.rb +318 -0
  20. data/lib/BioDSL/commands/cluster_otus.rb +181 -0
  21. data/lib/BioDSL/commands/collapse_otus.rb +170 -0
  22. data/lib/BioDSL/commands/collect_otus.rb +150 -0
  23. data/lib/BioDSL/commands/complement_seq.rb +117 -0
  24. data/lib/BioDSL/commands/count.rb +135 -0
  25. data/lib/BioDSL/commands/count_values.rb +149 -0
  26. data/lib/BioDSL/commands/degap_seq.rb +253 -0
  27. data/lib/BioDSL/commands/dereplicate_seq.rb +168 -0
  28. data/lib/BioDSL/commands/dump.rb +157 -0
  29. data/lib/BioDSL/commands/filter_rrna.rb +239 -0
  30. data/lib/BioDSL/commands/genecall.rb +237 -0
  31. data/lib/BioDSL/commands/grab.rb +535 -0
  32. data/lib/BioDSL/commands/index_taxonomy.rb +226 -0
  33. data/lib/BioDSL/commands/mask_seq.rb +175 -0
  34. data/lib/BioDSL/commands/mean_scores.rb +168 -0
  35. data/lib/BioDSL/commands/merge_pair_seq.rb +175 -0
  36. data/lib/BioDSL/commands/merge_table.rb +225 -0
  37. data/lib/BioDSL/commands/merge_values.rb +113 -0
  38. data/lib/BioDSL/commands/plot_heatmap.rb +233 -0
  39. data/lib/BioDSL/commands/plot_histogram.rb +306 -0
  40. data/lib/BioDSL/commands/plot_matches.rb +282 -0
  41. data/lib/BioDSL/commands/plot_residue_distribution.rb +278 -0
  42. data/lib/BioDSL/commands/plot_scores.rb +285 -0
  43. data/lib/BioDSL/commands/random.rb +153 -0
  44. data/lib/BioDSL/commands/read_fasta.rb +222 -0
  45. data/lib/BioDSL/commands/read_fastq.rb +414 -0
  46. data/lib/BioDSL/commands/read_table.rb +329 -0
  47. data/lib/BioDSL/commands/reverse_seq.rb +113 -0
  48. data/lib/BioDSL/commands/slice_align.rb +400 -0
  49. data/lib/BioDSL/commands/slice_seq.rb +151 -0
  50. data/lib/BioDSL/commands/sort.rb +223 -0
  51. data/lib/BioDSL/commands/split_pair_seq.rb +220 -0
  52. data/lib/BioDSL/commands/split_values.rb +165 -0
  53. data/lib/BioDSL/commands/trim_primer.rb +314 -0
  54. data/lib/BioDSL/commands/trim_seq.rb +192 -0
  55. data/lib/BioDSL/commands/uchime_ref.rb +170 -0
  56. data/lib/BioDSL/commands/uclust.rb +286 -0
  57. data/lib/BioDSL/commands/unique_values.rb +145 -0
  58. data/lib/BioDSL/commands/usearch_global.rb +171 -0
  59. data/lib/BioDSL/commands/usearch_local.rb +171 -0
  60. data/lib/BioDSL/commands/write_fasta.rb +207 -0
  61. data/lib/BioDSL/commands/write_fastq.rb +191 -0
  62. data/lib/BioDSL/commands/write_table.rb +419 -0
  63. data/lib/BioDSL/commands/write_tree.rb +167 -0
  64. data/lib/BioDSL/commands.rb +31 -0
  65. data/lib/BioDSL/config.rb +55 -0
  66. data/lib/BioDSL/csv.rb +307 -0
  67. data/lib/BioDSL/debug.rb +42 -0
  68. data/lib/BioDSL/fasta.rb +133 -0
  69. data/lib/BioDSL/fastq.rb +77 -0
  70. data/lib/BioDSL/filesys.rb +137 -0
  71. data/lib/BioDSL/fork.rb +145 -0
  72. data/lib/BioDSL/hamming.rb +128 -0
  73. data/lib/BioDSL/helpers/aux_helper.rb +44 -0
  74. data/lib/BioDSL/helpers/email_helper.rb +66 -0
  75. data/lib/BioDSL/helpers/history_helper.rb +40 -0
  76. data/lib/BioDSL/helpers/log_helper.rb +55 -0
  77. data/lib/BioDSL/helpers/options_helper.rb +405 -0
  78. data/lib/BioDSL/helpers/status_helper.rb +132 -0
  79. data/lib/BioDSL/helpers.rb +35 -0
  80. data/lib/BioDSL/html_report.rb +200 -0
  81. data/lib/BioDSL/math.rb +55 -0
  82. data/lib/BioDSL/mummer.rb +216 -0
  83. data/lib/BioDSL/pipeline.rb +354 -0
  84. data/lib/BioDSL/seq/ambiguity.rb +66 -0
  85. data/lib/BioDSL/seq/assemble.rb +240 -0
  86. data/lib/BioDSL/seq/backtrack.rb +252 -0
  87. data/lib/BioDSL/seq/digest.rb +99 -0
  88. data/lib/BioDSL/seq/dynamic.rb +263 -0
  89. data/lib/BioDSL/seq/homopolymer.rb +59 -0
  90. data/lib/BioDSL/seq/kmer.rb +293 -0
  91. data/lib/BioDSL/seq/levenshtein.rb +113 -0
  92. data/lib/BioDSL/seq/translate.rb +109 -0
  93. data/lib/BioDSL/seq/trim.rb +188 -0
  94. data/lib/BioDSL/seq.rb +742 -0
  95. data/lib/BioDSL/serializer.rb +98 -0
  96. data/lib/BioDSL/stream.rb +113 -0
  97. data/lib/BioDSL/taxonomy.rb +691 -0
  98. data/lib/BioDSL/test.rb +42 -0
  99. data/lib/BioDSL/tmp_dir.rb +68 -0
  100. data/lib/BioDSL/usearch.rb +301 -0
  101. data/lib/BioDSL/verbose.rb +42 -0
  102. data/lib/BioDSL/version.rb +31 -0
  103. data/lib/BioDSL.rb +81 -0
  104. data/test/BioDSL/commands/test_add_key.rb +105 -0
  105. data/test/BioDSL/commands/test_align_seq_mothur.rb +99 -0
  106. data/test/BioDSL/commands/test_analyze_residue_distribution.rb +134 -0
  107. data/test/BioDSL/commands/test_assemble_pairs.rb +459 -0
  108. data/test/BioDSL/commands/test_assemble_seq_idba.rb +50 -0
  109. data/test/BioDSL/commands/test_assemble_seq_ray.rb +51 -0
  110. data/test/BioDSL/commands/test_assemble_seq_spades.rb +50 -0
  111. data/test/BioDSL/commands/test_classify_seq.rb +50 -0
  112. data/test/BioDSL/commands/test_classify_seq_mothur.rb +59 -0
  113. data/test/BioDSL/commands/test_clip_primer.rb +377 -0
  114. data/test/BioDSL/commands/test_cluster_otus.rb +128 -0
  115. data/test/BioDSL/commands/test_collapse_otus.rb +81 -0
  116. data/test/BioDSL/commands/test_collect_otus.rb +82 -0
  117. data/test/BioDSL/commands/test_complement_seq.rb +78 -0
  118. data/test/BioDSL/commands/test_count.rb +103 -0
  119. data/test/BioDSL/commands/test_count_values.rb +85 -0
  120. data/test/BioDSL/commands/test_degap_seq.rb +96 -0
  121. data/test/BioDSL/commands/test_dereplicate_seq.rb +92 -0
  122. data/test/BioDSL/commands/test_dump.rb +109 -0
  123. data/test/BioDSL/commands/test_filter_rrna.rb +128 -0
  124. data/test/BioDSL/commands/test_genecall.rb +50 -0
  125. data/test/BioDSL/commands/test_grab.rb +398 -0
  126. data/test/BioDSL/commands/test_index_taxonomy.rb +62 -0
  127. data/test/BioDSL/commands/test_mask_seq.rb +98 -0
  128. data/test/BioDSL/commands/test_mean_scores.rb +111 -0
  129. data/test/BioDSL/commands/test_merge_pair_seq.rb +115 -0
  130. data/test/BioDSL/commands/test_merge_table.rb +131 -0
  131. data/test/BioDSL/commands/test_merge_values.rb +83 -0
  132. data/test/BioDSL/commands/test_plot_heatmap.rb +185 -0
  133. data/test/BioDSL/commands/test_plot_histogram.rb +194 -0
  134. data/test/BioDSL/commands/test_plot_matches.rb +157 -0
  135. data/test/BioDSL/commands/test_plot_residue_distribution.rb +309 -0
  136. data/test/BioDSL/commands/test_plot_scores.rb +308 -0
  137. data/test/BioDSL/commands/test_random.rb +88 -0
  138. data/test/BioDSL/commands/test_read_fasta.rb +229 -0
  139. data/test/BioDSL/commands/test_read_fastq.rb +552 -0
  140. data/test/BioDSL/commands/test_read_table.rb +327 -0
  141. data/test/BioDSL/commands/test_reverse_seq.rb +79 -0
  142. data/test/BioDSL/commands/test_slice_align.rb +218 -0
  143. data/test/BioDSL/commands/test_slice_seq.rb +131 -0
  144. data/test/BioDSL/commands/test_sort.rb +128 -0
  145. data/test/BioDSL/commands/test_split_pair_seq.rb +164 -0
  146. data/test/BioDSL/commands/test_split_values.rb +95 -0
  147. data/test/BioDSL/commands/test_trim_primer.rb +329 -0
  148. data/test/BioDSL/commands/test_trim_seq.rb +150 -0
  149. data/test/BioDSL/commands/test_uchime_ref.rb +113 -0
  150. data/test/BioDSL/commands/test_uclust.rb +139 -0
  151. data/test/BioDSL/commands/test_unique_values.rb +98 -0
  152. data/test/BioDSL/commands/test_usearch_global.rb +123 -0
  153. data/test/BioDSL/commands/test_usearch_local.rb +125 -0
  154. data/test/BioDSL/commands/test_write_fasta.rb +159 -0
  155. data/test/BioDSL/commands/test_write_fastq.rb +166 -0
  156. data/test/BioDSL/commands/test_write_table.rb +411 -0
  157. data/test/BioDSL/commands/test_write_tree.rb +122 -0
  158. data/test/BioDSL/helpers/test_options_helper.rb +272 -0
  159. data/test/BioDSL/seq/test_assemble.rb +98 -0
  160. data/test/BioDSL/seq/test_backtrack.rb +176 -0
  161. data/test/BioDSL/seq/test_digest.rb +71 -0
  162. data/test/BioDSL/seq/test_dynamic.rb +133 -0
  163. data/test/BioDSL/seq/test_homopolymer.rb +58 -0
  164. data/test/BioDSL/seq/test_kmer.rb +134 -0
  165. data/test/BioDSL/seq/test_translate.rb +75 -0
  166. data/test/BioDSL/seq/test_trim.rb +101 -0
  167. data/test/BioDSL/test_cary.rb +176 -0
  168. data/test/BioDSL/test_command.rb +45 -0
  169. data/test/BioDSL/test_csv.rb +514 -0
  170. data/test/BioDSL/test_debug.rb +42 -0
  171. data/test/BioDSL/test_fasta.rb +154 -0
  172. data/test/BioDSL/test_fastq.rb +46 -0
  173. data/test/BioDSL/test_filesys.rb +145 -0
  174. data/test/BioDSL/test_fork.rb +85 -0
  175. data/test/BioDSL/test_math.rb +41 -0
  176. data/test/BioDSL/test_mummer.rb +79 -0
  177. data/test/BioDSL/test_pipeline.rb +187 -0
  178. data/test/BioDSL/test_seq.rb +790 -0
  179. data/test/BioDSL/test_serializer.rb +72 -0
  180. data/test/BioDSL/test_stream.rb +55 -0
  181. data/test/BioDSL/test_taxonomy.rb +336 -0
  182. data/test/BioDSL/test_test.rb +42 -0
  183. data/test/BioDSL/test_tmp_dir.rb +58 -0
  184. data/test/BioDSL/test_usearch.rb +33 -0
  185. data/test/BioDSL/test_verbose.rb +42 -0
  186. data/test/helper.rb +82 -0
  187. data/www/command.html.haml +14 -0
  188. data/www/css.html.haml +55 -0
  189. data/www/input_files.html.haml +3 -0
  190. data/www/layout.html.haml +12 -0
  191. data/www/output_files.html.haml +3 -0
  192. data/www/overview.html.haml +15 -0
  193. data/www/pipeline.html.haml +4 -0
  194. data/www/png.html.haml +2 -0
  195. data/www/status.html.haml +9 -0
  196. data/www/time.html.haml +11 -0
  197. metadata +503 -0
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+ $:.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, USA. #
21
+ # #
22
+ # http://www.gnu.org/copyleft/gpl.html #
23
+ # #
24
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
25
+ # #
26
+ # This software is part of BioDSL (www.BioDSL.org). #
27
+ # #
28
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
29
+
30
+ require 'test/helper'
31
+
32
+ class TestSerializer < Test::Unit::TestCase
33
+ def setup
34
+ @records = [
35
+ {"foo" => 1},
36
+ {"bar" => 2}
37
+ ]
38
+ end
39
+
40
+ test "BioDSL::Serializer with no block raises" do
41
+ assert_raise(BioDSL::SerializerError) { BioDSL::Serializer.new("foo") }
42
+ end
43
+
44
+ test "BioDSL::Serializer returns correctly" do
45
+ require 'tempfile'
46
+
47
+ file = Tempfile.new("serializer")
48
+
49
+ begin
50
+ File.open(file, 'wb') do |io|
51
+ BioDSL::Serializer.new(io) do |s|
52
+ @records.each { |r| s << r }
53
+ end
54
+ end
55
+
56
+ result = []
57
+
58
+ File.open(file, 'rb') do |io|
59
+ BioDSL::Serializer.new(io) do |s|
60
+ s.each do |record|
61
+ result << record
62
+ end
63
+ end
64
+ end
65
+
66
+ assert_equal(@records, result)
67
+ ensure
68
+ file.close
69
+ file.unlink
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ $:.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, USA. #
21
+ # #
22
+ # http://www.gnu.org/copyleft/gpl.html #
23
+ # #
24
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
25
+ # #
26
+ # This software is part of BioDSL (www.BioDSL.org). #
27
+ # #
28
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
29
+
30
+ require 'test/helper'
31
+
32
+ class TestStream < Test::Unit::TestCase
33
+ def setup
34
+ @obj = {foo: "bar"}
35
+ @reader, @writer = BioDSL::Stream.pipe
36
+ end
37
+
38
+ def teardown
39
+ @reader.close unless @reader.closed?
40
+ @writer.close unless @writer.closed?
41
+ end
42
+
43
+ test "BioDSL::Stream.pipe writing and reading an object returns correctly" do
44
+ @writer.write @obj
45
+ @writer.close
46
+ assert_equal(@obj, @reader.read)
47
+ end
48
+
49
+ test "BioDSL::Stream.pipe writing and reading multiple object returns correctly" do
50
+ 10.times { @writer.write @obj }
51
+ @writer.close
52
+ result = @reader.inject([]) { |memo, obj| memo << obj }
53
+ assert_equal(Array.new(10, @obj), result)
54
+ end
55
+ end
@@ -0,0 +1,336 @@
1
+ #!/usr/bin/env ruby
2
+ $:.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, USA. #
21
+ # #
22
+ # http://www.gnu.org/copyleft/gpl.html #
23
+ # #
24
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
25
+ # #
26
+ # This software is part of BioDSL (www.BioDSL.org). #
27
+ # #
28
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
29
+
30
+ require 'test/helper'
31
+
32
+ class TestTaxonomy < Test::Unit::TestCase
33
+ def setup
34
+ @tmpdir = Dir.mktmpdir("Taxonomy")
35
+
36
+ @index = BioDSL::Taxonomy::Index.new(kmer_size: 3, step_size: 1, output_dir: @tmpdir, prefix: "test")
37
+
38
+ @index2 = BioDSL::Taxonomy::Index.new(kmer_size: 3, step_size: 1, output_dir: @tmpdir, prefix: "test")
39
+ @index2.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#;O#;F#;G#;S#", seq: "aaga"))
40
+ @index2.add(BioDSL::Seq.new(seq_name: "K#b;P#f;C#;O#;F#;G#;S#", seq: "aagu"))
41
+ @index2.add(BioDSL::Seq.new(seq_name: "K#b;P#;C#;O#;F#;G#;S#", seq: "aag"))
42
+ @index2.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#g;O#;F#;G#;S#", seq: "aagag"))
43
+
44
+ @index3 = BioDSL::Taxonomy::Index.new(kmer_size: 3, step_size: 1, output_dir: @tmpdir, prefix: "test")
45
+ @index3.add(BioDSL::Seq.new(seq_name: "K#a;P#b;C#;O#;F#;G#;S#", seq: "aagc"))
46
+ @index3.add(BioDSL::Seq.new(seq_name: "K#a;P#c;C#d;O#;F#;G#;S#", seq: "aagag"))
47
+ @index3.add(BioDSL::Seq.new(seq_name: "K#a;P#c;C#d_1;O#;F#;G#;S#", seq: "aagag"))
48
+ @index3.add(BioDSL::Seq.new(seq_name: "K#a;P#c;C#d_1_2;O#;F#;G#;S#", seq: "aagac"))
49
+ @index3.save
50
+
51
+ @tree_file = File.join(@tmpdir, "test_tax_index.dat")
52
+ @kmer_file = File.join(@tmpdir, "test_kmer_index.dat")
53
+ end
54
+
55
+ def teardown
56
+ FileUtils.rm_r @tmpdir
57
+ end
58
+
59
+ test "BioDSL::Taxonomy::Index#new without options[:kmer_size] raises" do
60
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Index.new(step_size: 1, output_dir: @tmpdir, prefix: "test") }
61
+ end
62
+
63
+ test "BioDSL::Taxonomy::Index#new without options[:step_size] raises" do
64
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Index.new(kmer_size: 3, output_dir: @tmpdir, prefix: "test") }
65
+ end
66
+
67
+ test "BioDSL::Taxonomy::Index#new without options[:output_dir] raises" do
68
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Index.new(kmer_size: 3, step_size: 1, prefix: "test") }
69
+ end
70
+
71
+ test "BioDSL::Taxonomy::Index#new without options[:prefix] raises" do
72
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Index.new(kmer_size: 3, step_size: 1, output_dir: @tmpdir) }
73
+ end
74
+
75
+ test "BioDSL::Taxonomy::Index#add with bad header with wrong number of tax levels raises" do
76
+ assert_raise(BioDSL::TaxonomyError) { @index.add(BioDSL::Seq.new(seq_name: "K#1;P#2", seq: "aaga")) }
77
+ end
78
+
79
+ test "BioDSL::Taxonomy::Index#add with bad header with wrong tax order raises" do
80
+ assert_raise(BioDSL::TaxonomyError) { @index.add(BioDSL::Seq.new(seq_name: "K#1;C#;P#3;O#;F#;G#;S#", seq: "aaga")) }
81
+ end
82
+
83
+ test "BioDSL::Taxonomy::Index#add with bad header with gapped info raises" do
84
+ assert_raise(BioDSL::TaxonomyError) { @index.add(BioDSL::Seq.new(seq_name: "K#1;P#;C#3;O#;F#;G#;S#", seq: "aaga")) }
85
+ end
86
+
87
+ test "BioDSL::Taxonomy::Index#add with OK header don't raise" do
88
+ assert_nothing_raised { @index.add(BioDSL::Seq.new(seq_name: "K#;P#;C#;O#;F#;G#;S#", seq: "aaga")) }
89
+ assert_nothing_raised { @index.add(BioDSL::Seq.new(seq_name: "K#1;P#2;C#3;O#4;F#5;G#6;S#7", seq: "aaga")) }
90
+ end
91
+
92
+ # '00' then oligo << 'a'
93
+ # '01' then oligo << 't'
94
+ # '10' then oligo << 'c'
95
+ # '11' then oligo << 'g'
96
+
97
+ test "BioDSL::Taxonomy::Index#add with empty tree returns correctly" do
98
+ assert_equal(1, @index.size)
99
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#;O#;F#;G#;S#", seq: "aaga"))
100
+ assert_equal(3, @index.size)
101
+ assert_equal("root", @index.get_node(0).name)
102
+ assert_equal("b", @index.get_node(1).name)
103
+ assert_equal("e", @index.get_node(2).name)
104
+ assert_equal([], @index.get_node(0).kmers.to_a)
105
+ assert_equal([], @index.get_node(1).kmers.to_a)
106
+ assert_equal([3, 12], @index.get_node(2).kmers.to_a) # aag=000011=3, aga=001100=12
107
+ end
108
+
109
+ test "BioDSL::Taxonomy::Index#add with edge split returns correctly" do
110
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#;O#;F#;G#;S#", seq: "aaga"))
111
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#f;C#;O#;F#;G#;S#", seq: "aagu"))
112
+ assert_equal(4, @index.size)
113
+ assert_equal("root", @index.get_node(0).name)
114
+ assert_equal("b", @index.get_node(1).name)
115
+ assert_equal("e", @index.get_node(2).name)
116
+ assert_equal("f", @index.get_node(3).name)
117
+ assert_equal([], @index.get_node(0).kmers.to_a)
118
+ assert_equal([], @index.get_node(1).kmers.to_a)
119
+ assert_equal([3, 12], @index.get_node(2).kmers.to_a) # aag=000011=3, aga=001100=12
120
+ assert_equal([3, 13], @index.get_node(3).kmers.to_a) # aag=000011=3, agu=001101=13
121
+ end
122
+
123
+ test "BioDSL::Taxonomy::Index#add to existing non-leaf node returns correctly" do
124
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#;O#;F#;G#;S#", seq: "aaga"))
125
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#f;C#;O#;F#;G#;S#", seq: "aagu"))
126
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#;C#;O#;F#;G#;S#", seq: "aag"))
127
+ assert_equal(4, @index.size)
128
+ assert_equal("root", @index.get_node(0).name)
129
+ assert_equal("b", @index.get_node(1).name)
130
+ assert_equal("e", @index.get_node(2).name)
131
+ assert_equal("f", @index.get_node(3).name)
132
+ assert_equal([], @index.get_node(0).kmers.to_a)
133
+ assert_equal([3], @index.get_node(1).kmers.to_a) # aag=000011=3
134
+ assert_equal([3, 12], @index.get_node(2).kmers.to_a) # aag=000011=3, aga=001100=12
135
+ assert_equal([3, 13], @index.get_node(3).kmers.to_a) # aag=000011=3, agu=001101=13
136
+ end
137
+
138
+ test "BioDSL::Taxonomy::Index#add exteding existing leaf node returns correctly" do
139
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#;O#;F#;G#;S#", seq: "aaga"))
140
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#f;C#;O#;F#;G#;S#", seq: "aagu"))
141
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#;C#;O#;F#;G#;S#", seq: "aag"))
142
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#g;O#;F#;G#;S#", seq: "aagag"))
143
+ assert_equal(5, @index.size)
144
+ assert_equal("root", @index.get_node(0).name)
145
+ assert_equal("b", @index.get_node(1).name)
146
+ assert_equal("e", @index.get_node(2).name)
147
+ assert_equal("f", @index.get_node(3).name)
148
+ assert_equal("g", @index.get_node(4).name)
149
+ assert_equal([], @index.get_node(0).kmers.to_a.sort)
150
+ assert_equal([3], @index.get_node(1).kmers.to_a.sort) # aag=000011=3
151
+ assert_equal([3, 12], @index.get_node(2).kmers.to_a.sort) # aag=000011=3, aga=001100=12
152
+ assert_equal([3, 13], @index.get_node(3).kmers.to_a.sort) # aag=000011=3, agu=001101=13
153
+ assert_equal([3, 12, 51], @index.get_node(4).kmers.to_a.sort) # aag=000011=3, aga=001101=12, gag=110011=51
154
+ end
155
+
156
+ test "BioDSL::Taxonomy::Index#tree_union returns correctly" do
157
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#;O#;F#;G#;S#", seq: "aaga"))
158
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#f;C#;O#;F#;G#;S#", seq: "aagu"))
159
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#;C#;O#;F#;G#;S#", seq: "aag"))
160
+ @index.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#g;O#;F#;G#;S#", seq: "aagag"))
161
+ @index.tree_union
162
+ assert_equal(5, @index.size)
163
+ assert_equal("root", @index.get_node(0).name)
164
+ assert_equal("b", @index.get_node(1).name)
165
+ assert_equal("e", @index.get_node(2).name)
166
+ assert_equal("f", @index.get_node(3).name)
167
+ assert_equal("g", @index.get_node(4).name)
168
+ assert_equal([3, 12, 13, 51], @index.get_node(0).kmers.to_a.sort)
169
+ assert_equal([3, 12, 13, 51], @index.get_node(1).kmers.to_a.sort)
170
+ assert_equal([3, 12, 51], @index.get_node(2).kmers.to_a.sort)
171
+ assert_equal([3, 13], @index.get_node(3).kmers.to_a.sort)
172
+ assert_equal([3, 12, 51], @index.get_node(4).kmers.to_a.sort)
173
+ end
174
+
175
+ test "BioDSL::Taxonomy::Index#save outputs correct tax tree inxex" do
176
+ @index2.save
177
+
178
+ expected = <<EOD
179
+ #SEQ_ID\tNODE_ID\tLEVEL\tNAME\tPARENT_ID
180
+ \t0\tr\troot\t
181
+ 0\t1\tk\tb\t0
182
+ 1\t3\tp\tf\t1
183
+ 0\t2\tp\te\t1
184
+ 3\t4\tc\tg\t2
185
+ EOD
186
+
187
+ assert_equal(expected, File.read(@tree_file))
188
+ end
189
+
190
+ # r 0
191
+ # /
192
+ # k 1
193
+ # / \
194
+ # p 2 3
195
+ # /
196
+ # c 4
197
+ #
198
+ # aag=000011=3
199
+ # aga=001101=12
200
+ # agu=001101=13
201
+ # gag=110011=51
202
+ #
203
+ # node 0 - [3, 12, 13, 51]
204
+ # node 1 - [3, 12, 13, 51]
205
+ # node 2 - [3, 12, 51]
206
+ # node 3 - [3, 13]
207
+ # node 4 - [3, 12, 51]
208
+ test "BioDSL::Taxonomy::Index#save outputs correct kmer index" do
209
+ @index2.save
210
+
211
+ expected = <<EOD
212
+ #LEVEL\tKMER\tNODES
213
+ r\t3\t0
214
+ r\t12\t0
215
+ r\t13\t0
216
+ r\t51\t0
217
+ k\t3\t1
218
+ k\t12\t1
219
+ k\t13\t1
220
+ k\t51\t1
221
+ p\t3\t2;3
222
+ p\t12\t2
223
+ p\t13\t3
224
+ p\t51\t2
225
+ c\t3\t4
226
+ c\t12\t4
227
+ c\t51\t4
228
+ EOD
229
+
230
+ assert_equal(expected, File.read(@kmer_file))
231
+ end
232
+
233
+ test "BioDSL::Taxonomy::Search#new without options[:kmer_size] raises" do
234
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.99, hits_max: 5, consensus: 0.5) }
235
+ end
236
+
237
+ test "BioDSL::Taxonomy::Search#new without options[:step_size] raises" do
238
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(kmer_size: 3, dir: @tmpdir, prefix: "test", coverage: 0.99, hits_max: 5, consensus: 0.5) }
239
+ end
240
+
241
+ test "BioDSL::Taxonomy::Search#new without options[:dir] raises" do
242
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, prefix: "test", coverage: 0.99, hits_max: 5, consensus: 0.5) }
243
+ end
244
+
245
+ test "BioDSL::Taxonomy::Search#new without options[:prefix] raises" do
246
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, coverage: 0.99, hits_max: 5, consensus: 0.5) }
247
+ end
248
+
249
+ test "BioDSL::Taxonomy::Search#new without options[:coverage] raises" do
250
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", hits_max: 5, consensus: 0.5) }
251
+ end
252
+
253
+ test "BioDSL::Taxonomy::Search#new without options[:hits_max] raises" do
254
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.99, consensus: 0.5) }
255
+ end
256
+
257
+ test "BioDSL::Taxonomy::Search#new without options[:consensus] raises" do
258
+ assert_raise(BioDSL::TaxonomyError) { BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.99, hits_max: 5) }
259
+ end
260
+
261
+ # R r
262
+ # |
263
+ # K a
264
+ # / \
265
+ # P c b
266
+ # / | \
267
+ # C d | d_1_2
268
+ # d_1
269
+ #
270
+ # R: aag: r
271
+ # R: aga: r
272
+ # R: gag: r
273
+ # R: gac: r
274
+ # R: agc: r
275
+ # K: aag: a
276
+ # K: aga: a
277
+ # K: gag: a
278
+ # K: gac: a
279
+ # K: agc: a
280
+ # P: aag: c
281
+ # P: aga: c
282
+ # P: gag: c
283
+ # P: gac: c
284
+ # P: agc: b
285
+ # C: aag: d, d_1, d_1_2
286
+ # C: aga: d, d_1, d_1_2
287
+ # C: gag: d, d_1
288
+ # C: gac: f
289
+ test "BioDSL::Taxonomy::Search#execute return correctly" do
290
+ @search = BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 1.0, hits_max: 5, consensus: 0.0)
291
+ result = @search.execute(BioDSL::Seq.new(seq_name: "test", seq: "aaga"))
292
+
293
+ assert_equal(3, result.hits)
294
+ assert_equal("K#a(100);P#c(100);C#d 1 2(100/66/33)", result.taxonomy)
295
+ end
296
+
297
+ test "BioDSL::Taxonomy::Search#execute with coverage limit returns correctly" do
298
+ @search = BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 1.0, hits_max: 5, consensus: 0.0)
299
+ result = @search.execute(BioDSL::Seq.new(seq_name: "test", seq: "aagat"))
300
+
301
+ assert_equal(0, result.hits)
302
+ assert_equal("Unclassified", result.taxonomy)
303
+ end
304
+
305
+ test "BioDSL::Taxonomy::Search#execute with hits_max limit returns correctly" do
306
+ @search = BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.0, hits_max: 2, consensus: 0.0)
307
+ result = @search.execute(BioDSL::Seq.new(seq_name: "test", seq: "aaga"))
308
+
309
+ assert_equal(2, result.hits)
310
+ assert_equal("K#a(100);P#c(100);C#d 1(100/50)", result.taxonomy)
311
+ end
312
+
313
+ test "BioDSL::Taxonomy::Search#execute with consensus returns correctly" do
314
+ @search = BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.0, hits_max: 5, consensus: 0.34)
315
+ result = @search.execute(BioDSL::Seq.new(seq_name: "test", seq: "aaga"))
316
+
317
+ assert_equal(3, result.hits)
318
+ assert_equal("K#a(100);P#c(100);C#d 1(100/66)", result.taxonomy)
319
+ end
320
+
321
+ test "BioDSL::Taxonomy::Search#execute with best_only returns correctly" do
322
+ @search = BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.0, hits_max: 5, consensus: 0.0, best_only: true)
323
+ result = @search.execute(BioDSL::Seq.new(seq_name: "test", seq: "aagag"))
324
+
325
+ assert_equal(2, result.hits)
326
+ assert_equal("K#a(100);P#c(100);C#d 1(100/50)", result.taxonomy)
327
+ end
328
+
329
+ test "BioDSL::Taxonomy::Search#execute with no hits a C level moves to P level and returns correctly" do
330
+ @search = BioDSL::Taxonomy::Search.new(kmer_size: 3, step_size: 1, dir: @tmpdir, prefix: "test", coverage: 0.0, hits_max: 5, consensus: 0.0)
331
+ result = @search.execute(BioDSL::Seq.new(seq_name: "test", seq: "agc"))
332
+
333
+ assert_equal(1, result.hits)
334
+ assert_equal("K#a(100);P#b(100)", result.taxonomy)
335
+ end
336
+ end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ $:.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, USA. #
21
+ # #
22
+ # http://www.gnu.org/copyleft/gpl.html #
23
+ # #
24
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
25
+ # #
26
+ # This software is part of BioDSL (www.BioDSL.org). #
27
+ # #
28
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
29
+
30
+ require 'test/helper'
31
+
32
+ class TestTest < Test::Unit::TestCase
33
+ def teardown
34
+ BioDSL::test = false
35
+ end
36
+
37
+ test "BioDSL::test returns correctly" do
38
+ BioDSL::test = true
39
+ assert_equal(true, BioDSL::test)
40
+ end
41
+ end
42
+
@@ -0,0 +1,58 @@
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 TmpDir
34
+ class TmpDirTest < Test::Unit::TestCase
35
+ test 'BioDSL::TmpDir#create with no files returns correctly' do
36
+ dir = ''
37
+
38
+ BioDSL::TmpDir.create do |tmp_dir|
39
+ dir = tmp_dir
40
+ assert_true(File.directory? dir)
41
+ end
42
+
43
+ assert_false(File.directory? dir)
44
+ end
45
+
46
+ test 'BioDSL::TmpDir#create with files returns correctly' do
47
+ dir = ''
48
+
49
+ BioDSL::TmpDir.create('foo', 'bar') do |foo, bar, tmp_dir|
50
+ dir = tmp_dir
51
+ assert_true(File.directory? dir)
52
+ assert_equal(File.join(dir, 'foo'), foo)
53
+ assert_equal(File.join(dir, 'bar'), bar)
54
+ end
55
+
56
+ assert_false(File.directory? dir)
57
+ end
58
+ end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ $:.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, USA. #
21
+ # #
22
+ # http://www.gnu.org/copyleft/gpl.html #
23
+ # #
24
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
25
+ # #
26
+ # This software is part of BioDSL (www.BioDSL.org). #
27
+ # #
28
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
29
+
30
+ require 'test/helper'
31
+
32
+ class TestUsearch < Test::Unit::TestCase
33
+ end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ $:.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, USA. #
21
+ # #
22
+ # http://www.gnu.org/copyleft/gpl.html #
23
+ # #
24
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
25
+ # #
26
+ # This software is part of BioDSL (www.BioDSL.org). #
27
+ # #
28
+ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
29
+
30
+ require 'test/helper'
31
+
32
+ class VerboseTest < Test::Unit::TestCase
33
+ def teardown
34
+ BioDSL::verbose = false
35
+ end
36
+
37
+ test "BioDSL::verbose returns correctly" do
38
+ BioDSL::verbose = true
39
+ assert_equal(true, BioDSL::verbose)
40
+ end
41
+ end
42
+