BioDSL 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/BioDSL.gemspec +1 -1
- data/Gemfile +6 -0
- data/README.md +289 -155
- data/Rakefile +18 -16
- data/lib/BioDSL.rb +1 -1
- data/lib/BioDSL/cary.rb +78 -53
- data/lib/BioDSL/command.rb +2 -2
- data/lib/BioDSL/commands.rb +1 -1
- data/lib/BioDSL/commands/add_key.rb +1 -1
- data/lib/BioDSL/commands/align_seq_mothur.rb +4 -4
- data/lib/BioDSL/commands/analyze_residue_distribution.rb +5 -5
- data/lib/BioDSL/commands/assemble_pairs.rb +13 -13
- data/lib/BioDSL/commands/assemble_seq_idba.rb +7 -9
- data/lib/BioDSL/commands/assemble_seq_ray.rb +13 -13
- data/lib/BioDSL/commands/assemble_seq_spades.rb +4 -4
- data/lib/BioDSL/commands/classify_seq.rb +8 -8
- data/lib/BioDSL/commands/classify_seq_mothur.rb +5 -5
- data/lib/BioDSL/commands/clip_primer.rb +7 -7
- data/lib/BioDSL/commands/cluster_otus.rb +5 -5
- data/lib/BioDSL/commands/collapse_otus.rb +2 -2
- data/lib/BioDSL/commands/collect_otus.rb +2 -2
- data/lib/BioDSL/commands/complement_seq.rb +4 -4
- data/lib/BioDSL/commands/count.rb +1 -1
- data/lib/BioDSL/commands/count_values.rb +2 -2
- data/lib/BioDSL/commands/degap_seq.rb +6 -7
- data/lib/BioDSL/commands/dereplicate_seq.rb +1 -1
- data/lib/BioDSL/commands/dump.rb +2 -2
- data/lib/BioDSL/commands/filter_rrna.rb +4 -4
- data/lib/BioDSL/commands/genecall.rb +7 -7
- data/lib/BioDSL/commands/grab.rb +1 -1
- data/lib/BioDSL/commands/index_taxonomy.rb +3 -3
- data/lib/BioDSL/commands/mask_seq.rb +4 -4
- data/lib/BioDSL/commands/mean_scores.rb +2 -2
- data/lib/BioDSL/commands/merge_pair_seq.rb +3 -3
- data/lib/BioDSL/commands/merge_table.rb +1 -1
- data/lib/BioDSL/commands/merge_values.rb +1 -1
- data/lib/BioDSL/commands/plot_heatmap.rb +4 -5
- data/lib/BioDSL/commands/plot_histogram.rb +4 -4
- data/lib/BioDSL/commands/plot_matches.rb +5 -5
- data/lib/BioDSL/commands/plot_residue_distribution.rb +6 -6
- data/lib/BioDSL/commands/plot_scores.rb +7 -7
- data/lib/BioDSL/commands/random.rb +1 -1
- data/lib/BioDSL/commands/read_fasta.rb +9 -9
- data/lib/BioDSL/commands/read_fastq.rb +16 -16
- data/lib/BioDSL/commands/read_table.rb +2 -3
- data/lib/BioDSL/commands/reverse_seq.rb +4 -4
- data/lib/BioDSL/commands/slice_align.rb +4 -4
- data/lib/BioDSL/commands/slice_seq.rb +3 -3
- data/lib/BioDSL/commands/sort.rb +1 -1
- data/lib/BioDSL/commands/split_pair_seq.rb +6 -7
- data/lib/BioDSL/commands/split_values.rb +2 -2
- data/lib/BioDSL/commands/trim_primer.rb +13 -8
- data/lib/BioDSL/commands/trim_seq.rb +5 -5
- data/lib/BioDSL/commands/uchime_ref.rb +6 -6
- data/lib/BioDSL/commands/uclust.rb +5 -5
- data/lib/BioDSL/commands/unique_values.rb +1 -1
- data/lib/BioDSL/commands/usearch_global.rb +2 -2
- data/lib/BioDSL/commands/usearch_local.rb +2 -2
- data/lib/BioDSL/commands/write_fasta.rb +7 -9
- data/lib/BioDSL/commands/write_fastq.rb +4 -4
- data/lib/BioDSL/commands/write_table.rb +3 -3
- data/lib/BioDSL/commands/write_tree.rb +2 -3
- data/lib/BioDSL/config.rb +2 -2
- data/lib/BioDSL/csv.rb +8 -10
- data/lib/BioDSL/debug.rb +1 -1
- data/lib/BioDSL/fasta.rb +54 -40
- data/lib/BioDSL/fastq.rb +35 -32
- data/lib/BioDSL/filesys.rb +56 -47
- data/lib/BioDSL/fork.rb +1 -1
- data/lib/BioDSL/hamming.rb +1 -1
- data/lib/BioDSL/helpers.rb +1 -1
- data/lib/BioDSL/helpers/aux_helper.rb +1 -1
- data/lib/BioDSL/helpers/email_helper.rb +1 -1
- data/lib/BioDSL/helpers/history_helper.rb +1 -1
- data/lib/BioDSL/helpers/log_helper.rb +1 -1
- data/lib/BioDSL/helpers/options_helper.rb +1 -1
- data/lib/BioDSL/helpers/status_helper.rb +1 -1
- data/lib/BioDSL/html_report.rb +1 -1
- data/lib/BioDSL/math.rb +1 -1
- data/lib/BioDSL/mummer.rb +1 -1
- data/lib/BioDSL/pipeline.rb +1 -1
- data/lib/BioDSL/seq.rb +240 -231
- data/lib/BioDSL/seq/ambiguity.rb +1 -1
- data/lib/BioDSL/seq/assemble.rb +1 -1
- data/lib/BioDSL/seq/backtrack.rb +93 -76
- data/lib/BioDSL/seq/digest.rb +1 -1
- data/lib/BioDSL/seq/dynamic.rb +43 -55
- data/lib/BioDSL/seq/homopolymer.rb +34 -36
- data/lib/BioDSL/seq/kmer.rb +67 -50
- data/lib/BioDSL/seq/levenshtein.rb +35 -40
- data/lib/BioDSL/seq/translate.rb +64 -55
- data/lib/BioDSL/seq/trim.rb +60 -50
- data/lib/BioDSL/serializer.rb +1 -1
- data/lib/BioDSL/stream.rb +1 -1
- data/lib/BioDSL/taxonomy.rb +1 -1
- data/lib/BioDSL/test.rb +1 -1
- data/lib/BioDSL/tmp_dir.rb +1 -1
- data/lib/BioDSL/usearch.rb +1 -1
- data/lib/BioDSL/verbose.rb +1 -1
- data/lib/BioDSL/version.rb +2 -2
- data/test/BioDSL/commands/test_add_key.rb +1 -1
- data/test/BioDSL/commands/test_align_seq_mothur.rb +1 -1
- data/test/BioDSL/commands/test_analyze_residue_distribution.rb +1 -1
- data/test/BioDSL/commands/test_assemble_pairs.rb +1 -1
- data/test/BioDSL/commands/test_assemble_seq_idba.rb +1 -1
- data/test/BioDSL/commands/test_assemble_seq_ray.rb +1 -1
- data/test/BioDSL/commands/test_assemble_seq_spades.rb +1 -1
- data/test/BioDSL/commands/test_classify_seq.rb +1 -1
- data/test/BioDSL/commands/test_classify_seq_mothur.rb +1 -1
- data/test/BioDSL/commands/test_clip_primer.rb +1 -1
- data/test/BioDSL/commands/test_cluster_otus.rb +1 -1
- data/test/BioDSL/commands/test_collapse_otus.rb +1 -1
- data/test/BioDSL/commands/test_collect_otus.rb +1 -1
- data/test/BioDSL/commands/test_complement_seq.rb +1 -1
- data/test/BioDSL/commands/test_count.rb +1 -1
- data/test/BioDSL/commands/test_count_values.rb +1 -1
- data/test/BioDSL/commands/test_degap_seq.rb +1 -1
- data/test/BioDSL/commands/test_dereplicate_seq.rb +1 -1
- data/test/BioDSL/commands/test_dump.rb +1 -1
- data/test/BioDSL/commands/test_filter_rrna.rb +1 -1
- data/test/BioDSL/commands/test_genecall.rb +1 -1
- data/test/BioDSL/commands/test_grab.rb +1 -1
- data/test/BioDSL/commands/test_index_taxonomy.rb +1 -1
- data/test/BioDSL/commands/test_mask_seq.rb +1 -1
- data/test/BioDSL/commands/test_mean_scores.rb +1 -1
- data/test/BioDSL/commands/test_merge_pair_seq.rb +1 -1
- data/test/BioDSL/commands/test_merge_table.rb +1 -1
- data/test/BioDSL/commands/test_merge_values.rb +1 -1
- data/test/BioDSL/commands/test_plot_heatmap.rb +1 -1
- data/test/BioDSL/commands/test_plot_histogram.rb +1 -1
- data/test/BioDSL/commands/test_plot_matches.rb +1 -1
- data/test/BioDSL/commands/test_plot_residue_distribution.rb +1 -1
- data/test/BioDSL/commands/test_plot_scores.rb +1 -1
- data/test/BioDSL/commands/test_random.rb +1 -1
- data/test/BioDSL/commands/test_read_fasta.rb +1 -1
- data/test/BioDSL/commands/test_read_fastq.rb +1 -1
- data/test/BioDSL/commands/test_read_table.rb +1 -1
- data/test/BioDSL/commands/test_reverse_seq.rb +1 -1
- data/test/BioDSL/commands/test_slice_align.rb +1 -1
- data/test/BioDSL/commands/test_slice_seq.rb +1 -1
- data/test/BioDSL/commands/test_sort.rb +1 -1
- data/test/BioDSL/commands/test_split_pair_seq.rb +1 -1
- data/test/BioDSL/commands/test_split_values.rb +1 -1
- data/test/BioDSL/commands/test_trim_primer.rb +1 -1
- data/test/BioDSL/commands/test_trim_seq.rb +1 -1
- data/test/BioDSL/commands/test_uchime_ref.rb +1 -1
- data/test/BioDSL/commands/test_uclust.rb +1 -1
- data/test/BioDSL/commands/test_unique_values.rb +1 -1
- data/test/BioDSL/commands/test_usearch_global.rb +1 -1
- data/test/BioDSL/commands/test_usearch_local.rb +1 -1
- data/test/BioDSL/commands/test_write_fasta.rb +1 -1
- data/test/BioDSL/commands/test_write_fastq.rb +1 -1
- data/test/BioDSL/commands/test_write_table.rb +1 -1
- data/test/BioDSL/commands/test_write_tree.rb +1 -1
- data/test/BioDSL/helpers/test_options_helper.rb +3 -3
- data/test/BioDSL/seq/test_assemble.rb +58 -56
- data/test/BioDSL/seq/test_backtrack.rb +83 -81
- data/test/BioDSL/seq/test_digest.rb +47 -45
- data/test/BioDSL/seq/test_dynamic.rb +66 -64
- data/test/BioDSL/seq/test_homopolymer.rb +35 -33
- data/test/BioDSL/seq/test_kmer.rb +29 -28
- data/test/BioDSL/seq/test_translate.rb +44 -42
- data/test/BioDSL/seq/test_trim.rb +59 -57
- data/test/BioDSL/test_cary.rb +1 -1
- data/test/BioDSL/test_command.rb +2 -2
- data/test/BioDSL/test_csv.rb +34 -31
- data/test/BioDSL/test_debug.rb +31 -31
- data/test/BioDSL/test_fasta.rb +30 -29
- data/test/BioDSL/test_fastq.rb +27 -26
- data/test/BioDSL/test_filesys.rb +28 -27
- data/test/BioDSL/test_fork.rb +29 -28
- data/test/BioDSL/test_math.rb +31 -30
- data/test/BioDSL/test_mummer.rb +1 -1
- data/test/BioDSL/test_pipeline.rb +1 -1
- data/test/BioDSL/test_seq.rb +42 -41
- data/test/BioDSL/test_serializer.rb +35 -33
- data/test/BioDSL/test_stream.rb +28 -27
- data/test/BioDSL/test_taxonomy.rb +38 -37
- data/test/BioDSL/test_test.rb +32 -31
- data/test/BioDSL/test_tmp_dir.rb +1 -1
- data/test/BioDSL/test_usearch.rb +28 -27
- data/test/BioDSL/test_verbose.rb +32 -31
- data/test/helper.rb +34 -31
- metadata +3 -2
data/test/BioDSL/test_mummer.rb
CHANGED
@@ -23,7 +23,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
|
23
23
|
# #
|
24
24
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
25
25
|
# #
|
26
|
-
# This software is part of BioDSL (
|
26
|
+
# This software is part of BioDSL (http://maasha.github.io/BioDSL). #
|
27
27
|
# #
|
28
28
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
29
|
|
@@ -23,7 +23,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
|
23
23
|
# #
|
24
24
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
25
25
|
# #
|
26
|
-
# This software is part of BioDSL (
|
26
|
+
# This software is part of BioDSL (http://maasha.github.io/BioDSL). #
|
27
27
|
# #
|
28
28
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
29
|
|
data/test/BioDSL/test_seq.rb
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
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
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
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 (http://maasha.github.io/BioDSL). #
|
28
|
+
# #
|
29
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
30
|
|
30
31
|
require 'test/helper'
|
31
32
|
|
32
|
-
class TestSeq < Test::Unit::TestCase
|
33
|
+
class TestSeq < Test::Unit::TestCase
|
33
34
|
def setup
|
34
35
|
@entry = BioDSL::Seq.new
|
35
36
|
end
|
@@ -116,31 +117,31 @@ class TestSeq < Test::Unit::TestCase
|
|
116
117
|
assert_nothing_raised { BioDSL::Seq.check_name_pair(entry1, entry2) }
|
117
118
|
end
|
118
119
|
|
119
|
-
test "#
|
120
|
-
assert(@entry.
|
120
|
+
test "#dna? with no sequence type returns false" do
|
121
|
+
assert(@entry.dna? == false)
|
121
122
|
end
|
122
123
|
|
123
|
-
test "#
|
124
|
+
test "#dna? with dna sequence type returns true" do
|
124
125
|
@entry.type = :dna
|
125
|
-
assert(@entry.
|
126
|
+
assert(@entry.dna? == true)
|
126
127
|
end
|
127
128
|
|
128
|
-
test "#
|
129
|
-
assert(@entry.
|
129
|
+
test "#rna? with no sequence type returns false" do
|
130
|
+
assert(@entry.rna? == false)
|
130
131
|
end
|
131
132
|
|
132
|
-
test "#
|
133
|
+
test "#rna? with rna sequence type returns true" do
|
133
134
|
@entry.type = :rna
|
134
|
-
assert(@entry.
|
135
|
+
assert(@entry.rna? == true)
|
135
136
|
end
|
136
137
|
|
137
|
-
test "#
|
138
|
-
assert(@entry.
|
138
|
+
test "#protein? with no sequence type returns false" do
|
139
|
+
assert(@entry.protein? == false)
|
139
140
|
end
|
140
141
|
|
141
|
-
test "#
|
142
|
+
test "#protein? with protein sequence type returns true" do
|
142
143
|
@entry.type = :protein
|
143
|
-
assert_equal(true, @entry.
|
144
|
+
assert_equal(true, @entry.protein?)
|
144
145
|
end
|
145
146
|
|
146
147
|
test "#type_guess without sequence raises" do
|
@@ -397,7 +398,7 @@ class TestSeq < Test::Unit::TestCase
|
|
397
398
|
end
|
398
399
|
|
399
400
|
test "#shuffle returns correctly" do
|
400
|
-
orig = "actgactgactgatcgatcgatcgatcgtactg"
|
401
|
+
orig = "actgactgactgatcgatcgatcgatcgtactg"
|
401
402
|
@entry.seq = "actgactgactgatcgatcgatcgatcgtactg"
|
402
403
|
entry_shuf = @entry.shuffle
|
403
404
|
assert_equal(orig, @entry.seq)
|
@@ -1,50 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
3
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
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
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 (http://maasha.github.io/BioDSL). #
|
28
|
+
# #
|
29
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
30
|
|
30
31
|
require 'test/helper'
|
31
32
|
|
32
|
-
|
33
|
+
# Test class for Serializer.
|
34
|
+
class TestSerializer < Test::Unit::TestCase
|
33
35
|
def setup
|
34
36
|
@records = [
|
35
|
-
{
|
36
|
-
{
|
37
|
+
{'foo' => 1},
|
38
|
+
{'bar' => 2}
|
37
39
|
]
|
38
40
|
end
|
39
41
|
|
40
|
-
test
|
41
|
-
assert_raise(BioDSL::SerializerError) { BioDSL::Serializer.new(
|
42
|
+
test 'BioDSL::Serializer with no block raises' do
|
43
|
+
assert_raise(BioDSL::SerializerError) { BioDSL::Serializer.new('foo') }
|
42
44
|
end
|
43
45
|
|
44
|
-
test
|
46
|
+
test 'BioDSL::Serializer returns correctly' do
|
45
47
|
require 'tempfile'
|
46
48
|
|
47
|
-
file = Tempfile.new(
|
49
|
+
file = Tempfile.new('serializer')
|
48
50
|
|
49
51
|
begin
|
50
52
|
File.open(file, 'wb') do |io|
|
data/test/BioDSL/test_stream.rb
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
3
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
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
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 (http://maasha.github.io/BioDSL). #
|
28
|
+
# #
|
29
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
30
|
|
30
31
|
require 'test/helper'
|
31
32
|
|
32
|
-
class TestStream < Test::Unit::TestCase
|
33
|
+
class TestStream < Test::Unit::TestCase
|
33
34
|
def setup
|
34
35
|
@obj = {foo: "bar"}
|
35
36
|
@reader, @writer = BioDSL::Stream.pipe
|
@@ -1,35 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
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
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
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 (http://maasha.github.io/BioDSL). #
|
28
|
+
# #
|
29
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
30
|
|
30
31
|
require 'test/helper'
|
31
32
|
|
32
|
-
class TestTaxonomy < Test::Unit::TestCase
|
33
|
+
class TestTaxonomy < Test::Unit::TestCase
|
33
34
|
def setup
|
34
35
|
@tmpdir = Dir.mktmpdir("Taxonomy")
|
35
36
|
|
@@ -40,7 +41,7 @@ class TestTaxonomy < Test::Unit::TestCase
|
|
40
41
|
@index2.add(BioDSL::Seq.new(seq_name: "K#b;P#f;C#;O#;F#;G#;S#", seq: "aagu"))
|
41
42
|
@index2.add(BioDSL::Seq.new(seq_name: "K#b;P#;C#;O#;F#;G#;S#", seq: "aag"))
|
42
43
|
@index2.add(BioDSL::Seq.new(seq_name: "K#b;P#e;C#g;O#;F#;G#;S#", seq: "aagag"))
|
43
|
-
|
44
|
+
|
44
45
|
@index3 = BioDSL::Taxonomy::Index.new(kmer_size: 3, step_size: 1, output_dir: @tmpdir, prefix: "test")
|
45
46
|
@index3.add(BioDSL::Seq.new(seq_name: "K#a;P#b;C#;O#;F#;G#;S#", seq: "aagc"))
|
46
47
|
@index3.add(BioDSL::Seq.new(seq_name: "K#a;P#c;C#d;O#;F#;G#;S#", seq: "aagag"))
|
@@ -103,7 +104,7 @@ class TestTaxonomy < Test::Unit::TestCase
|
|
103
104
|
assert_equal("e", @index.get_node(2).name)
|
104
105
|
assert_equal([], @index.get_node(0).kmers.to_a)
|
105
106
|
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
|
+
assert_equal([3, 12], @index.get_node(2).kmers.to_a) # aag=000011=3, aga=001100=12
|
107
108
|
end
|
108
109
|
|
109
110
|
test "BioDSL::Taxonomy::Index#add with edge split returns correctly" do
|
@@ -116,8 +117,8 @@ class TestTaxonomy < Test::Unit::TestCase
|
|
116
117
|
assert_equal("f", @index.get_node(3).name)
|
117
118
|
assert_equal([], @index.get_node(0).kmers.to_a)
|
118
119
|
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
|
120
|
+
assert_equal([3, 12], @index.get_node(2).kmers.to_a) # aag=000011=3, aga=001100=12
|
121
|
+
assert_equal([3, 13], @index.get_node(3).kmers.to_a) # aag=000011=3, agu=001101=13
|
121
122
|
end
|
122
123
|
|
123
124
|
test "BioDSL::Taxonomy::Index#add to existing non-leaf node returns correctly" do
|
@@ -131,8 +132,8 @@ class TestTaxonomy < Test::Unit::TestCase
|
|
131
132
|
assert_equal("f", @index.get_node(3).name)
|
132
133
|
assert_equal([], @index.get_node(0).kmers.to_a)
|
133
134
|
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
|
135
|
+
assert_equal([3, 12], @index.get_node(2).kmers.to_a) # aag=000011=3, aga=001100=12
|
136
|
+
assert_equal([3, 13], @index.get_node(3).kmers.to_a) # aag=000011=3, agu=001101=13
|
136
137
|
end
|
137
138
|
|
138
139
|
test "BioDSL::Taxonomy::Index#add exteding existing leaf node returns correctly" do
|
@@ -148,9 +149,9 @@ class TestTaxonomy < Test::Unit::TestCase
|
|
148
149
|
assert_equal("g", @index.get_node(4).name)
|
149
150
|
assert_equal([], @index.get_node(0).kmers.to_a.sort)
|
150
151
|
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
|
152
|
+
assert_equal([3, 12], @index.get_node(2).kmers.to_a.sort) # aag=000011=3, aga=001100=12
|
153
|
+
assert_equal([3, 13], @index.get_node(3).kmers.to_a.sort) # aag=000011=3, agu=001101=13
|
154
|
+
assert_equal([3, 12, 51], @index.get_node(4).kmers.to_a.sort) # aag=000011=3, aga=001101=12, gag=110011=51
|
154
155
|
end
|
155
156
|
|
156
157
|
test "BioDSL::Taxonomy::Index#tree_union returns correctly" do
|
data/test/BioDSL/test_test.rb
CHANGED
@@ -1,42 +1,43 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
3
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
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
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 (http://maasha.github.io/BioDSL). #
|
28
|
+
# #
|
29
|
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
29
30
|
|
30
31
|
require 'test/helper'
|
31
32
|
|
33
|
+
# Test class for Test.
|
32
34
|
class TestTest < Test::Unit::TestCase
|
33
35
|
def teardown
|
34
|
-
BioDSL
|
36
|
+
BioDSL.test = false
|
35
37
|
end
|
36
38
|
|
37
|
-
test
|
38
|
-
BioDSL
|
39
|
-
assert_equal(true, BioDSL
|
39
|
+
test 'BioDSL::test returns correctly' do
|
40
|
+
BioDSL.test = true
|
41
|
+
assert_equal(true, BioDSL.test)
|
40
42
|
end
|
41
43
|
end
|
42
|
-
|