bio 0.7.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bioruby +71 -27
- data/bin/br_biofetch.rb +5 -17
- data/bin/br_bioflat.rb +14 -26
- data/bin/br_biogetseq.rb +6 -18
- data/bin/br_pmfetch.rb +6 -16
- data/doc/Changes-0.7.rd +35 -0
- data/doc/KEGG_API.rd +287 -172
- data/doc/KEGG_API.rd.ja +273 -160
- data/doc/Tutorial.rd +18 -9
- data/doc/Tutorial.rd.ja +656 -138
- data/lib/bio.rb +6 -24
- data/lib/bio/alignment.rb +5 -5
- data/lib/bio/appl/blast.rb +132 -98
- data/lib/bio/appl/blast/format0.rb +9 -19
- data/lib/bio/appl/blast/wublast.rb +5 -18
- data/lib/bio/appl/emboss.rb +40 -47
- data/lib/bio/appl/hmmer.rb +116 -82
- data/lib/bio/appl/hmmer/report.rb +509 -364
- data/lib/bio/appl/spidey/report.rb +7 -18
- data/lib/bio/data/na.rb +3 -21
- data/lib/bio/db.rb +3 -21
- data/lib/bio/db/aaindex.rb +147 -52
- data/lib/bio/db/embl/common.rb +27 -6
- data/lib/bio/db/embl/embl.rb +18 -10
- data/lib/bio/db/embl/sptr.rb +87 -67
- data/lib/bio/db/embl/swissprot.rb +32 -3
- data/lib/bio/db/embl/trembl.rb +32 -3
- data/lib/bio/db/embl/uniprot.rb +32 -3
- data/lib/bio/db/fasta.rb +327 -289
- data/lib/bio/db/medline.rb +25 -4
- data/lib/bio/db/nbrf.rb +12 -20
- data/lib/bio/db/pdb.rb +4 -1
- data/lib/bio/db/pdb/chemicalcomponent.rb +240 -0
- data/lib/bio/db/pdb/pdb.rb +13 -8
- data/lib/bio/db/rebase.rb +93 -97
- data/lib/bio/feature.rb +2 -31
- data/lib/bio/io/ddbjxml.rb +167 -139
- data/lib/bio/io/fastacmd.rb +89 -56
- data/lib/bio/io/flatfile.rb +994 -278
- data/lib/bio/io/flatfile/index.rb +257 -194
- data/lib/bio/io/flatfile/indexer.rb +37 -29
- data/lib/bio/reference.rb +147 -64
- data/lib/bio/sequence.rb +57 -417
- data/lib/bio/sequence/aa.rb +64 -0
- data/lib/bio/sequence/common.rb +175 -0
- data/lib/bio/sequence/compat.rb +68 -0
- data/lib/bio/sequence/format.rb +134 -0
- data/lib/bio/sequence/generic.rb +24 -0
- data/lib/bio/sequence/na.rb +189 -0
- data/lib/bio/shell.rb +9 -23
- data/lib/bio/shell/core.rb +130 -125
- data/lib/bio/shell/demo.rb +143 -0
- data/lib/bio/shell/{session.rb → interface.rb} +42 -40
- data/lib/bio/shell/object.rb +52 -0
- data/lib/bio/shell/plugin/codon.rb +4 -22
- data/lib/bio/shell/plugin/emboss.rb +23 -0
- data/lib/bio/shell/plugin/entry.rb +34 -25
- data/lib/bio/shell/plugin/flatfile.rb +5 -23
- data/lib/bio/shell/plugin/keggapi.rb +11 -24
- data/lib/bio/shell/plugin/midi.rb +5 -23
- data/lib/bio/shell/plugin/obda.rb +4 -22
- data/lib/bio/shell/plugin/seq.rb +6 -24
- data/lib/bio/shell/rails/Rakefile +10 -0
- data/lib/bio/shell/rails/app/controllers/application.rb +4 -0
- data/lib/bio/shell/rails/app/controllers/shell_controller.rb +94 -0
- data/lib/bio/shell/rails/app/helpers/application_helper.rb +3 -0
- data/lib/bio/shell/rails/app/models/shell_connection.rb +30 -0
- data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +37 -0
- data/lib/bio/shell/rails/app/views/shell/history.rhtml +5 -0
- data/lib/bio/shell/rails/app/views/shell/index.rhtml +2 -0
- data/lib/bio/shell/rails/app/views/shell/show.rhtml +13 -0
- data/lib/bio/shell/rails/config/boot.rb +19 -0
- data/lib/bio/shell/rails/config/database.yml +85 -0
- data/lib/bio/shell/rails/config/environment.rb +53 -0
- data/lib/bio/shell/rails/config/environments/development.rb +19 -0
- data/lib/bio/shell/rails/config/environments/production.rb +19 -0
- data/lib/bio/shell/rails/config/environments/test.rb +19 -0
- data/lib/bio/shell/rails/config/routes.rb +19 -0
- data/lib/bio/shell/rails/doc/README_FOR_APP +2 -0
- data/lib/bio/shell/rails/public/404.html +8 -0
- data/lib/bio/shell/rails/public/500.html +8 -0
- data/lib/bio/shell/rails/public/dispatch.cgi +10 -0
- data/lib/bio/shell/rails/public/dispatch.fcgi +24 -0
- data/lib/bio/shell/rails/public/dispatch.rb +10 -0
- data/lib/bio/shell/rails/public/favicon.ico +0 -0
- data/lib/bio/shell/rails/public/images/icon.png +0 -0
- data/lib/bio/shell/rails/public/images/rails.png +0 -0
- data/lib/bio/shell/rails/public/index.html +277 -0
- data/lib/bio/shell/rails/public/javascripts/controls.js +750 -0
- data/lib/bio/shell/rails/public/javascripts/dragdrop.js +584 -0
- data/lib/bio/shell/rails/public/javascripts/effects.js +854 -0
- data/lib/bio/shell/rails/public/javascripts/prototype.js +1785 -0
- data/lib/bio/shell/rails/public/robots.txt +1 -0
- data/lib/bio/shell/rails/public/stylesheets/main.css +187 -0
- data/lib/bio/shell/rails/script/about +3 -0
- data/lib/bio/shell/rails/script/breakpointer +3 -0
- data/lib/bio/shell/rails/script/console +3 -0
- data/lib/bio/shell/rails/script/destroy +3 -0
- data/lib/bio/shell/rails/script/generate +3 -0
- data/lib/bio/shell/rails/script/performance/benchmarker +3 -0
- data/lib/bio/shell/rails/script/performance/profiler +3 -0
- data/lib/bio/shell/rails/script/plugin +3 -0
- data/lib/bio/shell/rails/script/process/reaper +3 -0
- data/lib/bio/shell/rails/script/process/spawner +3 -0
- data/lib/bio/shell/rails/script/process/spinner +3 -0
- data/lib/bio/shell/rails/script/runner +3 -0
- data/lib/bio/shell/rails/script/server +42 -0
- data/lib/bio/shell/rails/test/test_helper.rb +28 -0
- data/lib/bio/shell/web.rb +90 -0
- data/lib/bio/util/contingency_table.rb +231 -225
- data/sample/any2fasta.rb +59 -0
- data/test/data/HMMER/hmmpfam.out +64 -0
- data/test/data/HMMER/hmmsearch.out +88 -0
- data/test/data/aaindex/DAYM780301 +30 -0
- data/test/data/aaindex/PRAM900102 +20 -0
- data/test/data/bl2seq/cd8a_cd8b_blastp.bl2seq +53 -0
- data/test/data/bl2seq/cd8a_p53_e-5blastp.bl2seq +37 -0
- data/test/data/blast/{eco:b0002.faa → b0002.faa} +0 -0
- data/test/data/blast/{eco:b0002.faa.m0 → b0002.faa.m0} +2 -2
- data/test/data/blast/{eco:b0002.faa.m7 → b0002.faa.m7} +1 -1
- data/test/data/blast/{eco:b0002.faa.m8 → b0002.faa.m8} +0 -0
- data/test/unit/bio/appl/bl2seq/test_report.rb +134 -0
- data/test/unit/bio/appl/blast/test_report.rb +15 -12
- data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -4
- data/test/unit/bio/appl/hmmer/test_report.rb +355 -0
- data/test/unit/bio/appl/test_blast.rb +5 -5
- data/test/unit/bio/data/test_na.rb +9 -18
- data/test/unit/bio/db/pdb/test_pdb.rb +169 -0
- data/test/unit/bio/db/test_aaindex.rb +197 -0
- data/test/unit/bio/io/test_fastacmd.rb +55 -0
- data/test/unit/bio/sequence/test_aa.rb +102 -0
- data/test/unit/bio/sequence/test_common.rb +178 -0
- data/test/unit/bio/sequence/test_compat.rb +82 -0
- data/test/unit/bio/sequence/test_na.rb +242 -0
- data/test/unit/bio/shell/plugin/test_seq.rb +29 -19
- data/test/unit/bio/test_alignment.rb +15 -7
- data/test/unit/bio/test_reference.rb +198 -0
- data/test/unit/bio/test_sequence.rb +4 -49
- data/test/unit/bio/test_shell.rb +2 -2
- metadata +118 -15
- data/lib/bio/io/brdb.rb +0 -103
- data/lib/bioruby.rb +0 -34
@@ -17,7 +17,7 @@
|
|
17
17
|
# License along with this library; if not, write to the Free Software
|
18
18
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
19
|
#
|
20
|
-
# $Id: test_blast.rb,v 1.
|
20
|
+
# $Id: test_blast.rb,v 1.3 2006/02/03 17:39:13 nakao Exp $
|
21
21
|
#
|
22
22
|
|
23
23
|
require 'pathname'
|
@@ -34,17 +34,17 @@ module Bio
|
|
34
34
|
TestDataBlast = Pathname.new(File.join(bioruby_root, 'test', 'data', 'blast')).cleanpath.to_s
|
35
35
|
|
36
36
|
def self.input
|
37
|
-
File.open(File.join(TestDataBlast, '
|
37
|
+
File.open(File.join(TestDataBlast, 'b0002.faa')).read
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.output(format = '7')
|
41
41
|
case format
|
42
42
|
when '0'
|
43
|
-
File.open(File.join(TestDataBlast, '
|
43
|
+
File.open(File.join(TestDataBlast, 'b0002.faa.m0')).read
|
44
44
|
when '7'
|
45
|
-
File.open(File.join(TestDataBlast, '
|
45
|
+
File.open(File.join(TestDataBlast, 'b0002.faa.m7')).read
|
46
46
|
when '8'
|
47
|
-
File.open(File.join(TestDataBlast, '
|
47
|
+
File.open(File.join(TestDataBlast, 'b0002.faa.m8')).read
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -1,23 +1,10 @@
|
|
1
1
|
#
|
2
2
|
# test/unit/bio/data/test_na.rb - Unit test for Bio::NucleicAcid
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# Copyright:: Copyright (C) 2005,2006 Mitsuteru Nakao <n@bioruby.org>
|
5
|
+
# Lisence:: Ruby's
|
5
6
|
#
|
6
|
-
#
|
7
|
-
# modify it under the terms of the GNU Lesser General Public
|
8
|
-
# License as published by the Free Software Foundation; either
|
9
|
-
# version 2 of the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This library is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this library; if not, write to the Free Software
|
18
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
-
#
|
20
|
-
# $Id: test_na.rb,v 1.5 2005/11/25 15:59:29 k Exp $
|
7
|
+
# $Id: test_na.rb,v 1.6 2006/02/08 13:57:01 nakao Exp $
|
21
8
|
#
|
22
9
|
|
23
10
|
require 'pathname'
|
@@ -47,14 +34,18 @@ module Bio
|
|
47
34
|
|
48
35
|
|
49
36
|
class TestNA < Test::Unit::TestCase
|
37
|
+
|
50
38
|
def setup
|
51
39
|
@obj = Bio::NucleicAcid.new
|
52
40
|
end
|
53
41
|
|
54
42
|
def test_to_re
|
55
43
|
re = /[tc][ag][at][gc][tg][ac][tgc][atg][agc][atgc]atgc/
|
56
|
-
|
57
|
-
|
44
|
+
str = 'yrwskmbdvnatgc'
|
45
|
+
str0 = str.clone
|
46
|
+
assert_equal(re, @obj.to_re(str))
|
47
|
+
assert_equal(str0, str)
|
48
|
+
assert_equal(re, Bio::NucleicAcid.to_re(str))
|
58
49
|
end
|
59
50
|
|
60
51
|
|
@@ -0,0 +1,169 @@
|
|
1
|
+
#
|
2
|
+
# = test/unit/bio/db/pdb/test_pdb.rb - Unit test for Bio::PDB classes
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2006
|
5
|
+
# Naohisa Goto <ng@bioruby.org>
|
6
|
+
#
|
7
|
+
# License:: LGPL
|
8
|
+
#
|
9
|
+
# $Id: test_pdb.rb,v 1.1 2006/01/26 16:06:03 ngoto Exp $
|
10
|
+
#
|
11
|
+
#--
|
12
|
+
# This library is free software; you can redistribute it and/or
|
13
|
+
# modify it under the terms of the GNU Lesser General Public
|
14
|
+
# License as published by the Free Software Foundation; either
|
15
|
+
# version 2 of the License, or (at your option) any later version.
|
16
|
+
#
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
20
|
+
# Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public
|
23
|
+
# License along with this library; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
25
|
+
#++
|
26
|
+
#
|
27
|
+
#
|
28
|
+
|
29
|
+
require 'pathname'
|
30
|
+
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
|
31
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
32
|
+
|
33
|
+
require 'test/unit'
|
34
|
+
require 'bio'
|
35
|
+
|
36
|
+
module Bio
|
37
|
+
#class TestPDB < Test::Unit::TestCase
|
38
|
+
#end #class TestPDB
|
39
|
+
|
40
|
+
module TestPDBRecord
|
41
|
+
|
42
|
+
# test of Bio::PDB::Record::ATOM
|
43
|
+
class TestATOM < Test::Unit::TestCase
|
44
|
+
def setup
|
45
|
+
# the data is taken from
|
46
|
+
# http://www.rcsb.org/pdb/file_formats/pdb/pdbguide2.2/part_62.html
|
47
|
+
@str = 'ATOM 154 CG2BVAL A 25 29.909 16.996 55.922 0.72 13.25 A1 C '
|
48
|
+
@atom = Bio::PDB::Record::ATOM.new.initialize_from_string(@str)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_record_name
|
52
|
+
assert_equal('ATOM', @atom.record_name)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_serial
|
56
|
+
assert_equal(154, @atom.serial)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_name
|
60
|
+
assert_equal(' CG2', @atom.name)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_altLoc
|
64
|
+
assert_equal('B', @atom.altLoc)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_resName
|
68
|
+
assert_equal('VAL', @atom.resName)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_chainID
|
72
|
+
assert_equal('A', @atom.chainID)
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_resSeq
|
76
|
+
assert_equal(25, @atom.resSeq)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_iCode
|
80
|
+
assert_equal(' ', @atom.iCode)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_x
|
84
|
+
assert_in_delta(29.909, @atom.x, Float::EPSILON)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_y
|
88
|
+
assert_in_delta(16.996, @atom.y, Float::EPSILON)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_z
|
92
|
+
assert_in_delta(55.922, @atom.z, Float::EPSILON)
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_occupancy
|
96
|
+
assert_in_delta(0.72, @atom.occupancy, Float::EPSILON)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_tempFactor
|
100
|
+
assert_in_delta(13.25, @atom.tempFactor, Float::EPSILON)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_segID
|
104
|
+
assert_equal('A1 ', @atom.segID)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_element
|
108
|
+
assert_equal(' C', @atom.element)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_charge
|
112
|
+
assert_equal(' ', @atom.charge)
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_xyz
|
116
|
+
assert_equal(Bio::PDB::Coordinate[
|
117
|
+
"29.909".to_f,
|
118
|
+
"16.996".to_f,
|
119
|
+
"55.922".to_f ], @atom.xyz)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_to_a
|
123
|
+
assert_equal([ "29.909".to_f,
|
124
|
+
"16.996".to_f,
|
125
|
+
"55.922".to_f ], @atom.to_a)
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_comparable
|
129
|
+
a = Bio::PDB::Record::ATOM.new
|
130
|
+
a.serial = 999
|
131
|
+
assert_equal(-1, @atom <=> a)
|
132
|
+
a.serial = 154
|
133
|
+
assert_equal( 0, @atom <=> a)
|
134
|
+
a.serial = 111
|
135
|
+
assert_equal( 1, @atom <=> a)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_to_s
|
139
|
+
assert_equal(@str + "\n", @atom.to_s)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_original_data
|
143
|
+
assert_equal([ @str ], @atom.original_data)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_do_parse
|
147
|
+
assert_equal(@atom, @atom.do_parse)
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_residue
|
151
|
+
assert_equal(nil, @atom.residue)
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_sigatm
|
155
|
+
assert_equal(nil, @atom.sigatm)
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_anisou
|
159
|
+
assert_equal(nil, @atom.anisou)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_ter
|
163
|
+
assert_equal(nil, @atom.ter)
|
164
|
+
end
|
165
|
+
end #class TestATOM
|
166
|
+
|
167
|
+
end #module TestPDBRecord
|
168
|
+
|
169
|
+
end #module Bio
|
@@ -0,0 +1,197 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/db/test_aaindex.rb - Unit test for Bio::AAindex
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2006
|
5
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
6
|
+
# License:: Ruby's
|
7
|
+
#
|
8
|
+
# $Id: test_aaindex.rb,v 1.3 2006/02/22 07:35:19 nakao Exp $
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'pathname'
|
12
|
+
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
|
13
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
14
|
+
|
15
|
+
require 'test/unit'
|
16
|
+
require 'bio/io/fetch'
|
17
|
+
require 'bio/db/aaindex'
|
18
|
+
|
19
|
+
module Bio
|
20
|
+
class DataAAindex
|
21
|
+
bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4)).cleanpath.to_s
|
22
|
+
TestDataAAindex = Pathname.new(File.join(bioruby_root, 'test', 'data', 'aaindex')).cleanpath.to_s
|
23
|
+
|
24
|
+
def self.aax1
|
25
|
+
File.read(File.join(TestDataAAindex, "PRAM900102"))
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.aax2
|
29
|
+
File.read(File.join(TestDataAAindex, "DAYM780301"))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# A super class for Bio::AAindex1 and Bio::AAindex2
|
34
|
+
class TestAAindexConstant < Test::Unit::TestCase
|
35
|
+
def test_delimiter
|
36
|
+
rs = "\n//\n"
|
37
|
+
assert_equal(rs, Bio::AAindex::DELIMITER)
|
38
|
+
assert_equal(rs, Bio::AAindex::RS)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_tagsize
|
42
|
+
assert_equal(2, Bio::AAindex::TAGSIZE)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class TestAAindex < Test::Unit::TestCase
|
47
|
+
def test_api
|
48
|
+
api_methods = ['entry_id', 'definition', 'dblinks', 'author',
|
49
|
+
'title', 'journal', 'comment']
|
50
|
+
api_methods.each do |m|
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_auto_aax1
|
55
|
+
assert_equal(Bio::AAindex1, Bio::AAindex.auto(DataAAindex.aax1).class)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_auto_aax2
|
59
|
+
assert_equal(Bio::AAindex2, Bio::AAindex.auto(DataAAindex.aax2).class)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class TestAAindex1 < Test::Unit::TestCase
|
64
|
+
def setup
|
65
|
+
str = DataAAindex.aax1
|
66
|
+
@obj = Bio::AAindex1.new(str)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_entry_id
|
70
|
+
assert_equal('PRAM900102', @obj.entry_id)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_definition
|
74
|
+
assert_equal('Relative frequency in alpha-helix (Prabhakaran, 1990)', @obj.definition)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_dblinks
|
78
|
+
assert_equal(['LIT:1614053b', 'PMID:2390062'], @obj.dblinks)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_author
|
82
|
+
assert_equal('Prabhakaran, M.', @obj.author)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_title
|
86
|
+
assert_equal('The distribution of physical, chemical and conformational properties in signal and nascent peptides', @obj.title)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_journal
|
90
|
+
assert_equal('Biochem. J. 269, 691-696 (1990) Original reference of these three data: Creighton, T.E. In "Protein Structure and Melecular Properties", (Freeman, W.H., ed.), San Francisco P.235 (1983)', @obj.journal)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_comment
|
94
|
+
assert_equal("", @obj.comment)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_correlation_coefficient
|
98
|
+
# str = "LEVM780101 1.000 LEVM780104 0.964 PALJ810101 0.943 KANM800101 0.942 ISOY800101 0.929 MAXF760101 0.924 ROBB760101 0.916 GEIM800101 0.912 GEIM800104 0.907 RACS820108 0.904 PALJ810102 0.902 PALJ810109 0.898 NAGK730101 0.894 CRAJ730101 0.887 CHOP780201 0.873 TANS770101 0.854 KANM800103 0.850 QIAN880107 0.829 QIAN880106 0.827 BURA740101 0.805 NAGK730103 -0.809"
|
99
|
+
# assert_equal(str, @obj.correlation_coefficient)
|
100
|
+
# to be this ?
|
101
|
+
hash = {'LEVM780101' => 1.000, 'LEVM780104' => 0.964, 'PALJ810101' => 0.943, 'KANM800101' => 0.942, 'ISOY800101' => 0.929, 'MAXF760101' => 0.924, 'ROBB760101' => 0.916, 'GEIM800101' => 0.912, 'GEIM800104' => 0.907, 'RACS820108' => 0.904, 'PALJ810102' => 0.902, 'PALJ810109' => 0.898, 'NAGK730101' => 0.894, 'CRAJ730101' => 0.887, 'CHOP780201' => 0.873, 'TANS770101' => 0.854, 'KANM800103' => 0.850, 'QIAN880107' => 0.829, 'QIAN880106' => 0.827, 'BURA740101' => 0.805, 'NAGK730103' => -0.809}
|
102
|
+
assert_equal(hash, @obj.correlation_coefficient)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_index
|
106
|
+
hash = {"V"=>0.91, "K"=>1.23, "W"=>0.99, "L"=>1.3, "A"=>1.29, "M"=>1.47, "Y"=>0.72, "C"=>1.11, "N"=>0.9, "D"=>1.04, "P"=>0.52, "E"=>1.44, "F"=>1.07, "Q"=>1.27, "G"=>0.56, "R"=>0.96, "S"=>0.82, "H"=>1.22, "T"=>0.82, "I"=>0.97}
|
107
|
+
assert_equal(hash, @obj.index)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
class TestAAindex2 < Test::Unit::TestCase
|
113
|
+
def setup
|
114
|
+
str = DataAAindex.aax2
|
115
|
+
@obj = Bio::AAindex2.new(str)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_entry_id
|
119
|
+
assert_equal('DAYM780301', @obj.entry_id)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_definition
|
123
|
+
assert_equal('Log odds matrix for 250 PAMs (Dayhoff et al., 1978)', @obj.definition)
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_dblinks
|
127
|
+
assert_equal([], @obj.dblinks)
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_author
|
131
|
+
assert_equal("Dayhoff, M.O., Schwartz, R.M. and Orcutt, B.C.", @obj.author)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_title
|
135
|
+
assert_equal("A model of evolutionary change in proteins", @obj.title)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_journal
|
139
|
+
assert_equal('In "Atlas of Protein Sequence and Structure", Vol.5, Suppl.3 (Dayhoff, M.O., ed.), National Biomedical Research Foundation, Washington, D.C., p.352 (1978)', @obj.journal)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_comment
|
143
|
+
assert_equal("", @obj.comment)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_rows
|
147
|
+
ary = ["A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V"]
|
148
|
+
assert_equal(ary, @obj.rows)
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_cols
|
152
|
+
ary = ["A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V"]
|
153
|
+
assert_equal(ary, @obj.cols)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_matrix
|
157
|
+
assert_equal(Matrix, @obj.matrix.class)
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_matrix_2_2
|
161
|
+
assert_equal(2.0, @obj.matrix[2, 2])
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_matrix_1_2
|
165
|
+
assert_equal(nil, @obj.matrix[1, 2])
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_access_A_R
|
169
|
+
assert_equal(nil, @obj['A', 'R'])
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_access_R_A
|
173
|
+
assert_equal(-2.0, @obj['R', 'A'])
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_matrix_A_R
|
177
|
+
assert_equal(nil, @obj.matrix('A', 'R'))
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_matrix_R_A
|
181
|
+
assert_equal(-2.0, @obj.matrix('R', 'A'))
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_matrix_determinant
|
185
|
+
assert_equal(0, @obj.matrix.determinant)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_matrix_rank
|
189
|
+
assert_equal(1, @obj.matrix.rank)
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_matrix_transpose
|
193
|
+
ary = Matrix[[2.0, -2.0, 0.0, 0.0, -2.0, 0.0, 0.0, 1.0, -1.0, -1.0, -2.0, -1.0, -1.0, -4.0, 1.0, 1.0, 1.0, -6.0, -3.0, 0.0]]
|
194
|
+
assert_equal(ary, @obj.matrix.transpose)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/io/test_fastacmd.rb - Unit test for Bio::Blast::Fastacmd.
|
3
|
+
#
|
4
|
+
# Copyright (C) 2006 Mitsuteru Nakao <n@bioruby.org>
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License as published by the Free Software Foundation; either
|
9
|
+
# version 2 of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
# Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with this library; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
#
|
20
|
+
# $Id: test_fastacmd.rb,v 1.1 2006/01/28 08:05:52 nakao Exp $
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'pathname'
|
24
|
+
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
|
25
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
26
|
+
|
27
|
+
|
28
|
+
require 'test/unit'
|
29
|
+
require 'bio/io/fastacmd'
|
30
|
+
|
31
|
+
module Bio
|
32
|
+
|
33
|
+
class TestFastacmd < Test::Unit::TestCase
|
34
|
+
|
35
|
+
def setup
|
36
|
+
@obj = Bio::Blast::Fastacmd.new("/tmp/test")
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_database
|
40
|
+
assert_equal("/tmp/test", @obj.database)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_fastacmd
|
44
|
+
assert_equal("fastacmd", @obj.fastacmd)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_methods
|
48
|
+
method_list = ['get_by_id', 'fetch', 'each_entry', 'each']
|
49
|
+
method_list.each do |method|
|
50
|
+
assert(@obj.methods.include?(method))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|