bio 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +66 -0
- data/ChangeLog +989 -4524
- data/KNOWN_ISSUES.rdoc +67 -2
- data/README.rdoc +89 -23
- data/README_DEV.rdoc +93 -2
- data/RELEASE_NOTES.rdoc +167 -95
- data/Rakefile +199 -7
- data/bioruby.gemspec +27 -12
- data/bioruby.gemspec.erb +6 -3
- data/doc/ChangeLog-before-1.4.2 +5013 -0
- data/doc/RELEASE_NOTES-1.4.2.rdoc +132 -0
- data/doc/Tutorial.rd +21 -3
- data/doc/Tutorial.rd.html +20 -12
- data/etc/bioinformatics/seqdatabase.ini +13 -196
- data/gemfiles/Gemfile.travis-jruby1.8 +7 -0
- data/gemfiles/Gemfile.travis-jruby1.9 +10 -0
- data/gemfiles/Gemfile.travis-ruby1.8 +7 -0
- data/gemfiles/Gemfile.travis-ruby1.9 +10 -0
- data/gemfiles/modify-Gemfile.rb +28 -0
- data/gemfiles/prepare-gemspec.rb +25 -0
- data/lib/bio/alignment.rb +1 -1
- data/lib/bio/appl/bl2seq/report.rb +3 -3
- data/lib/bio/appl/blast/ddbj.rb +0 -3
- data/lib/bio/appl/blast/format0.rb +4 -22
- data/lib/bio/appl/blast/genomenet.rb +33 -16
- data/lib/bio/appl/blast/ncbioptions.rb +8 -3
- data/lib/bio/appl/blast/remote.rb +6 -5
- data/lib/bio/appl/blast/report.rb +10 -6
- data/lib/bio/appl/blast/rpsblast.rb +3 -2
- data/lib/bio/appl/blast/wublast.rb +3 -3
- data/lib/bio/command.rb +118 -36
- data/lib/bio/data/na.rb +1 -1
- data/lib/bio/db/embl/embl.rb +74 -0
- data/lib/bio/db/embl/format_embl.rb +0 -4
- data/lib/bio/db/fasta.rb +57 -45
- data/lib/bio/db/fasta/defline.rb +1 -1
- data/lib/bio/db/fasta/format_fasta.rb +0 -4
- data/lib/bio/db/fasta/format_qual.rb +0 -5
- data/lib/bio/db/fastq/format_fastq.rb +0 -1
- data/lib/bio/db/genbank/format_genbank.rb +0 -4
- data/lib/bio/db/gff.rb +41 -12
- data/lib/bio/db/kegg/genes.rb +3 -3
- data/lib/bio/db/kegg/kgml.rb +465 -64
- data/lib/bio/db/newick.rb +0 -244
- data/lib/bio/db/pdb.rb +1 -4
- data/lib/bio/db/pdb/atom.rb +3 -2
- data/lib/bio/db/pdb/chain.rb +2 -3
- data/lib/bio/db/pdb/chemicalcomponent.rb +3 -2
- data/lib/bio/db/pdb/model.rb +2 -2
- data/lib/bio/db/pdb/pdb.rb +2 -1
- data/lib/bio/db/pdb/residue.rb +2 -2
- data/lib/bio/db/pdb/utils.rb +7 -4
- data/lib/bio/db/phyloxml/phyloxml_parser.rb +52 -5
- data/lib/bio/feature.rb +2 -3
- data/lib/bio/io/flatfile/autodetection.rb +1 -1
- data/lib/bio/io/flatfile/buffer.rb +84 -0
- data/lib/bio/sequence.rb +6 -4
- data/lib/bio/sequence/aa.rb +3 -5
- data/lib/bio/sequence/adapter.rb +6 -6
- data/lib/bio/sequence/common.rb +3 -3
- data/lib/bio/sequence/compat.rb +2 -7
- data/lib/bio/sequence/dblink.rb +6 -5
- data/lib/bio/sequence/format.rb +0 -6
- data/lib/bio/sequence/format_raw.rb +0 -4
- data/lib/bio/sequence/generic.rb +3 -4
- data/lib/bio/sequence/na.rb +4 -6
- data/lib/bio/sequence/quality_score.rb +2 -0
- data/lib/bio/sequence/sequence_masker.rb +3 -0
- data/lib/bio/shell/core.rb +1 -0
- data/lib/bio/tree.rb +1 -2
- data/lib/bio/tree/output.rb +264 -0
- data/lib/bio/util/restriction_enzyme.rb +1 -3
- data/lib/bio/util/restriction_enzyme/analysis.rb +8 -5
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +4 -3
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +3 -2
- data/lib/bio/util/restriction_enzyme/dense_int_array.rb +3 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +3 -4
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +3 -4
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +3 -4
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +3 -4
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +3 -4
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +3 -4
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +3 -4
- data/lib/bio/util/restriction_enzyme/single_strand.rb +3 -3
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +3 -4
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +3 -4
- data/lib/bio/util/restriction_enzyme/sorted_num_array.rb +3 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +3 -4
- data/lib/bio/version.rb +11 -2
- data/sample/seqdatabase.ini +210 -0
- data/test/bioruby_test_helper.rb +37 -12
- data/test/data/KEGG/test.kgml +37 -0
- data/test/data/command/echoarg2.bat +0 -0
- data/test/data/command/echoarg2.sh +4 -0
- data/test/functional/bio/test_command.rb +58 -28
- data/test/{functional → network}/bio/appl/blast/test_remote.rb +0 -0
- data/test/{functional → network}/bio/appl/test_blast.rb +0 -0
- data/test/{functional → network}/bio/appl/test_pts1.rb +0 -0
- data/test/{functional → network}/bio/io/test_ddbjrest.rb +0 -0
- data/test/{functional → network}/bio/io/test_ensembl.rb +0 -0
- data/test/{functional → network}/bio/io/test_pubmed.rb +0 -0
- data/test/{functional → network}/bio/io/test_soapwsdl.rb +0 -0
- data/test/{functional → network}/bio/io/test_togows.rb +0 -0
- data/test/network/bio/test_command.rb +35 -0
- data/test/runner.rb +16 -6
- data/test/unit/bio/appl/blast/test_report.rb +119 -0
- data/test/unit/bio/appl/blast/test_rpsblast.rb +1 -0
- data/test/unit/bio/data/test_na.rb +1 -1
- data/test/unit/bio/db/embl/test_embl.rb +2 -7
- data/test/unit/bio/db/embl/test_embl_rel89.rb +2 -7
- data/test/unit/bio/db/fasta/test_defline.rb +1 -1
- data/test/unit/bio/db/genbank/test_genpept.rb +1 -1
- data/test/unit/bio/db/kegg/test_drug.rb +1 -1
- data/test/unit/bio/db/kegg/test_genome.rb +1 -1
- data/test/unit/bio/db/kegg/test_glycan.rb +1 -1
- data/test/unit/bio/db/kegg/test_kgml.rb +1022 -0
- data/test/unit/bio/db/sanger_chromatogram/test_abif.rb +2 -1
- data/test/unit/bio/db/sanger_chromatogram/test_scf.rb +4 -2
- data/test/unit/bio/db/test_newick.rb +2 -0
- data/test/unit/bio/db/test_phyloxml.rb +54 -2
- data/test/unit/bio/db/test_phyloxml_writer.rb +15 -9
- data/test/unit/bio/db/test_soft.rb +1 -1
- data/test/unit/bio/io/flatfile/test_autodetection.rb +6 -0
- data/test/unit/bio/io/flatfile/test_buffer.rb +141 -0
- data/test/unit/bio/sequence/test_common.rb +36 -4
- data/test/unit/bio/sequence/test_na.rb +1 -1
- data/test/unit/bio/test_command.rb +9 -4
- data/test/unit/bio/test_sequence.rb +2 -2
- data/test/unit/bio/test_tree.rb +11 -11
- data/test/unit/bio/util/test_restriction_enzyme.rb +1 -1
- metadata +1428 -655
- data/rdoc.zsh +0 -8
@@ -42,7 +42,7 @@ module Bio
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_to_re
|
45
|
-
re = /[tcy][agr][atw][
|
45
|
+
re = /[tcy][agr][atw][gcs][tgk][acm][tgcyskb][atgrwkd][agcmrsv][atgcyrwskmbdhvn]atgc/
|
46
46
|
str = 'yrwskmbdvnatgc'
|
47
47
|
str0 = str.clone
|
48
48
|
assert_equal(re, @obj.to_re(str))
|
@@ -124,13 +124,8 @@ module Bio
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def test_os
|
127
|
-
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_os_valid
|
132
|
-
@obj.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" }
|
133
|
-
assert_equal("Haplochromis sp. 'muzu rukwa'", @obj.os)
|
127
|
+
assert_equal("Haplochromis sp. 'muzu, rukwa'", @obj.os[0]['os'])
|
128
|
+
assert_nil(@obj.os[0]['name'])
|
134
129
|
end
|
135
130
|
|
136
131
|
# Bio::EMBLDB::COMMON#oc
|
@@ -129,13 +129,8 @@ module Bio
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def test_os
|
132
|
-
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_os_valid
|
137
|
-
@obj.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" }
|
138
|
-
assert_equal("Haplochromis sp. 'muzu rukwa'", @obj.os)
|
132
|
+
assert_equal("Haplochromis sp. 'muzu, rukwa'", @obj.os[0]['os'])
|
133
|
+
assert_nil(@obj.os[0]['name'])
|
139
134
|
end
|
140
135
|
|
141
136
|
# Bio::EMBLDB::COMMON#oc
|
@@ -12,7 +12,7 @@ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
|
12
12
|
|
13
13
|
# libraries needed for the tests
|
14
14
|
require 'test/unit'
|
15
|
-
require 'bio/db/fasta/defline
|
15
|
+
require 'bio/db/fasta/defline'
|
16
16
|
|
17
17
|
module Bio
|
18
18
|
class TestBioFastaDefline < Test::Unit::TestCase
|
@@ -12,7 +12,7 @@ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
|
12
12
|
|
13
13
|
# libraries needed for the tests
|
14
14
|
require 'test/unit'
|
15
|
-
require 'bio/db/genbank/genpept
|
15
|
+
require 'bio/db/genbank/genpept'
|
16
16
|
|
17
17
|
#The coverage of this class is 100%
|
18
18
|
#It tests only the methods descripbed in the soruce class.(It dosen't test the inherited methods from NCBIDB)
|
@@ -12,7 +12,7 @@ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
|
12
12
|
|
13
13
|
# libraries needed for the tests
|
14
14
|
require 'test/unit'
|
15
|
-
require 'bio/db/kegg/genome
|
15
|
+
require 'bio/db/kegg/genome'
|
16
16
|
|
17
17
|
module Bio
|
18
18
|
class TestBioKEGGGENOME_T00005 < Test::Unit::TestCase
|
@@ -0,0 +1,1022 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/db/kegg/test_kgml.rb - Unit test for Bio::KEGG::KGML
|
3
|
+
#
|
4
|
+
# Copyright (C) 2012 Naohisa Goto <ng@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
|
7
|
+
# loading helper routine for testing bioruby
|
8
|
+
require 'pathname'
|
9
|
+
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
10
|
+
'bioruby_test_helper.rb')).cleanpath.to_s
|
11
|
+
|
12
|
+
# libraries needed for the tests
|
13
|
+
require 'test/unit'
|
14
|
+
require 'bio/db/kegg/kgml'
|
15
|
+
|
16
|
+
module Bio; module TestKeggKGML
|
17
|
+
|
18
|
+
filename = File.join(BioRubyTestDataPath, 'KEGG', 'test.kgml')
|
19
|
+
KGMLTestXMLstr = File.read(filename).freeze
|
20
|
+
|
21
|
+
class TestKGMLPathway < Test::Unit::TestCase
|
22
|
+
def setup
|
23
|
+
xmlstr = KGMLTestXMLstr
|
24
|
+
@obj = Bio::KEGG::KGML.new(xmlstr)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_name
|
28
|
+
assert_equal 'path:xxx09876', @obj.name
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_org
|
32
|
+
assert_equal 'xxx', @obj.org
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_number
|
36
|
+
assert_equal '09876', @obj.number
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_title
|
40
|
+
assert_equal 'This is test title', @obj.title
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_image
|
44
|
+
assert_equal 'http://example.com/pathway/ec/09876.png', @obj.image
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_link
|
48
|
+
assert_equal 'http://example.com/show_pathway?xxx09876', @obj.link
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_entries__size
|
52
|
+
assert_equal 3, @obj.entries.size
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_relations__size
|
56
|
+
assert_equal 1, @obj.relations.size
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_reactions__size
|
60
|
+
assert_equal 1, @obj.reactions.size
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_entries=()
|
64
|
+
a = [ nil, nil, nil ]
|
65
|
+
b = [ nil, nil, nil, nil ]
|
66
|
+
assert_equal a, (@obj.entries = a)
|
67
|
+
assert_equal a, @obj.entries
|
68
|
+
assert_equal b, (@obj.entries = b)
|
69
|
+
assert_equal b, @obj.entries
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_relations=()
|
73
|
+
a = [ nil, nil, nil ]
|
74
|
+
b = [ nil, nil, nil, nil ]
|
75
|
+
assert_equal a, (@obj.relations = a)
|
76
|
+
assert_equal a, @obj.relations
|
77
|
+
assert_equal b, (@obj.relations = b)
|
78
|
+
assert_equal b, @obj.relations
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_reactions=()
|
82
|
+
a = [ nil, nil, nil ]
|
83
|
+
b = [ nil, nil, nil, nil ]
|
84
|
+
assert_equal a, (@obj.reactions = a)
|
85
|
+
assert_equal a, @obj.reactions
|
86
|
+
assert_equal b, (@obj.reactions = b)
|
87
|
+
assert_equal b, @obj.reactions
|
88
|
+
end
|
89
|
+
end #class TestKGMLPathway
|
90
|
+
|
91
|
+
class TestKGMLEntrySetter < Test::Unit::TestCase
|
92
|
+
def setup
|
93
|
+
@obj = Bio::KEGG::KGML::Entry.new
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_id=()
|
97
|
+
assert_nil @obj.id
|
98
|
+
assert_equal 1234, (@obj.id = 1234)
|
99
|
+
assert_equal 1234, @obj.id
|
100
|
+
assert_equal 4567, (@obj.id = 4567)
|
101
|
+
assert_equal 4567, @obj.id
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_name=()
|
105
|
+
assert_nil @obj.name
|
106
|
+
assert_equal 'cpd:C99999', (@obj.name = 'cpd:C99999')
|
107
|
+
assert_equal 'cpd:C99999', @obj.name
|
108
|
+
assert_equal 'cpd:C98765', (@obj.name = 'cpd:C98765')
|
109
|
+
assert_equal 'cpd:C98765', @obj.name
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_type=()
|
113
|
+
assert_equal 'compound', (@obj.type = 'compound')
|
114
|
+
assert_equal 'compound', @obj.type
|
115
|
+
assert_equal 'enzyme', (@obj.type = 'enzyme')
|
116
|
+
assert_equal 'enzyme', @obj.type
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_link=()
|
120
|
+
str1 = 'http://example.com/dbget-bin/www_bget?C99999'.freeze
|
121
|
+
str2 = 'http://example.com/dbget-bin/www_bget?C98765'.freeze
|
122
|
+
assert_equal str1, (@obj.link = str1)
|
123
|
+
assert_equal str1, @obj.link
|
124
|
+
assert_equal str2, (@obj.link = str2)
|
125
|
+
assert_equal str2, @obj.link
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_reaction=()
|
129
|
+
assert_equal "rn:R99999", (@obj.reaction = 'rn:R99999')
|
130
|
+
assert_equal "rn:R99999", @obj.reaction
|
131
|
+
assert_equal "rn:R98765", (@obj.reaction = 'rn:R98765')
|
132
|
+
assert_equal "rn:R98765", @obj.reaction
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_graphics=()
|
136
|
+
a = [ nil, nil ]
|
137
|
+
b = [ nil, nil, nil ]
|
138
|
+
assert_equal a, (@obj.graphics = a)
|
139
|
+
assert_equal a, @obj.graphics
|
140
|
+
assert_equal b, (@obj.graphics = b)
|
141
|
+
assert_equal b, @obj.graphics
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_components=()
|
145
|
+
a = [ nil, nil ]
|
146
|
+
b = [ nil, nil, nil ]
|
147
|
+
assert_equal a, (@obj.components = a)
|
148
|
+
assert_equal a, @obj.components
|
149
|
+
assert_equal b, (@obj.components = b)
|
150
|
+
assert_equal b, @obj.components
|
151
|
+
end
|
152
|
+
end #class TestKGMLEntrySetter
|
153
|
+
|
154
|
+
# for deprecated methods/attributes
|
155
|
+
class TestKGMLEntrySetterDeprecated < Test::Unit::TestCase
|
156
|
+
def setup
|
157
|
+
@obj = Bio::KEGG::KGML::Entry.new
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_entry_id=()
|
161
|
+
assert_nil @obj.entry_id
|
162
|
+
assert_equal 1234, (@obj.entry_id = 1234)
|
163
|
+
assert_equal 1234, @obj.entry_id
|
164
|
+
assert_equal 4567, (@obj.entry_id = 4567)
|
165
|
+
assert_equal 4567, @obj.entry_id
|
166
|
+
|
167
|
+
assert_equal 4567, @obj.id
|
168
|
+
@obj.id = 7890
|
169
|
+
assert_equal 7890, @obj.entry_id
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_category=()
|
173
|
+
assert_nil @obj.category
|
174
|
+
assert_equal 'compound', (@obj.category = 'compound')
|
175
|
+
assert_equal 'compound', @obj.category
|
176
|
+
assert_equal 'enzyme', (@obj.category = 'enzyme')
|
177
|
+
assert_equal 'enzyme', @obj.category
|
178
|
+
|
179
|
+
assert_equal 'enzyme', @obj.type
|
180
|
+
@obj.type = 'gene'
|
181
|
+
assert_equal 'gene', @obj.category
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_pathway=()
|
185
|
+
assert_nil @obj.pathway
|
186
|
+
assert_equal 'deprecated', (@obj.pathway = 'deprecated')
|
187
|
+
assert_equal 'deprecated', @obj.pathway
|
188
|
+
assert_equal "don't use", (@obj.pathway = "don't use")
|
189
|
+
assert_equal "don't use", @obj.pathway
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_label=()
|
193
|
+
assert_nil @obj.label
|
194
|
+
assert_equal 'deprecated', (@obj.label = 'deprecated')
|
195
|
+
assert_equal 'deprecated', @obj.label
|
196
|
+
|
197
|
+
assert_equal "don't use", (@obj.label = "don't use")
|
198
|
+
assert_equal "don't use", @obj.label
|
199
|
+
|
200
|
+
assert_equal "don't use", @obj.graphics[-1].name
|
201
|
+
@obj.graphics[-1].name = 'test'
|
202
|
+
assert_equal 'test', @obj.label
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_shape=()
|
206
|
+
assert_nil @obj.shape
|
207
|
+
assert_equal 'deprecated', (@obj.shape = 'deprecated')
|
208
|
+
assert_equal 'deprecated', @obj.shape
|
209
|
+
|
210
|
+
assert_equal "don't use", (@obj.shape = "don't use")
|
211
|
+
assert_equal "don't use", @obj.shape
|
212
|
+
|
213
|
+
assert_equal "don't use", @obj.graphics[-1].type
|
214
|
+
@obj.graphics[-1].type = 'test'
|
215
|
+
assert_equal 'test', @obj.shape
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_x=()
|
219
|
+
assert_equal 123, (@obj.x = 123)
|
220
|
+
assert_equal 123, @obj.x
|
221
|
+
|
222
|
+
assert_equal 456, (@obj.x = 456)
|
223
|
+
assert_equal 456, @obj.x
|
224
|
+
|
225
|
+
assert_equal 456, @obj.graphics[-1].x
|
226
|
+
@obj.graphics[-1].x = 789
|
227
|
+
assert_equal 789, @obj.x
|
228
|
+
end
|
229
|
+
|
230
|
+
def test_y=()
|
231
|
+
assert_equal 123, (@obj.y = 123)
|
232
|
+
assert_equal 123, @obj.y
|
233
|
+
|
234
|
+
assert_equal 456, (@obj.y = 456)
|
235
|
+
assert_equal 456, @obj.y
|
236
|
+
|
237
|
+
assert_equal 456, @obj.graphics[-1].y
|
238
|
+
@obj.graphics[-1].y = 789
|
239
|
+
assert_equal 789, @obj.y
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_width=()
|
243
|
+
assert_equal 123, (@obj.width = 123)
|
244
|
+
assert_equal 123, @obj.width
|
245
|
+
|
246
|
+
assert_equal 456, (@obj.width = 456)
|
247
|
+
assert_equal 456, @obj.width
|
248
|
+
|
249
|
+
assert_equal 456, @obj.graphics[-1].width
|
250
|
+
@obj.graphics[-1].width = 789
|
251
|
+
assert_equal 789, @obj.width
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_height=()
|
255
|
+
assert_equal 123, (@obj.height = 123)
|
256
|
+
assert_equal 123, @obj.height
|
257
|
+
|
258
|
+
assert_equal 456, (@obj.height = 456)
|
259
|
+
assert_equal 456, @obj.height
|
260
|
+
|
261
|
+
assert_equal 456, @obj.graphics[-1].height
|
262
|
+
@obj.graphics[-1].height = 789
|
263
|
+
assert_equal 789, @obj.height
|
264
|
+
end
|
265
|
+
|
266
|
+
def test_fgcolor=()
|
267
|
+
assert_equal "#E0E0E0", (@obj.fgcolor = "#E0E0E0")
|
268
|
+
assert_equal "#E0E0E0", @obj.fgcolor
|
269
|
+
|
270
|
+
assert_equal "#FFFFFF", (@obj.fgcolor = "#FFFFFF")
|
271
|
+
assert_equal "#FFFFFF", @obj.fgcolor
|
272
|
+
|
273
|
+
assert_equal "#FFFFFF", @obj.graphics[-1].fgcolor
|
274
|
+
@obj.graphics[-1].fgcolor = "#99CCFF"
|
275
|
+
assert_equal "#99CCFF", @obj.fgcolor
|
276
|
+
end
|
277
|
+
|
278
|
+
def test_bgcolor=()
|
279
|
+
assert_equal "#E0E0E0", (@obj.bgcolor = "#E0E0E0")
|
280
|
+
assert_equal "#E0E0E0", @obj.bgcolor
|
281
|
+
|
282
|
+
assert_equal "#FFFFFF", (@obj.bgcolor = "#FFFFFF")
|
283
|
+
assert_equal "#FFFFFF", @obj.bgcolor
|
284
|
+
|
285
|
+
assert_equal "#FFFFFF", @obj.graphics[-1].bgcolor
|
286
|
+
@obj.graphics[-1].bgcolor = "#99CCFF"
|
287
|
+
assert_equal "#99CCFF", @obj.bgcolor
|
288
|
+
end
|
289
|
+
end #class TestKGMLEntrySetterDeprecated
|
290
|
+
|
291
|
+
class TestKGMLEntry1234 < Test::Unit::TestCase
|
292
|
+
def setup
|
293
|
+
xmlstr = KGMLTestXMLstr
|
294
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).entries[0]
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_id
|
298
|
+
assert_equal 1234, @obj.id
|
299
|
+
end
|
300
|
+
|
301
|
+
def test_name
|
302
|
+
assert_equal 'cpd:C99999', @obj.name
|
303
|
+
end
|
304
|
+
|
305
|
+
def test_type
|
306
|
+
assert_equal 'compound', @obj.type
|
307
|
+
end
|
308
|
+
|
309
|
+
def test_link
|
310
|
+
assert_equal 'http://example.com/dbget-bin/www_bget?C99999', @obj.link
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_reaction
|
314
|
+
assert_equal nil, @obj.reaction
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_graphics__size
|
318
|
+
assert_equal 1, @obj.graphics.size
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_components
|
322
|
+
assert_equal nil, @obj.components
|
323
|
+
end
|
324
|
+
end #class TestKGMLEntry1234
|
325
|
+
|
326
|
+
class TestKGMLEntry1 < Test::Unit::TestCase
|
327
|
+
def setup
|
328
|
+
xmlstr = KGMLTestXMLstr
|
329
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).entries[1]
|
330
|
+
end
|
331
|
+
|
332
|
+
def test_id
|
333
|
+
assert_equal 1, @obj.id
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_name
|
337
|
+
assert_equal 'ec:1.1.1.1', @obj.name
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_type
|
341
|
+
assert_equal 'enzyme', @obj.type
|
342
|
+
end
|
343
|
+
|
344
|
+
def test_link
|
345
|
+
assert_equal 'http://example.com/dbget-bin/www_bget?1.1.1.1', @obj.link
|
346
|
+
end
|
347
|
+
|
348
|
+
def test_reaction
|
349
|
+
assert_equal 'rn:R99999', @obj.reaction
|
350
|
+
end
|
351
|
+
|
352
|
+
def test_graphics__size
|
353
|
+
assert_equal 2, @obj.graphics.size
|
354
|
+
end
|
355
|
+
|
356
|
+
def test_components
|
357
|
+
assert_equal nil, @obj.components
|
358
|
+
end
|
359
|
+
end #class TestKGMLEntry1
|
360
|
+
|
361
|
+
# for deprecated methods/attributes
|
362
|
+
class TestKGMLEntry1Deprecated < Test::Unit::TestCase
|
363
|
+
def setup
|
364
|
+
xmlstr = KGMLTestXMLstr
|
365
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).entries[1]
|
366
|
+
end
|
367
|
+
|
368
|
+
def test_entry_id
|
369
|
+
assert_equal 1, @obj.entry_id
|
370
|
+
end
|
371
|
+
|
372
|
+
def test_category
|
373
|
+
assert_equal 'enzyme', @obj.category
|
374
|
+
end
|
375
|
+
|
376
|
+
def test_label=()
|
377
|
+
assert_equal '1.1.1.1', @obj.label
|
378
|
+
assert_equal '1.2.3.4', (@obj.label = '1.2.3.4')
|
379
|
+
assert_equal '1.2.3.4', @obj.label
|
380
|
+
assert_equal '1.2.3.4', @obj.graphics[-1].name
|
381
|
+
assert_equal '9.8.7.6', (@obj.graphics[-1].name = '9.8.7.6')
|
382
|
+
assert_equal '9.8.7.6', @obj.label
|
383
|
+
# check if it doesn't modify graphics[0]
|
384
|
+
assert_equal '1.1.1.1', @obj.graphics[0].name
|
385
|
+
end
|
386
|
+
|
387
|
+
def test_shape=()
|
388
|
+
assert_equal 'line', @obj.shape
|
389
|
+
assert_equal 'circle', (@obj.shape = 'circle')
|
390
|
+
assert_equal 'circle', @obj.shape
|
391
|
+
assert_equal 'circle', @obj.graphics[-1].type
|
392
|
+
assert_equal 'rectangle', (@obj.graphics[-1].type = 'rectangle')
|
393
|
+
assert_equal 'rectangle', @obj.shape
|
394
|
+
# check if it doesn't modify graphics[0]
|
395
|
+
assert_equal 'line', @obj.graphics[0].type
|
396
|
+
end
|
397
|
+
|
398
|
+
def test_x=()
|
399
|
+
assert_equal 0, @obj.x
|
400
|
+
|
401
|
+
assert_equal 123, (@obj.x = 123)
|
402
|
+
assert_equal 123, @obj.x
|
403
|
+
|
404
|
+
assert_equal 456, (@obj.x = 456)
|
405
|
+
assert_equal 456, @obj.x
|
406
|
+
|
407
|
+
assert_equal 456, @obj.graphics[-1].x
|
408
|
+
@obj.graphics[-1].x = 789
|
409
|
+
assert_equal 789, @obj.x
|
410
|
+
|
411
|
+
# check if it doesn't modify graphics[0]
|
412
|
+
assert_equal 0, @obj.graphics[0].x
|
413
|
+
end
|
414
|
+
|
415
|
+
def test_y=()
|
416
|
+
assert_equal 0, @obj.y
|
417
|
+
|
418
|
+
assert_equal 123, (@obj.y = 123)
|
419
|
+
assert_equal 123, @obj.y
|
420
|
+
|
421
|
+
assert_equal 456, (@obj.y = 456)
|
422
|
+
assert_equal 456, @obj.y
|
423
|
+
|
424
|
+
assert_equal 456, @obj.graphics[-1].y
|
425
|
+
@obj.graphics[-1].y = 789
|
426
|
+
assert_equal 789, @obj.y
|
427
|
+
|
428
|
+
# check if it doesn't modify graphics[0]
|
429
|
+
assert_equal 0, @obj.graphics[0].y
|
430
|
+
end
|
431
|
+
|
432
|
+
def test_width=()
|
433
|
+
assert_equal 0, @obj.width
|
434
|
+
|
435
|
+
assert_equal 123, (@obj.width = 123)
|
436
|
+
assert_equal 123, @obj.width
|
437
|
+
|
438
|
+
assert_equal 456, (@obj.width = 456)
|
439
|
+
assert_equal 456, @obj.width
|
440
|
+
|
441
|
+
assert_equal 456, @obj.graphics[-1].width
|
442
|
+
@obj.graphics[-1].width = 789
|
443
|
+
assert_equal 789, @obj.width
|
444
|
+
|
445
|
+
# check if it doesn't modify graphics[0]
|
446
|
+
assert_equal 0, @obj.graphics[0].width
|
447
|
+
end
|
448
|
+
|
449
|
+
def test_height=()
|
450
|
+
assert_equal 0, @obj.height
|
451
|
+
|
452
|
+
assert_equal 123, (@obj.height = 123)
|
453
|
+
assert_equal 123, @obj.height
|
454
|
+
|
455
|
+
assert_equal 456, (@obj.height = 456)
|
456
|
+
assert_equal 456, @obj.height
|
457
|
+
|
458
|
+
assert_equal 456, @obj.graphics[-1].height
|
459
|
+
@obj.graphics[-1].height = 789
|
460
|
+
assert_equal 789, @obj.height
|
461
|
+
|
462
|
+
# check if it doesn't modify graphics[0]
|
463
|
+
assert_equal 0, @obj.graphics[0].height
|
464
|
+
end
|
465
|
+
|
466
|
+
def test_fgcolor=()
|
467
|
+
assert_equal '#FF99CC', @obj.fgcolor
|
468
|
+
|
469
|
+
assert_equal "#E0E0E0", (@obj.fgcolor = "#E0E0E0")
|
470
|
+
assert_equal "#E0E0E0", @obj.fgcolor
|
471
|
+
|
472
|
+
assert_equal "#E0E0E0", @obj.graphics[-1].fgcolor
|
473
|
+
@obj.graphics[-1].fgcolor = "#C0C0C0"
|
474
|
+
assert_equal "#C0C0C0", @obj.fgcolor
|
475
|
+
|
476
|
+
# check if it doesn't modify graphics[0]
|
477
|
+
assert_equal "#99CCFF", @obj.graphics[0].fgcolor
|
478
|
+
end
|
479
|
+
|
480
|
+
def test_bgcolor=()
|
481
|
+
assert_equal "#CC99FF", @obj.bgcolor
|
482
|
+
|
483
|
+
assert_equal "#E0E0E0", (@obj.bgcolor = "#E0E0E0")
|
484
|
+
assert_equal "#E0E0E0", @obj.bgcolor
|
485
|
+
|
486
|
+
assert_equal "#E0E0E0", @obj.graphics[-1].bgcolor
|
487
|
+
@obj.graphics[-1].bgcolor = "#C0C0C0"
|
488
|
+
assert_equal "#C0C0C0", @obj.bgcolor
|
489
|
+
|
490
|
+
# check if it doesn't modify graphics[0]
|
491
|
+
assert_equal "#FFFFFF", @obj.graphics[0].bgcolor
|
492
|
+
end
|
493
|
+
end #class TestKGMLEntry1Deprecated
|
494
|
+
|
495
|
+
class TestKGMLEntry567 < Test::Unit::TestCase
|
496
|
+
def setup
|
497
|
+
xmlstr = KGMLTestXMLstr
|
498
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).entries[2]
|
499
|
+
end
|
500
|
+
|
501
|
+
def test_id
|
502
|
+
assert_equal 567, @obj.id
|
503
|
+
end
|
504
|
+
|
505
|
+
def test_name
|
506
|
+
assert_equal 'undefined', @obj.name
|
507
|
+
end
|
508
|
+
|
509
|
+
def test_type
|
510
|
+
assert_equal 'group', @obj.type
|
511
|
+
end
|
512
|
+
|
513
|
+
def test_link
|
514
|
+
assert_equal nil, @obj.link
|
515
|
+
end
|
516
|
+
|
517
|
+
def test_reaction
|
518
|
+
assert_equal nil, @obj.reaction
|
519
|
+
end
|
520
|
+
|
521
|
+
def test_graphics__size
|
522
|
+
assert_equal 1, @obj.graphics.size
|
523
|
+
end
|
524
|
+
|
525
|
+
def test_components
|
526
|
+
assert_equal [ 34, 56, 78, 90 ], @obj.components
|
527
|
+
end
|
528
|
+
end #class TestKGMLEntry567
|
529
|
+
|
530
|
+
class TestKGMLGraphicsSetter < Test::Unit::TestCase
|
531
|
+
def setup
|
532
|
+
@obj = Bio::KEGG::KGML::Graphics.new
|
533
|
+
end
|
534
|
+
|
535
|
+
def test_name=()
|
536
|
+
assert_equal '1.1.1.1', (@obj.name = '1.1.1.1')
|
537
|
+
assert_equal '1.1.1.1', @obj.name
|
538
|
+
assert_equal 'C99999', (@obj.name = 'C99999')
|
539
|
+
assert_equal 'C99999', @obj.name
|
540
|
+
end
|
541
|
+
|
542
|
+
def test_type=()
|
543
|
+
assert_equal 'line', (@obj.type = 'line')
|
544
|
+
assert_equal 'line', @obj.type
|
545
|
+
assert_equal 'circle', (@obj.type = 'circle')
|
546
|
+
assert_equal 'circle', @obj.type
|
547
|
+
end
|
548
|
+
|
549
|
+
def test_x=()
|
550
|
+
assert_equal 123, (@obj.x = 123)
|
551
|
+
assert_equal 123, @obj.x
|
552
|
+
assert_equal 456, (@obj.x = 456)
|
553
|
+
assert_equal 456, @obj.x
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_y=()
|
557
|
+
assert_equal 123, (@obj.y = 123)
|
558
|
+
assert_equal 123, @obj.y
|
559
|
+
assert_equal 456, (@obj.y = 456)
|
560
|
+
assert_equal 456, @obj.y
|
561
|
+
end
|
562
|
+
|
563
|
+
def test_width=()
|
564
|
+
assert_equal 123, (@obj.width = 123)
|
565
|
+
assert_equal 123, @obj.width
|
566
|
+
assert_equal 456, (@obj.width = 456)
|
567
|
+
assert_equal 456, @obj.width
|
568
|
+
end
|
569
|
+
|
570
|
+
def test_height=()
|
571
|
+
assert_equal 123, (@obj.height = 123)
|
572
|
+
assert_equal 123, @obj.height
|
573
|
+
assert_equal 456, (@obj.height = 456)
|
574
|
+
assert_equal 456, @obj.height
|
575
|
+
end
|
576
|
+
|
577
|
+
def test_fgcolor=()
|
578
|
+
assert_equal "#E0E0E0", (@obj.fgcolor = "#E0E0E0")
|
579
|
+
assert_equal "#E0E0E0", @obj.fgcolor
|
580
|
+
assert_equal "#FFFFFF", (@obj.fgcolor = "#FFFFFF")
|
581
|
+
assert_equal "#FFFFFF", @obj.fgcolor
|
582
|
+
end
|
583
|
+
|
584
|
+
def test_bgcolor=()
|
585
|
+
assert_equal "#E0E0E0", (@obj.bgcolor = "#E0E0E0")
|
586
|
+
assert_equal "#E0E0E0", @obj.bgcolor
|
587
|
+
assert_equal "#FFFFFF", (@obj.bgcolor = "#FFFFFF")
|
588
|
+
assert_equal "#FFFFFF", @obj.bgcolor
|
589
|
+
end
|
590
|
+
|
591
|
+
def test_coords=()
|
592
|
+
a = [[1, 2], [3, 4]]
|
593
|
+
b = [[5, 6], [7, 8], [9, 10]]
|
594
|
+
assert_equal a, (@obj.coords = a)
|
595
|
+
assert_equal a, @obj.coords
|
596
|
+
assert_equal b, (@obj.coords = b)
|
597
|
+
assert_equal b, @obj.coords
|
598
|
+
end
|
599
|
+
end #class TestKGMLGraphicsSetter
|
600
|
+
|
601
|
+
class TestKGMLGraphics1234 < Test::Unit::TestCase
|
602
|
+
def setup
|
603
|
+
xmlstr = KGMLTestXMLstr
|
604
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).entries[0].graphics[0]
|
605
|
+
end
|
606
|
+
|
607
|
+
def test_name
|
608
|
+
assert_equal 'C99999', @obj.name
|
609
|
+
end
|
610
|
+
|
611
|
+
def test_type
|
612
|
+
assert_equal 'circle', @obj.type
|
613
|
+
end
|
614
|
+
|
615
|
+
def test_fgcolor
|
616
|
+
assert_equal "#E0E0E0", @obj.fgcolor
|
617
|
+
end
|
618
|
+
|
619
|
+
def test_bgcolor
|
620
|
+
assert_equal "#D0E0F0", @obj.bgcolor
|
621
|
+
end
|
622
|
+
|
623
|
+
def test_x
|
624
|
+
assert_equal 1314, @obj.x
|
625
|
+
end
|
626
|
+
|
627
|
+
def test_y
|
628
|
+
assert_equal 1008, @obj.y
|
629
|
+
end
|
630
|
+
|
631
|
+
def test_width
|
632
|
+
assert_equal 14, @obj.width
|
633
|
+
end
|
634
|
+
|
635
|
+
def test_height
|
636
|
+
assert_equal 28, @obj.height
|
637
|
+
end
|
638
|
+
|
639
|
+
def test_coords
|
640
|
+
assert_equal nil, @obj.coords
|
641
|
+
end
|
642
|
+
end #class TestKGMLGraphics1234
|
643
|
+
|
644
|
+
class TestKGMLGraphics1_0 < Test::Unit::TestCase
|
645
|
+
def setup
|
646
|
+
xmlstr = KGMLTestXMLstr
|
647
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).entries[1].graphics[0]
|
648
|
+
end
|
649
|
+
|
650
|
+
def test_name
|
651
|
+
assert_equal '1.1.1.1', @obj.name
|
652
|
+
end
|
653
|
+
|
654
|
+
def test_type
|
655
|
+
assert_equal 'line', @obj.type
|
656
|
+
end
|
657
|
+
|
658
|
+
def test_fgcolor
|
659
|
+
assert_equal "#99CCFF", @obj.fgcolor
|
660
|
+
end
|
661
|
+
|
662
|
+
def test_bgcolor
|
663
|
+
assert_equal "#FFFFFF", @obj.bgcolor
|
664
|
+
end
|
665
|
+
|
666
|
+
def test_x
|
667
|
+
assert_equal 0, @obj.x
|
668
|
+
end
|
669
|
+
|
670
|
+
def test_y
|
671
|
+
assert_equal 0, @obj.y
|
672
|
+
end
|
673
|
+
|
674
|
+
def test_width
|
675
|
+
assert_equal 0, @obj.width
|
676
|
+
end
|
677
|
+
|
678
|
+
def test_height
|
679
|
+
assert_equal 0, @obj.height
|
680
|
+
end
|
681
|
+
|
682
|
+
def test_coords
|
683
|
+
assert_equal [[314,159], [265,358], [979,323]], @obj.coords
|
684
|
+
end
|
685
|
+
end #class TestKGMLGraphics1_0
|
686
|
+
|
687
|
+
class TestKGMLRelationSetter < Test::Unit::TestCase
|
688
|
+
def setup
|
689
|
+
@obj = Bio::KEGG::KGML::Relation.new
|
690
|
+
end
|
691
|
+
|
692
|
+
def test_entry1=()
|
693
|
+
assert_nil @obj.entry1
|
694
|
+
assert_equal 123, (@obj.entry1 = 123)
|
695
|
+
assert_equal 123, @obj.entry1
|
696
|
+
assert_equal 456, (@obj.entry1 = 456)
|
697
|
+
assert_equal 456, @obj.entry1
|
698
|
+
end
|
699
|
+
|
700
|
+
def test_entry2=()
|
701
|
+
assert_nil @obj.entry2
|
702
|
+
assert_equal 123, (@obj.entry2 = 123)
|
703
|
+
assert_equal 123, @obj.entry2
|
704
|
+
assert_equal 456, (@obj.entry2 = 456)
|
705
|
+
assert_equal 456, @obj.entry2
|
706
|
+
end
|
707
|
+
|
708
|
+
def test_type=()
|
709
|
+
assert_nil @obj.type
|
710
|
+
assert_equal "ECrel", (@obj.type = "ECrel")
|
711
|
+
assert_equal "ECrel", @obj.type
|
712
|
+
assert_equal "maplink", (@obj.type = "maplink")
|
713
|
+
assert_equal "maplink", @obj.type
|
714
|
+
end
|
715
|
+
|
716
|
+
def test_name=()
|
717
|
+
assert_nil @obj.name
|
718
|
+
assert_equal "hidden compound", (@obj.name = "hidden compound")
|
719
|
+
assert_equal "hidden compound", @obj.name
|
720
|
+
assert_equal "indirect effect", (@obj.name = "indirect effect")
|
721
|
+
assert_equal "indirect effect", @obj.name
|
722
|
+
end
|
723
|
+
|
724
|
+
def test_value=()
|
725
|
+
assert_nil @obj.value
|
726
|
+
assert_equal "123", (@obj.value = "123")
|
727
|
+
assert_equal "123", @obj.value
|
728
|
+
assert_equal "-->", (@obj.value = "-->")
|
729
|
+
assert_equal "-->", @obj.value
|
730
|
+
end
|
731
|
+
end #class TestKGMLRelationSetter
|
732
|
+
|
733
|
+
# for deprecated methods/attributes
|
734
|
+
class TestKGMLRelationDeprecated < Test::Unit::TestCase
|
735
|
+
def setup
|
736
|
+
@obj = Bio::KEGG::KGML::Relation.new
|
737
|
+
end
|
738
|
+
|
739
|
+
def test_node1=()
|
740
|
+
assert_nil @obj.node1
|
741
|
+
assert_equal 123, (@obj.node1 = 123)
|
742
|
+
assert_equal 123, @obj.node1
|
743
|
+
assert_equal 456, (@obj.node1 = 456)
|
744
|
+
assert_equal 456, @obj.node1
|
745
|
+
|
746
|
+
assert_equal 456, @obj.entry1
|
747
|
+
@obj.entry1 = 789
|
748
|
+
assert_equal 789, @obj.node1
|
749
|
+
end
|
750
|
+
|
751
|
+
def test_node2=()
|
752
|
+
assert_nil @obj.node2
|
753
|
+
assert_equal 123, (@obj.node2 = 123)
|
754
|
+
assert_equal 123, @obj.node2
|
755
|
+
assert_equal 456, (@obj.node2 = 456)
|
756
|
+
assert_equal 456, @obj.node2
|
757
|
+
|
758
|
+
assert_equal 456, @obj.entry2
|
759
|
+
@obj.entry2 = 789
|
760
|
+
assert_equal 789, @obj.node2
|
761
|
+
end
|
762
|
+
|
763
|
+
def test_rel=()
|
764
|
+
assert_nil @obj.rel
|
765
|
+
assert_equal "ECrel", (@obj.rel = "ECrel")
|
766
|
+
assert_equal "ECrel", @obj.rel
|
767
|
+
assert_equal "maplink", (@obj.rel = "maplink")
|
768
|
+
assert_equal "maplink", @obj.rel
|
769
|
+
|
770
|
+
assert_equal "maplink", @obj.type
|
771
|
+
@obj.type = "PCrel"
|
772
|
+
assert_equal "PCrel", @obj.rel
|
773
|
+
end
|
774
|
+
|
775
|
+
def test_edge
|
776
|
+
@obj.value = "123"
|
777
|
+
assert_equal 123, @obj.edge
|
778
|
+
end
|
779
|
+
end #class TestKGMLRelationDeprecated
|
780
|
+
|
781
|
+
class TestKGMLRelation < Test::Unit::TestCase
|
782
|
+
def setup
|
783
|
+
xmlstr = KGMLTestXMLstr
|
784
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).relations[0]
|
785
|
+
end
|
786
|
+
|
787
|
+
def test_entry1
|
788
|
+
assert_equal 109, @obj.entry1
|
789
|
+
end
|
790
|
+
|
791
|
+
def test_entry2
|
792
|
+
assert_equal 87, @obj.entry2
|
793
|
+
end
|
794
|
+
|
795
|
+
def test_type
|
796
|
+
assert_equal "ECrel", @obj.type
|
797
|
+
end
|
798
|
+
|
799
|
+
def test_name
|
800
|
+
assert_equal "compound", @obj.name
|
801
|
+
end
|
802
|
+
|
803
|
+
def test_value
|
804
|
+
assert_equal "100", @obj.value
|
805
|
+
end
|
806
|
+
end #class TestKGMLRelation
|
807
|
+
|
808
|
+
class TestKGMLReactionSetter < Test::Unit::TestCase
|
809
|
+
def setup
|
810
|
+
@obj = Bio::KEGG::KGML::Reaction.new
|
811
|
+
end
|
812
|
+
|
813
|
+
def test_id=()
|
814
|
+
assert_nil @obj.id
|
815
|
+
assert_equal 1234, (@obj.id = 1234)
|
816
|
+
assert_equal 1234, @obj.id
|
817
|
+
assert_equal 4567, (@obj.id = 4567)
|
818
|
+
assert_equal 4567, @obj.id
|
819
|
+
end
|
820
|
+
|
821
|
+
def test_name=()
|
822
|
+
assert_nil @obj.name
|
823
|
+
assert_equal 'rn:R99999 rn:R99998',
|
824
|
+
(@obj.name = 'rn:R99999 rn:R99998')
|
825
|
+
assert_equal 'rn:R99999 rn:R99998', @obj.name
|
826
|
+
assert_equal 'rn:R98765 rn:R98764',
|
827
|
+
(@obj.name = 'rn:R98765 rn:R98764')
|
828
|
+
assert_equal 'rn:R98765 rn:R98764', @obj.name
|
829
|
+
end
|
830
|
+
|
831
|
+
def test_type=()
|
832
|
+
assert_nil @obj.type
|
833
|
+
assert_equal 'reversible', (@obj.type = 'reversible')
|
834
|
+
assert_equal 'reversible', @obj.type
|
835
|
+
assert_equal 'irreversible', (@obj.type = 'irreversible')
|
836
|
+
assert_equal 'irreversible', @obj.type
|
837
|
+
end
|
838
|
+
|
839
|
+
def test_substraces=()
|
840
|
+
assert_nil @obj.substrates
|
841
|
+
a = [ nil, nil ]
|
842
|
+
b = [ nil, nil, nil ]
|
843
|
+
assert_equal a, (@obj.substrates = a)
|
844
|
+
assert_equal a, @obj.substrates
|
845
|
+
assert_equal b, (@obj.substrates = b)
|
846
|
+
assert_equal b, @obj.substrates
|
847
|
+
end
|
848
|
+
|
849
|
+
def test_products=()
|
850
|
+
assert_nil @obj.products
|
851
|
+
a = [ nil, nil ]
|
852
|
+
b = [ nil, nil, nil ]
|
853
|
+
assert_equal a, (@obj.products = a)
|
854
|
+
assert_equal a, @obj.products
|
855
|
+
assert_equal b, (@obj.products = b)
|
856
|
+
assert_equal b, @obj.products
|
857
|
+
end
|
858
|
+
|
859
|
+
# TODO: add tests for alt
|
860
|
+
end #class TestKGMLReactionSetter
|
861
|
+
|
862
|
+
class TestKGMLReactionSetterDeprecated < Test::Unit::TestCase
|
863
|
+
def setup
|
864
|
+
@obj = Bio::KEGG::KGML::Reaction.new
|
865
|
+
end
|
866
|
+
|
867
|
+
def test_entry_id=()
|
868
|
+
assert_nil @obj.entry_id
|
869
|
+
assert_equal "rn:R99999 rn:R99998",
|
870
|
+
(@obj.entry_id = "rn:R99999 rn:R99998")
|
871
|
+
assert_equal "rn:R99999 rn:R99998", @obj.entry_id
|
872
|
+
assert_equal "rn:R99990 rn:R99991",
|
873
|
+
(@obj.entry_id = "rn:R99990 rn:R99991")
|
874
|
+
assert_equal "rn:R99990 rn:R99991", @obj.entry_id
|
875
|
+
|
876
|
+
assert_equal "rn:R99990 rn:R99991", @obj.name
|
877
|
+
@obj.name = "rn:R98765 rn:R98766"
|
878
|
+
assert_equal "rn:R98765 rn:R98766", @obj.entry_id
|
879
|
+
end
|
880
|
+
|
881
|
+
def test_direction=()
|
882
|
+
assert_nil @obj.direction
|
883
|
+
assert_equal 'reversible', (@obj.direction = 'reversible')
|
884
|
+
assert_equal 'reversible', @obj.direction
|
885
|
+
assert_equal 'irreversible', (@obj.direction = 'irreversible')
|
886
|
+
assert_equal 'irreversible', @obj.direction
|
887
|
+
|
888
|
+
assert_equal 'irreversible', @obj.type
|
889
|
+
@obj.type = 'this is test'
|
890
|
+
assert_equal 'this is test', @obj.direction
|
891
|
+
end
|
892
|
+
end #class TestKGMLReactionSetterDreprecated
|
893
|
+
|
894
|
+
class TestKGMLReaction < Test::Unit::TestCase
|
895
|
+
def setup
|
896
|
+
xmlstr = KGMLTestXMLstr
|
897
|
+
@obj = Bio::KEGG::KGML.new(xmlstr).reactions[0]
|
898
|
+
end
|
899
|
+
|
900
|
+
def test_id
|
901
|
+
assert_equal 3, @obj.id
|
902
|
+
end
|
903
|
+
|
904
|
+
def test_name
|
905
|
+
assert_equal "rn:R99999 rn:R99998", @obj.name
|
906
|
+
end
|
907
|
+
|
908
|
+
def test_type
|
909
|
+
assert_equal "reversible", @obj.type
|
910
|
+
end
|
911
|
+
|
912
|
+
def test_substrates
|
913
|
+
assert_equal [ "cpd:C99990", "cpd:C99991" ],
|
914
|
+
@obj.substrates.collect { |x| x.name }
|
915
|
+
|
916
|
+
assert_equal [ 3330, 3331 ],
|
917
|
+
@obj.substrates.collect { |x| x.id }
|
918
|
+
end
|
919
|
+
|
920
|
+
def test_products
|
921
|
+
assert_equal [ "cpd:C99902", "cpd:C99903" ],
|
922
|
+
@obj.products.collect { |x| x.name }
|
923
|
+
|
924
|
+
assert_equal [ 3332, 3333 ],
|
925
|
+
@obj.products.collect { |x| x.id }
|
926
|
+
end
|
927
|
+
end #class TestKGMLReaction
|
928
|
+
|
929
|
+
class TestKGMLSubstrate < Test::Unit::TestCase
|
930
|
+
def setup
|
931
|
+
xmlstr = KGMLTestXMLstr
|
932
|
+
@obj0 = Bio::KEGG::KGML.new(xmlstr).reactions[0].substrates[0]
|
933
|
+
@obj1 = Bio::KEGG::KGML.new(xmlstr).reactions[0].substrates[1]
|
934
|
+
end
|
935
|
+
|
936
|
+
def test_id
|
937
|
+
assert_equal 3330, @obj0.id
|
938
|
+
assert_equal 3331, @obj1.id
|
939
|
+
end
|
940
|
+
|
941
|
+
def test_name
|
942
|
+
assert_equal 'cpd:C99990', @obj0.name
|
943
|
+
assert_equal 'cpd:C99991', @obj1.name
|
944
|
+
end
|
945
|
+
end #class TestKGMLSubstrate
|
946
|
+
|
947
|
+
class TestKGMLProduct < Test::Unit::TestCase
|
948
|
+
def setup
|
949
|
+
xmlstr = KGMLTestXMLstr
|
950
|
+
@obj0 = Bio::KEGG::KGML.new(xmlstr).reactions[0].products[0]
|
951
|
+
@obj1 = Bio::KEGG::KGML.new(xmlstr).reactions[0].products[1]
|
952
|
+
end
|
953
|
+
|
954
|
+
def test_id
|
955
|
+
assert_equal 3332, @obj0.id
|
956
|
+
assert_equal 3333, @obj1.id
|
957
|
+
end
|
958
|
+
|
959
|
+
def test_name
|
960
|
+
assert_equal 'cpd:C99902', @obj0.name
|
961
|
+
assert_equal 'cpd:C99903', @obj1.name
|
962
|
+
end
|
963
|
+
end #class TestKGMLProduct
|
964
|
+
|
965
|
+
module TestKGMLSubstrateProductSetterMethods
|
966
|
+
def test_initialize_0
|
967
|
+
assert_nil @obj.id
|
968
|
+
assert_nil @obj.name
|
969
|
+
end
|
970
|
+
|
971
|
+
def test_initialize_1
|
972
|
+
obj = Bio::KEGG::KGML::SubstrateProduct.new(123)
|
973
|
+
assert_equal 123, obj.id
|
974
|
+
assert_nil obj.name
|
975
|
+
end
|
976
|
+
|
977
|
+
def test_initialize_2
|
978
|
+
obj = Bio::KEGG::KGML::SubstrateProduct.new(123, 'test')
|
979
|
+
assert_equal 123, obj.id
|
980
|
+
assert_equal 'test', obj.name
|
981
|
+
end
|
982
|
+
|
983
|
+
def test_id=()
|
984
|
+
assert_nil @obj.id
|
985
|
+
assert_equal 123, (@obj.id = 123)
|
986
|
+
assert_equal 123, @obj.id
|
987
|
+
assert_equal 456, (@obj.id = 456)
|
988
|
+
assert_equal 456, @obj.id
|
989
|
+
end
|
990
|
+
|
991
|
+
def test_name=()
|
992
|
+
assert_nil @obj.name
|
993
|
+
assert_equal "cpd:C99990", (@obj.name = "cpd:C99990")
|
994
|
+
assert_equal "cpd:C99990", @obj.name
|
995
|
+
assert_equal "cpd:C99902", (@obj.name = "cpd:C99902")
|
996
|
+
assert_equal "cpd:C99902", @obj.name
|
997
|
+
end
|
998
|
+
end #module TestKGMLSubstrateProductSetterMethods
|
999
|
+
|
1000
|
+
class TestKGMLSubstrateProductSetter < Test::Unit::TestCase
|
1001
|
+
include TestKGMLSubstrateProductSetterMethods
|
1002
|
+
def setup
|
1003
|
+
@obj = Bio::KEGG::KGML::SubstrateProduct.new
|
1004
|
+
end
|
1005
|
+
end # class TestKGMLSubstrateProductSetter
|
1006
|
+
|
1007
|
+
class TestKGMLSubstrateSetter < Test::Unit::TestCase
|
1008
|
+
include TestKGMLSubstrateProductSetterMethods
|
1009
|
+
def setup
|
1010
|
+
@obj = Bio::KEGG::KGML::Substrate.new
|
1011
|
+
end
|
1012
|
+
end # class TestKGMLSubstrateSetter
|
1013
|
+
|
1014
|
+
class TestKGMLProductSetter < Test::Unit::TestCase
|
1015
|
+
include TestKGMLSubstrateProductSetterMethods
|
1016
|
+
def setup
|
1017
|
+
@obj = Bio::KEGG::KGML::Product.new
|
1018
|
+
end
|
1019
|
+
end # class TestKGMLProductSetter
|
1020
|
+
|
1021
|
+
end; end #module TestKeggKGML; #module Bio
|
1022
|
+
|