BioDSL 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,56 +1,58 @@
|
|
|
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 Homopolymer.
|
|
34
|
+
class TestHomopolymer < Test::Unit::TestCase
|
|
33
35
|
def setup
|
|
34
|
-
@entry = BioDSL::Seq.new(seq:
|
|
36
|
+
@entry = BioDSL::Seq.new(seq: 'atcgatTTTTTTcggttga')
|
|
35
37
|
end
|
|
36
38
|
|
|
37
|
-
test
|
|
39
|
+
test '#each_homopolymer with bad min raises' do
|
|
38
40
|
assert_raise(BioDSL::HomopolymerError) { @entry.each_homopolymer(0) }
|
|
39
41
|
assert_raise(BioDSL::HomopolymerError) { @entry.each_homopolymer(-1) }
|
|
40
42
|
end
|
|
41
43
|
|
|
42
|
-
test
|
|
44
|
+
test '#each_homopolymer returns correctly' do
|
|
43
45
|
hps = @entry.each_homopolymer(3)
|
|
44
46
|
assert_equal(1, hps.size)
|
|
45
47
|
assert_equal(7, hps.first.length)
|
|
46
|
-
assert_equal(
|
|
48
|
+
assert_equal('TTTTTTT', hps.first.pattern)
|
|
47
49
|
assert_equal(5, hps.first.pos)
|
|
48
50
|
end
|
|
49
51
|
|
|
50
|
-
test
|
|
52
|
+
test '#each_homopolymer in block context returns correctly' do
|
|
51
53
|
@entry.each_homopolymer(3) do |hp|
|
|
52
54
|
assert_equal(7, hp.length)
|
|
53
|
-
assert_equal(
|
|
55
|
+
assert_equal('TTTTTTT', hp.pattern)
|
|
54
56
|
assert_equal(5, hp.pos)
|
|
55
57
|
break
|
|
56
58
|
end
|
|
@@ -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 TestKmer < Test::Unit::TestCase
|
|
33
|
+
class TestKmer < Test::Unit::TestCase
|
|
33
34
|
def setup
|
|
34
35
|
@entry = BioDSL::Seq.new(seq: "aNacCGactGAtacACGTAC")
|
|
35
36
|
end
|
|
@@ -1,75 +1,77 @@
|
|
|
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 Translate.
|
|
34
|
+
class TestTranslate < Test::Unit::TestCase
|
|
33
35
|
def setup
|
|
34
|
-
@entry = BioDSL::Seq.new(seq:
|
|
36
|
+
@entry = BioDSL::Seq.new(seq: 'atcgatcgatcgtacggttga', type: :dna)
|
|
35
37
|
end
|
|
36
38
|
|
|
37
|
-
test
|
|
39
|
+
test '#tranlate with bad type raises' do
|
|
38
40
|
@entry.type = nil
|
|
39
41
|
assert_raise(BioDSL::SeqError) { @entry.translate }
|
|
40
42
|
end
|
|
41
43
|
|
|
42
|
-
test
|
|
43
|
-
@entry.seq =
|
|
44
|
+
test '#tranlate with bad length raises' do
|
|
45
|
+
@entry.seq = 'atcgatcgatcgtacggtga'
|
|
44
46
|
assert_raise(BioDSL::SeqError) { @entry.translate }
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
test
|
|
48
|
-
@entry.seq =
|
|
49
|
+
test '#tranlate with bad translation table raises' do
|
|
50
|
+
@entry.seq = 'atcgatcgatcgtacggttga'
|
|
49
51
|
assert_raise(BioDSL::SeqError) { @entry.translate(0) }
|
|
50
52
|
end
|
|
51
53
|
|
|
52
|
-
test
|
|
53
|
-
@entry.seq =
|
|
54
|
+
test '#tranlate with bad start codon raises' do
|
|
55
|
+
@entry.seq = 'ttagatcgatcgtacggttga'
|
|
54
56
|
assert_raise(BioDSL::SeqError) { @entry.translate }
|
|
55
57
|
end
|
|
56
58
|
|
|
57
|
-
test
|
|
58
|
-
@entry.seq =
|
|
59
|
+
test '#tranlate with bad codon raises' do
|
|
60
|
+
@entry.seq = 'atggatcgaxxxtcgtacggttga'
|
|
59
61
|
assert_raise(BioDSL::SeqError) { @entry.translate }
|
|
60
62
|
end
|
|
61
63
|
|
|
62
|
-
test
|
|
64
|
+
test '#tranlate returns correctly' do
|
|
63
65
|
entry = @entry.translate
|
|
64
|
-
assert_equal(
|
|
66
|
+
assert_equal('MDRSYG', entry.seq)
|
|
65
67
|
assert_equal(:protein, entry.type)
|
|
66
|
-
assert_equal(
|
|
68
|
+
assert_equal('atcgatcgatcgtacggttga', @entry.seq)
|
|
67
69
|
assert_equal(:dna, @entry.type)
|
|
68
70
|
end
|
|
69
71
|
|
|
70
|
-
test
|
|
72
|
+
test '#tranlate! returns correctly' do
|
|
71
73
|
@entry.translate!
|
|
72
|
-
assert_equal(
|
|
74
|
+
assert_equal('MDRSYG', @entry.seq)
|
|
73
75
|
assert_equal(:protein, @entry.type)
|
|
74
76
|
end
|
|
75
77
|
end
|
|
@@ -1,101 +1,103 @@
|
|
|
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 Trim.
|
|
34
|
+
class TestTrim < Test::Unit::TestCase
|
|
33
35
|
def setup
|
|
34
36
|
@entry = BioDSL::Seq.new
|
|
35
37
|
# 2 3 44 3 2
|
|
36
38
|
# 8901234567890123456789009876543210987654321098
|
|
37
|
-
@entry.qual =
|
|
38
|
-
@entry.seq =
|
|
39
|
+
@entry.qual = '3456789:;<=>?@3BCDEFGHIIHGFEDCB3@?>=<;:9876543'
|
|
40
|
+
@entry.seq = 'abcdefghijklmnopqrstuvxxvutsrqponmlkjihgfedcba'
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
test
|
|
43
|
+
test '#quality_trim with nil seq raises' do
|
|
42
44
|
@entry.seq = nil
|
|
43
45
|
assert_raise(BioDSL::TrimError) { @entry.quality_trim(20, 1) }
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
test
|
|
48
|
+
test '#quality_trim with nil qual raises' do
|
|
47
49
|
@entry.qual = nil
|
|
48
50
|
assert_raise(BioDSL::TrimError) { @entry.quality_trim(20, 1) }
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
test
|
|
53
|
+
test '#quality_trim with bad min_qual raises' do
|
|
52
54
|
assert_raise(BioDSL::TrimError) { @entry.quality_trim(-1, 1) }
|
|
53
55
|
assert_raise(BioDSL::TrimError) { @entry.quality_trim(41, 1) }
|
|
54
56
|
end
|
|
55
57
|
|
|
56
|
-
test
|
|
58
|
+
test '#quality_trim with bad min_len raises' do
|
|
57
59
|
assert_raise(BioDSL::TrimError) { @entry.quality_trim(20, 0) }
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
test
|
|
62
|
+
test '#quality_trim returns correctly' do
|
|
61
63
|
trimmed = @entry.quality_trim(30, 3)
|
|
62
|
-
assert_equal(
|
|
63
|
-
assert_equal(
|
|
64
|
-
assert_equal(
|
|
65
|
-
assert_equal(
|
|
64
|
+
assert_equal('pqrstuvxxvutsrqp', trimmed.seq)
|
|
65
|
+
assert_equal('BCDEFGHIIHGFEDCB', trimmed.qual)
|
|
66
|
+
assert_equal('abcdefghijklmnopqrstuvxxvutsrqponmlkjihgfedcba', @entry.seq)
|
|
67
|
+
assert_equal('3456789:;<=>?@3BCDEFGHIIHGFEDCB3@?>=<;:9876543', @entry.qual)
|
|
66
68
|
end
|
|
67
69
|
|
|
68
|
-
test
|
|
70
|
+
test '#quality_trim! returns correctly' do
|
|
69
71
|
@entry.quality_trim!(30, 3)
|
|
70
|
-
assert_equal(
|
|
71
|
-
assert_equal(
|
|
72
|
+
assert_equal('pqrstuvxxvutsrqp', @entry.seq)
|
|
73
|
+
assert_equal('BCDEFGHIIHGFEDCB', @entry.qual)
|
|
72
74
|
end
|
|
73
75
|
|
|
74
|
-
test
|
|
76
|
+
test '#quality_trim_left returns correctly' do
|
|
75
77
|
trimmed = @entry.quality_trim_left(30, 3)
|
|
76
|
-
assert_equal(
|
|
77
|
-
assert_equal(
|
|
78
|
-
assert_equal(
|
|
79
|
-
assert_equal(
|
|
78
|
+
assert_equal('pqrstuvxxvutsrqponmlkjihgfedcba', trimmed.seq)
|
|
79
|
+
assert_equal('BCDEFGHIIHGFEDCB3@?>=<;:9876543', trimmed.qual)
|
|
80
|
+
assert_equal('abcdefghijklmnopqrstuvxxvutsrqponmlkjihgfedcba', @entry.seq)
|
|
81
|
+
assert_equal('3456789:;<=>?@3BCDEFGHIIHGFEDCB3@?>=<;:9876543', @entry.qual)
|
|
80
82
|
end
|
|
81
83
|
|
|
82
|
-
test
|
|
84
|
+
test '#quality_trim_left! returns correctly' do
|
|
83
85
|
@entry.quality_trim_left!(30, 3)
|
|
84
|
-
assert_equal(
|
|
85
|
-
assert_equal(
|
|
86
|
+
assert_equal('pqrstuvxxvutsrqponmlkjihgfedcba', @entry.seq)
|
|
87
|
+
assert_equal('BCDEFGHIIHGFEDCB3@?>=<;:9876543', @entry.qual)
|
|
86
88
|
end
|
|
87
89
|
|
|
88
|
-
test
|
|
90
|
+
test '#quality_trim_rigth returns correctly' do
|
|
89
91
|
trimmed = @entry.quality_trim_right(30, 3)
|
|
90
|
-
assert_equal(
|
|
91
|
-
assert_equal(
|
|
92
|
-
assert_equal(
|
|
93
|
-
assert_equal(
|
|
92
|
+
assert_equal('abcdefghijklmnopqrstuvxxvutsrqpo', trimmed.seq)
|
|
93
|
+
assert_equal('3456789:;<=>?@3BCDEFGHIIHGFEDCB3', trimmed.qual)
|
|
94
|
+
assert_equal('abcdefghijklmnopqrstuvxxvutsrqponmlkjihgfedcba', @entry.seq)
|
|
95
|
+
assert_equal('3456789:;<=>?@3BCDEFGHIIHGFEDCB3@?>=<;:9876543', @entry.qual)
|
|
94
96
|
end
|
|
95
97
|
|
|
96
|
-
test
|
|
98
|
+
test '#quality_trim_right! returns correctly' do
|
|
97
99
|
@entry.quality_trim_right!(30, 3)
|
|
98
|
-
assert_equal(
|
|
99
|
-
assert_equal(
|
|
100
|
+
assert_equal('abcdefghijklmnopqrstuvxxvutsrqpo', @entry.seq)
|
|
101
|
+
assert_equal('3456789:;<=>?@3BCDEFGHIIHGFEDCB3', @entry.qual)
|
|
100
102
|
end
|
|
101
103
|
end
|
data/test/BioDSL/test_cary.rb
CHANGED
|
@@ -24,7 +24,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
|
|
24
24
|
# #
|
|
25
25
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
|
26
26
|
# #
|
|
27
|
-
# This software is part of BioDSL (
|
|
27
|
+
# This software is part of BioDSL (http://maasha.github.io/BioDSL). #
|
|
28
28
|
# #
|
|
29
29
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #
|
|
30
30
|
|
data/test/BioDSL/test_command.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
|
|
|
@@ -33,7 +33,7 @@ require 'test/helper'
|
|
|
33
33
|
class CommandTest < Test::Unit::TestCase
|
|
34
34
|
test 'BioDSL::Command#to_s w/o options returns OK' do
|
|
35
35
|
command = BioDSL::Command.new('dump', nil, {})
|
|
36
|
-
expected = %
|
|
36
|
+
expected = %(dump)
|
|
37
37
|
assert_equal(expected, command.to_s)
|
|
38
38
|
end
|
|
39
39
|
|