ngoto-bio 1.2.9.9501 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +201 -4
- data/KNOWN_ISSUES.rdoc +24 -2
- data/README.rdoc +29 -0
- data/Rakefile +44 -5
- data/bin/br_pmfetch.rb +4 -3
- data/bioruby.gemspec +11 -3
- data/bioruby.gemspec.erb +40 -5
- data/doc/Changes-0.7.rd +7 -0
- data/doc/Changes-1.3.rdoc +17 -0
- data/doc/Tutorial.rd.html +1031 -0
- data/doc/Tutorial.rd.ja +111 -45
- data/doc/Tutorial.rd.ja.html +2225 -0
- data/doc/bioruby.css +281 -0
- data/lib/bio/appl/blast/format0.rb +7 -2
- data/lib/bio/db/gff.rb +2 -2
- data/lib/bio/db/lasergene.rb +3 -3
- data/lib/bio/db/soft.rb +3 -3
- data/lib/bio/io/togows.rb +458 -0
- data/lib/bio/shell/core.rb +2 -2
- data/lib/bio/shell/plugin/entry.rb +27 -4
- data/lib/bio/shell/plugin/ncbirest.rb +27 -29
- data/lib/bio/shell/plugin/togows.rb +40 -0
- data/lib/bio/shell.rb +1 -0
- data/lib/bio/util/color_scheme.rb +2 -2
- data/lib/bio/util/contingency_table.rb +2 -2
- data/lib/bio/util/restriction_enzyme.rb +2 -2
- data/lib/bio/version.rb +25 -0
- data/lib/bio.rb +4 -1
- data/test/functional/bio/io/test_togows.rb +267 -0
- data/test/runner.rb +7 -0
- data/test/unit/bio/db/test_gff.rb +63 -0
- data/test/unit/bio/io/test_togows.rb +161 -0
- metadata +11 -3
data/lib/bio/version.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# = bio/version.rb - BioRuby version information
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2001-2009
|
5
|
+
# Toshiaki Katayama <k@bioruby.org>,
|
6
|
+
# Naohisa Goto <ng@bioruby.org>
|
7
|
+
# License:: The Ruby License
|
8
|
+
#
|
9
|
+
|
10
|
+
module Bio
|
11
|
+
|
12
|
+
# BioRuby version (Array containing Integer)
|
13
|
+
BIORUBY_VERSION = [1, 3, 0].extend(Comparable).freeze
|
14
|
+
|
15
|
+
# Extra version specifier (String or nil).
|
16
|
+
# Existance of the value indicates pre-release version or modified version.
|
17
|
+
BIORUBY_EXTRA_VERSION = nil
|
18
|
+
|
19
|
+
# Version identifier, including extra version string (String)
|
20
|
+
# Unlike BIORUBY_VERSION, it is not comparable.
|
21
|
+
BIORUBY_VERSION_ID =
|
22
|
+
(BIORUBY_VERSION.join('.') + BIORUBY_EXTRA_VERSION.to_s).freeze
|
23
|
+
|
24
|
+
end #module Bio
|
25
|
+
|
data/lib/bio.rb
CHANGED
@@ -10,7 +10,9 @@
|
|
10
10
|
|
11
11
|
module Bio
|
12
12
|
|
13
|
-
BIORUBY_VERSION
|
13
|
+
autoload :BIORUBY_VERSION, 'bio/version'
|
14
|
+
autoload :BIORUBY_EXTRA_VERSION, 'bio/version'
|
15
|
+
autoload :BIORUBY_VERSION_ID, 'bio/version'
|
14
16
|
|
15
17
|
### Basic data types
|
16
18
|
|
@@ -182,6 +184,7 @@ module Bio
|
|
182
184
|
autoload :REST, 'bio/io/ncbirest'
|
183
185
|
end
|
184
186
|
|
187
|
+
autoload :TogoWS, 'bio/io/togows'
|
185
188
|
|
186
189
|
### Applications
|
187
190
|
|
@@ -0,0 +1,267 @@
|
|
1
|
+
#
|
2
|
+
# test/functional/bio/io/test_togows.rb - Functional test for Bio::TogoWS
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2009
|
5
|
+
# Naohisa Goto <ng@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id:$
|
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 'uri'
|
16
|
+
require 'bio/version'
|
17
|
+
require 'bio/io/togows'
|
18
|
+
require 'bio/db/genbank/genbank'
|
19
|
+
require 'test/unit'
|
20
|
+
|
21
|
+
module Bio
|
22
|
+
|
23
|
+
# common tests for both instance methods and class methods
|
24
|
+
module FuncTestTogoWSRESTcommon
|
25
|
+
|
26
|
+
bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4)).cleanpath.to_s
|
27
|
+
TestData = Pathname.new(File.join(bioruby_root, 'test', 'data')).cleanpath.to_s
|
28
|
+
|
29
|
+
def test_entry
|
30
|
+
result = nil
|
31
|
+
acc = 'AF237819'
|
32
|
+
assert_nothing_raised {
|
33
|
+
result = @togows.entry('genbank', acc)
|
34
|
+
}
|
35
|
+
assert(!result.to_s.strip.empty?)
|
36
|
+
gb = Bio::GenBank.new(result)
|
37
|
+
assert(gb.accessions.include?(acc))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_entry_multi
|
41
|
+
result = nil
|
42
|
+
accs = [ 'AF237819' ,'AB302966', 'AY582120' ]
|
43
|
+
assert_nothing_raised {
|
44
|
+
result = @togows.entry('genbank', accs)
|
45
|
+
}
|
46
|
+
assert(!result.to_s.strip.empty?)
|
47
|
+
count = 0
|
48
|
+
accs.each do |x|
|
49
|
+
assert_match(Regexp.new(x), result)
|
50
|
+
count += 1
|
51
|
+
end
|
52
|
+
assert_equal(accs.size, count)
|
53
|
+
|
54
|
+
# argument is a string
|
55
|
+
accs2 = accs.join(',')
|
56
|
+
result2 = nil
|
57
|
+
assert_nothing_raised {
|
58
|
+
result2 = @togows.entry('genbank', accs2)
|
59
|
+
}
|
60
|
+
assert(result2 == result)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_entry_with_format
|
64
|
+
result = nil
|
65
|
+
acc = 'AF237819'
|
66
|
+
assert_nothing_raised {
|
67
|
+
result = @togows.entry('genbank', acc, 'fasta')
|
68
|
+
}
|
69
|
+
assert(!result.to_s.strip.empty?)
|
70
|
+
assert_match(/^\>/, result)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_entry_with_key
|
74
|
+
result = nil
|
75
|
+
assert_nothing_raised {
|
76
|
+
result = @togows.entry('pubmed', '16381885', nil, 'authors')
|
77
|
+
}
|
78
|
+
assert(!result.to_s.strip.empty?)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_entry_with_format_and_key
|
82
|
+
result = nil
|
83
|
+
assert_nothing_raised {
|
84
|
+
result = @togows.entry('pubmed', '16381885', 'json', 'authors')
|
85
|
+
}
|
86
|
+
assert(!result.to_s.strip.empty?)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_search
|
90
|
+
result = nil
|
91
|
+
assert_nothing_raised {
|
92
|
+
result = @togows.search('nuccore', 'Milnesium tardigradum')
|
93
|
+
}
|
94
|
+
assert(!result.to_s.strip.empty?)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_search_with_offset_limit
|
98
|
+
result = nil
|
99
|
+
assert_nothing_raised {
|
100
|
+
result = @togows.search('nuccore', 'Milnesium tardigradum', 2, 3)
|
101
|
+
}
|
102
|
+
assert(!result.to_s.strip.empty?)
|
103
|
+
ary = result.chomp.split(/\n/)
|
104
|
+
assert_equal(3, ary.size)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_search_with_offset_limit_format
|
108
|
+
result = nil
|
109
|
+
assert_nothing_raised {
|
110
|
+
result = @togows.search('nuccore', 'Milnesium tardigradum', 2, 3,
|
111
|
+
'json')
|
112
|
+
}
|
113
|
+
assert(!result.to_s.strip.empty?)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_convert
|
117
|
+
data = File.read(File.join(TestData, 'blast', 'b0002.faa.m0'))
|
118
|
+
result = nil
|
119
|
+
assert_nothing_raised {
|
120
|
+
result = @togows.convert(data, 'blast', 'gff')
|
121
|
+
}
|
122
|
+
assert(!result.to_s.strip.empty?)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_retrieve
|
126
|
+
result = nil
|
127
|
+
assert_nothing_raised {
|
128
|
+
result = @togows.retrieve('AF237819')
|
129
|
+
}
|
130
|
+
assert(!result.to_s.strip.empty?)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_retrieve_1id_1db
|
134
|
+
result = nil
|
135
|
+
assert_nothing_raised {
|
136
|
+
result = @togows.retrieve('hsa:124',
|
137
|
+
:database => 'gene',
|
138
|
+
:field => 'entry_id',
|
139
|
+
:format => 'json')
|
140
|
+
}
|
141
|
+
assert(!result.to_s.strip.empty?)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_retrieve_1id_2db
|
145
|
+
result = nil
|
146
|
+
assert_nothing_raised {
|
147
|
+
result = @togows.retrieve('1.1.1.1',
|
148
|
+
:database => [ 'gene', 'enzyme' ])
|
149
|
+
}
|
150
|
+
assert(!result.to_s.strip.empty?)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_retrieve_2id_2db
|
154
|
+
result = nil
|
155
|
+
assert_nothing_raised {
|
156
|
+
result = @togows.retrieve([ '1.1.1.1', 'hsa:124' ],
|
157
|
+
:database => [ 'gene', 'enzyme' ])
|
158
|
+
}
|
159
|
+
assert(!result.to_s.strip.empty?)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_entry_database_list
|
163
|
+
result = nil
|
164
|
+
assert_nothing_raised {
|
165
|
+
result = @togows.entry_database_list
|
166
|
+
}
|
167
|
+
assert_kind_of(Array, result)
|
168
|
+
assert(!result.empty?)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_search_database_list
|
172
|
+
result = nil
|
173
|
+
assert_nothing_raised {
|
174
|
+
result = @togows.search_database_list
|
175
|
+
}
|
176
|
+
assert_kind_of(Array, result)
|
177
|
+
assert(!result.empty?)
|
178
|
+
end
|
179
|
+
|
180
|
+
end #FuncTestTogoWSRESTcommon
|
181
|
+
|
182
|
+
# functional test for Bio::TogoWS::REST
|
183
|
+
class FuncTestTogoWSREST < Test::Unit::TestCase
|
184
|
+
|
185
|
+
include FuncTestTogoWSRESTcommon
|
186
|
+
|
187
|
+
def setup
|
188
|
+
@togows = Bio::TogoWS::REST.new
|
189
|
+
end
|
190
|
+
|
191
|
+
end #class FuncTestTogoWSREST
|
192
|
+
|
193
|
+
# functional test for Bio::TogoWS::REST private methods
|
194
|
+
class FuncTestTogoWSRESTprivate < Test::Unit::TestCase
|
195
|
+
|
196
|
+
def setup
|
197
|
+
@togows = Bio::TogoWS::REST.new
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_get
|
201
|
+
response = nil
|
202
|
+
acc = 'AF237819'
|
203
|
+
assert_nothing_raised {
|
204
|
+
response = @togows.instance_eval {
|
205
|
+
get('entry', 'genbank', acc, 'entry_id')
|
206
|
+
}
|
207
|
+
}
|
208
|
+
assert_kind_of(Net::HTTPResponse, response)
|
209
|
+
assert_equal("200", response.code)
|
210
|
+
result = response.body
|
211
|
+
assert(!result.to_s.strip.empty?)
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_get_dir
|
215
|
+
response = nil
|
216
|
+
assert_nothing_raised {
|
217
|
+
response = @togows.instance_eval {
|
218
|
+
get_dir('search')
|
219
|
+
}
|
220
|
+
}
|
221
|
+
assert_kind_of(Net::HTTPResponse, response)
|
222
|
+
assert_equal("200", response.code)
|
223
|
+
result = response.body
|
224
|
+
assert(!result.to_s.strip.empty?)
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_post_data
|
228
|
+
data = File.read(File.join(Bio::FuncTestTogoWSRESTcommon::TestData,
|
229
|
+
'blast', 'b0002.faa.m0'))
|
230
|
+
response = nil
|
231
|
+
assert_nothing_raised {
|
232
|
+
response = @togows.instance_eval {
|
233
|
+
post_data(data, 'convert', 'blast.gff')
|
234
|
+
}
|
235
|
+
}
|
236
|
+
assert_kind_of(Net::HTTPResponse, response)
|
237
|
+
assert_equal("200", response.code)
|
238
|
+
result = response.body
|
239
|
+
assert(!result.to_s.strip.empty?)
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_database_list
|
243
|
+
result = nil
|
244
|
+
assert_nothing_raised {
|
245
|
+
result = @togows.instance_eval {
|
246
|
+
database_list('entry')
|
247
|
+
}
|
248
|
+
}
|
249
|
+
assert_kind_of(Array, result)
|
250
|
+
assert(!result.empty?)
|
251
|
+
end
|
252
|
+
|
253
|
+
end #class FuncTestTogoWSRESTprivate
|
254
|
+
|
255
|
+
if false # DISABLED because of the server load and execution time
|
256
|
+
|
257
|
+
# functional test for Bio::TogoWS::REST class methods
|
258
|
+
class FuncTestTogoWSRESTclassMethod < Test::Unit::TestCase
|
259
|
+
include FuncTestTogoWSRESTcommon
|
260
|
+
def setup
|
261
|
+
@togows = Bio::TogoWS::REST
|
262
|
+
end
|
263
|
+
end #class FuncTestTogoWSRESTclassMethod
|
264
|
+
|
265
|
+
end #if false
|
266
|
+
|
267
|
+
end #module Bio
|
data/test/runner.rb
CHANGED
@@ -13,6 +13,13 @@ if !defined?(Test::Unit::AutoRunner) then
|
|
13
13
|
end
|
14
14
|
# tests called when exiting the program
|
15
15
|
|
16
|
+
elsif defined?(Test::Unit::Color) then
|
17
|
+
# workaround for test-unit-2.0.x
|
18
|
+
r = Test::Unit::AutoRunner.new(true)
|
19
|
+
r.to_run.push File.dirname($0)
|
20
|
+
r.process_args(ARGV)
|
21
|
+
exit r.run
|
22
|
+
|
16
23
|
elsif RUBY_VERSION > "1.8.2"
|
17
24
|
# current Test::Unit -- Ruby 1.8.3 or later
|
18
25
|
exit Test::Unit::AutoRunner.run(true, File.dirname($0))
|
@@ -770,6 +770,10 @@ END_OF_DATA
|
|
770
770
|
assert_equal(attr, @obj.attributes)
|
771
771
|
end
|
772
772
|
|
773
|
+
def test_id
|
774
|
+
assert_equal('CEN1', @obj.id)
|
775
|
+
end
|
776
|
+
|
773
777
|
def test_to_s
|
774
778
|
str =<<END_OF_DATA
|
775
779
|
chrI SGD centromere 151467 151584 . + . ID=CEN1;Name=CEN1;gene=CEN1;Alias=CEN1,test%3B0001;Note=Chromosome I centromere;dbxref=SGD:S000006463;Target=test%2002 123 456 -,test%2C03 159 314;memo%3Dtest%3Battr=99.9%25%09match
|
@@ -848,6 +852,65 @@ END_OF_DATA
|
|
848
852
|
assert_equal(1, obj.frame)
|
849
853
|
end
|
850
854
|
|
855
|
+
def test_id_replace
|
856
|
+
data =<<END_OF_DATA
|
857
|
+
ctg123 src CDS 456 788 1e-10 - 2 ID=test03
|
858
|
+
END_OF_DATA
|
859
|
+
obj = Bio::GFF::GFF3::Record.new(data)
|
860
|
+
assert_equal('test03', obj.id)
|
861
|
+
assert_equal('test_id', obj.id = 'test_id')
|
862
|
+
assert_equal('test_id', obj.id)
|
863
|
+
end
|
864
|
+
|
865
|
+
def test_id_set
|
866
|
+
data =<<END_OF_DATA
|
867
|
+
ctg123 src CDS 456 788 1e-10 - 2 NAME=test03
|
868
|
+
END_OF_DATA
|
869
|
+
obj = Bio::GFF::GFF3::Record.new(data)
|
870
|
+
assert_nil(obj.id)
|
871
|
+
assert_equal('test_id', obj.id = 'test_id')
|
872
|
+
assert_equal('test_id', obj.id)
|
873
|
+
assert_equal('next_test', obj.id = 'next_test')
|
874
|
+
assert_equal('next_test', obj.id)
|
875
|
+
end
|
876
|
+
|
877
|
+
def test_id_multiple
|
878
|
+
# Note: Two ID attributes in a record is illegal in GFF3.
|
879
|
+
data =<<END_OF_DATA
|
880
|
+
ctg123 src CDS 456 788 . - 2 ID=test03,test04
|
881
|
+
END_OF_DATA
|
882
|
+
obj = Bio::GFF::GFF3::Record.new(data)
|
883
|
+
assert_equal([ [ 'ID', 'test03' ], [ 'ID', 'test04' ] ],
|
884
|
+
obj.attributes)
|
885
|
+
assert_equal('test03', obj.id)
|
886
|
+
assert_equal('test_id', obj.id = 'test_id')
|
887
|
+
assert_equal('test_id', obj.id)
|
888
|
+
assert_equal([ [ 'ID', 'test_id' ], [ 'ID', 'test04' ] ],
|
889
|
+
obj.attributes)
|
890
|
+
str = "ctg123\tsrc\tCDS\t456\t788\t.\t-\t2\tID=test_id,test04\n"
|
891
|
+
assert_equal(str, obj.to_s)
|
892
|
+
end
|
893
|
+
|
894
|
+
def test_id_multiple2
|
895
|
+
# Note: Two ID attributes in a record is illegal in GFF3.
|
896
|
+
data =<<END_OF_DATA
|
897
|
+
ctg123 src CDS 456 788 . - 2 ID=test03;ID=test04
|
898
|
+
END_OF_DATA
|
899
|
+
obj = Bio::GFF::GFF3::Record.new(data)
|
900
|
+
assert_equal([ [ 'ID', 'test03' ], [ 'ID', 'test04' ] ],
|
901
|
+
obj.attributes)
|
902
|
+
assert_equal('test03', obj.id)
|
903
|
+
assert_equal('test_id', obj.id = 'test_id')
|
904
|
+
assert_equal('test_id', obj.id)
|
905
|
+
assert_equal([ [ 'ID', 'test_id' ], [ 'ID', 'test04' ] ],
|
906
|
+
obj.attributes)
|
907
|
+
|
908
|
+
# The "XXX=test03;XXX=test04" is automatically changed to
|
909
|
+
# "XXX=test03,test04", as defined in the GFF3 spec.
|
910
|
+
str = "ctg123\tsrc\tCDS\t456\t788\t.\t-\t2\tID=test_id,test04\n"
|
911
|
+
assert_equal(str, obj.to_s)
|
912
|
+
end
|
913
|
+
|
851
914
|
def test_initialize_9
|
852
915
|
obj = Bio::GFF::GFF3::Record.new('test01',
|
853
916
|
'testsrc',
|
@@ -0,0 +1,161 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/io/test_togows.rb - Unit test for Bio::TogoWS
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2009
|
5
|
+
# Naohisa Goto <ng@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
7
|
+
#
|
8
|
+
# $Id:$
|
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 'uri'
|
16
|
+
require 'net/http'
|
17
|
+
require 'bio/version'
|
18
|
+
require 'bio/io/togows'
|
19
|
+
require 'test/unit'
|
20
|
+
|
21
|
+
module Bio
|
22
|
+
|
23
|
+
# unit test for Bio::TogoWS::REST
|
24
|
+
class TestTogoWSREST < Test::Unit::TestCase
|
25
|
+
|
26
|
+
def setup
|
27
|
+
@togows = Bio::TogoWS::REST.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_debug_default
|
31
|
+
assert_equal(false, @togows.debug)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_debug
|
35
|
+
assert_equal(true, @togows.debug = true)
|
36
|
+
assert_equal(true, @togows.debug)
|
37
|
+
assert_equal(false, @togows.debug = false)
|
38
|
+
assert_equal(false, @togows.debug)
|
39
|
+
assert_equal(true, @togows.debug = true)
|
40
|
+
assert_equal(true, @togows.debug)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_internal_http
|
44
|
+
assert_kind_of(Net::HTTP, @togows.internal_http)
|
45
|
+
end
|
46
|
+
|
47
|
+
end #class TestTogoWSREST
|
48
|
+
|
49
|
+
# unit test for Bio::TogoWS::REST private methods
|
50
|
+
class TestTogoWSRESTprivate < Test::Unit::TestCase
|
51
|
+
|
52
|
+
def setup
|
53
|
+
@togows = Bio::TogoWS::REST.new
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_make_path
|
57
|
+
a_and_q = {
|
58
|
+
'/ab/cde/fghi' => [ 'ab', 'cde', 'fghi' ],
|
59
|
+
'/a+b/a%2Bb/a%2Fb/a%26b/a%3Bb/a%2Cb/a%3Bb' =>
|
60
|
+
[ 'a b', 'a+b', 'a/b', 'a&b', 'a;b', 'a,b', 'a;b' ]
|
61
|
+
}
|
62
|
+
count = 0
|
63
|
+
a_and_q.each do |k,v|
|
64
|
+
assert_equal(k, @togows.instance_eval { make_path(v) })
|
65
|
+
count += 1
|
66
|
+
end
|
67
|
+
assert_equal(a_and_q.size, count)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_prepare_return_value
|
71
|
+
dummyclass = Struct.new(:code, :body)
|
72
|
+
dummy200 = dummyclass.new("200", "this is test")
|
73
|
+
assert_equal("this is test",
|
74
|
+
@togows.instance_eval { prepare_return_value(dummy200) })
|
75
|
+
dummy404 = dummyclass.new("404", "not found")
|
76
|
+
assert_equal(nil,
|
77
|
+
@togows.instance_eval { prepare_return_value(dummy404) })
|
78
|
+
end
|
79
|
+
|
80
|
+
end #class TestTogoWSRESTprivate
|
81
|
+
|
82
|
+
|
83
|
+
# unit test for Bio::TogoWS::REST class methods
|
84
|
+
class TestTogoWSRESTclassMethod < Test::Unit::TestCase
|
85
|
+
|
86
|
+
def test_new
|
87
|
+
assert_instance_of(Bio::TogoWS::REST, Bio::TogoWS::REST.new)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_new_with_uri_string
|
91
|
+
t = Bio::TogoWS::REST.new('http://localhost:1234/test')
|
92
|
+
assert_instance_of(Bio::TogoWS::REST, t)
|
93
|
+
http = t.internal_http
|
94
|
+
assert_equal('localhost', http.address)
|
95
|
+
assert_equal(1234, http.port)
|
96
|
+
assert_equal('/test/', t.instance_eval { @pathbase })
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_new_with_uri_object
|
100
|
+
u = URI.parse('http://localhost:1234/test')
|
101
|
+
t = Bio::TogoWS::REST.new(u)
|
102
|
+
assert_instance_of(Bio::TogoWS::REST, t)
|
103
|
+
http = t.internal_http
|
104
|
+
assert_equal('localhost', http.address)
|
105
|
+
assert_equal(1234, http.port)
|
106
|
+
assert_equal('/test/', t.instance_eval { @pathbase })
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_entry
|
110
|
+
assert_respond_to(Bio::TogoWS::REST, :entry)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_search
|
114
|
+
assert_respond_to(Bio::TogoWS::REST, :search)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_convert
|
118
|
+
assert_respond_to(Bio::TogoWS::REST, :convert)
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_retrieve
|
122
|
+
assert_respond_to(Bio::TogoWS::REST, :retrieve)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_entry_database_list
|
126
|
+
assert_respond_to(Bio::TogoWS::REST, :entry_database_list)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_search_database_list
|
130
|
+
assert_respond_to(Bio::TogoWS::REST, :search_database_list)
|
131
|
+
end
|
132
|
+
|
133
|
+
end #class TestTogoWSRESTclassMethod
|
134
|
+
|
135
|
+
# dummy class for testing Bio::TogoWS::AccessWait
|
136
|
+
class DummyAccessWait
|
137
|
+
include Bio::TogoWS::AccessWait
|
138
|
+
end
|
139
|
+
|
140
|
+
# unit test for Bio::TogoWS::AccessWait (all methods are private)
|
141
|
+
class TestTogoWSAccessWait < Test::Unit::TestCase
|
142
|
+
def setup
|
143
|
+
@obj = DummyAccessWait.new
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_togows_access_wait
|
147
|
+
assert_kind_of(Numeric, @obj.instance_eval { togows_access_wait })
|
148
|
+
|
149
|
+
waits = 0
|
150
|
+
2.times { waits += @obj.instance_eval { togows_access_wait } }
|
151
|
+
assert(waits > 0)
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_reset_togows_access_wait
|
155
|
+
assert_nothing_raised {
|
156
|
+
@obj.instance_eval { reset_togows_access_wait }
|
157
|
+
}
|
158
|
+
end
|
159
|
+
end #class TestTogoWSAccessWait
|
160
|
+
|
161
|
+
end #module Bio
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ngoto-bio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BioRuby project
|
@@ -9,7 +9,7 @@ autorequire: bio
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-13 00:00:00 -08:00
|
13
13
|
default_executable: bioruby
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,11 +24,11 @@ executables:
|
|
24
24
|
extensions: []
|
25
25
|
|
26
26
|
extra_rdoc_files:
|
27
|
+
- ChangeLog
|
27
28
|
- KNOWN_ISSUES.rdoc
|
28
29
|
- README.rdoc
|
29
30
|
- README_DEV.rdoc
|
30
31
|
- doc/Changes-1.3.rdoc
|
31
|
-
- ChangeLog
|
32
32
|
files:
|
33
33
|
- ChangeLog
|
34
34
|
- KNOWN_ISSUES.rdoc
|
@@ -47,7 +47,10 @@ files:
|
|
47
47
|
- doc/KEGG_API.rd
|
48
48
|
- doc/KEGG_API.rd.ja
|
49
49
|
- doc/Tutorial.rd
|
50
|
+
- doc/Tutorial.rd.html
|
50
51
|
- doc/Tutorial.rd.ja
|
52
|
+
- doc/Tutorial.rd.ja.html
|
53
|
+
- doc/bioruby.css
|
51
54
|
- etc/bioinformatics/seqdatabase.ini
|
52
55
|
- extconf.rb
|
53
56
|
- lib/bio.rb
|
@@ -218,6 +221,7 @@ files:
|
|
218
221
|
- lib/bio/io/registry.rb
|
219
222
|
- lib/bio/io/soapwsdl.rb
|
220
223
|
- lib/bio/io/sql.rb
|
224
|
+
- lib/bio/io/togows.rb
|
221
225
|
- lib/bio/location.rb
|
222
226
|
- lib/bio/map.rb
|
223
227
|
- lib/bio/pathway.rb
|
@@ -251,6 +255,7 @@ files:
|
|
251
255
|
- lib/bio/shell/plugin/psort.rb
|
252
256
|
- lib/bio/shell/plugin/seq.rb
|
253
257
|
- lib/bio/shell/plugin/soap.rb
|
258
|
+
- lib/bio/shell/plugin/togows.rb
|
254
259
|
- lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb
|
255
260
|
- lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml
|
256
261
|
- lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml
|
@@ -306,6 +311,7 @@ files:
|
|
306
311
|
- lib/bio/util/restriction_enzyme/single_strand_complement.rb
|
307
312
|
- lib/bio/util/restriction_enzyme/string_formatting.rb
|
308
313
|
- lib/bio/util/sirna.rb
|
314
|
+
- lib/bio/version.rb
|
309
315
|
- rdoc.zsh
|
310
316
|
- sample/any2fasta.rb
|
311
317
|
- sample/biofetch.rb
|
@@ -370,6 +376,7 @@ files:
|
|
370
376
|
- test/functional/bio/appl/test_pts1.rb
|
371
377
|
- test/functional/bio/io/test_ensembl.rb
|
372
378
|
- test/functional/bio/io/test_soapwsdl.rb
|
379
|
+
- test/functional/bio/io/test_togows.rb
|
373
380
|
- test/functional/bio/sequence/test_output_embl.rb
|
374
381
|
- test/functional/bio/test_command.rb
|
375
382
|
- test/runner.rb
|
@@ -419,6 +426,7 @@ files:
|
|
419
426
|
- test/unit/bio/io/test_fastacmd.rb
|
420
427
|
- test/unit/bio/io/test_flatfile.rb
|
421
428
|
- test/unit/bio/io/test_soapwsdl.rb
|
429
|
+
- test/unit/bio/io/test_togows.rb
|
422
430
|
- test/unit/bio/sequence/test_aa.rb
|
423
431
|
- test/unit/bio/sequence/test_common.rb
|
424
432
|
- test/unit/bio/sequence/test_compat.rb
|