bio 2.0.3 → 2.0.5

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.
@@ -0,0 +1,378 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # test/unit/bio/db/embl/test_uniprotkb_P03589.rb - Unit tests for Bio::UniProtKB
4
+ #
5
+ # Copyright::: Copyright (C) 2023 BioRuby Project <staff@bioruby.org>
6
+ # License:: The Ruby License
7
+ # Contributor:: 2005 Mitsuteru Nakao <n@bioruby.org>
8
+ # 2023 Naohisa Goto <ng@bioruby.org>
9
+ #
10
+
11
+ # loading helper routine for testing bioruby
12
+ require 'pathname'
13
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
14
+ 'bioruby_test_helper.rb')).cleanpath.to_s
15
+
16
+ # libraries needed for the tests
17
+ require 'test/unit'
18
+ require 'bio/db/embl/uniprotkb'
19
+
20
+ module Bio
21
+ class TestUniProtKB_P03589 < Test::Unit::TestCase
22
+
23
+ def setup
24
+ data = File.read(File.join(BioRubyTestDataPath,
25
+ 'uniprot', 'P03589.uniprot'))
26
+ @obj = Bio::UniProtKB.new(data)
27
+ end
28
+
29
+ def test_id_line
30
+ assert(@obj.id_line)
31
+ end
32
+
33
+ def test_id_line_entry_name
34
+ assert_equal('1A_AMVLE', @obj.id_line('ENTRY_NAME'))
35
+ end
36
+
37
+ def test_id_line_data_class
38
+ assert_equal('Reviewed', @obj.id_line('DATA_CLASS'))
39
+ end
40
+
41
+ #def test_id_line_molecule_type
42
+ # assert_equal('PRT', @obj.id_line('MOLECULE_TYPE'))
43
+ #end
44
+
45
+ def test_id_line_sequence_length
46
+ assert_equal(1126, @obj.id_line('SEQUENCE_LENGTH'))
47
+ end
48
+
49
+ def test_entry
50
+ entry = '1A_AMVLE'
51
+ assert_equal(entry, @obj.entry)
52
+ assert_equal(entry, @obj.entry_name)
53
+ assert_equal(entry, @obj.entry_id)
54
+ end
55
+
56
+ #def test_molecule
57
+ # assert_equal('PRT', @obj.molecule)
58
+ # assert_equal('PRT', @obj.molecule_type)
59
+ #end
60
+
61
+ def test_sequence_length
62
+ seqlen = 1126
63
+ assert_equal(seqlen, @obj.sequence_length)
64
+ assert_equal(seqlen, @obj.aalen)
65
+ end
66
+
67
+ def test_ac
68
+ acs = ["P03589"].freeze
69
+ assert_equal(acs, @obj.ac)
70
+ assert_equal(acs, @obj.accessions)
71
+ end
72
+
73
+ def test_accession
74
+ assert_equal('P03589', @obj.accession)
75
+ end
76
+
77
+ def test_dr
78
+ assert_equal(13, @obj.dr.size)
79
+ assert_equal(8, @obj.dr['GO'].size)
80
+ assert_equal([["IPR027351", "(+)RNA_virus_helicase_core_dom"],
81
+ ["IPR002588", "Alphavirus-like_MT_dom"],
82
+ ["IPR027417", "P-loop_NTPase"]],
83
+ @obj.dr['InterPro'])
84
+ end
85
+
86
+ def test_dr_with_key
87
+ pfam = [{" " => "1",
88
+ "Version" => "Viral_helicase1",
89
+ "Accession" => "PF01443",
90
+ "Molecular Type" => nil
91
+ },
92
+ {" " => "1",
93
+ "Version" => "Vmethyltransf",
94
+ "Accession" => "PF01660",
95
+ "Molecular Type" => nil
96
+ }].freeze
97
+ assert_equal(pfam, @obj.dr('Pfam'))
98
+ embl = [{"Accession" => "L00163",
99
+ "Version" => "AAA46289.1",
100
+ " " => "-",
101
+ "Molecular Type" => "Genomic_RNA"
102
+ }].freeze
103
+ assert_equal(embl, @obj.dr('EMBL'))
104
+ end
105
+
106
+ def test_dr_with_key_empty
107
+ assert_equal([], @obj.dr('NOT_A_DATABASE'))
108
+ end
109
+
110
+ def test_dt
111
+ assert(@obj.dt)
112
+ end
113
+
114
+ def test_dt_created
115
+ assert_equal('21-JUL-1986, integrated into UniProtKB/Swiss-Prot.',
116
+ @obj.dt('created'))
117
+ end
118
+
119
+ def test_dt_sequence
120
+ assert_equal('21-JUL-1986, sequence version 1.',
121
+ @obj.dt('sequence'))
122
+ end
123
+
124
+ def test_dt_annotation
125
+ assert_equal('22-FEB-2023, entry version 78.',
126
+ @obj.dt('annotation'))
127
+ end
128
+
129
+ def test_de
130
+ assert(@obj.de)
131
+ end
132
+
133
+ def test_protein_name
134
+ assert_equal("Replication protein 1a",
135
+ @obj.protein_name)
136
+ end
137
+
138
+ def test_synonyms
139
+ assert_equal([], @obj.synonyms)
140
+ end
141
+
142
+ def test_protein_name_after_calling_de
143
+ assert(@obj.de)
144
+ assert_equal("Replication protein 1a",
145
+ @obj.protein_name)
146
+ end
147
+
148
+ def test_gn
149
+ assert_equal([{:orfs=>["ORF1a"], :synonyms=>[], :name=>"", :loci=>[]}],
150
+ @obj.gn)
151
+ end
152
+
153
+ def test_gn_uniprot_parser
154
+ assert_equal([{:orfs=>["ORF1a"], :loci=>[], :name=>"", :synonyms=>[]}],
155
+ @obj.instance_eval("gn_uniprot_parser"))
156
+ end
157
+
158
+ def test_gn_old_parser
159
+ assert_equal([["ORFNames=ORF1a;"]],
160
+ @obj.instance_eval("gn_old_parser"))
161
+ end
162
+
163
+ def test_gene_names
164
+ assert_equal([""], @obj.gene_names)
165
+ end
166
+
167
+ def test_gene_name
168
+ assert_equal('', @obj.gene_name)
169
+ end
170
+
171
+ def test_os
172
+ assert(@obj.os)
173
+ end
174
+
175
+ def test_os_access
176
+ assert_equal("Alfalfa mosaic virus (strain 425 / isolate Leiden)",
177
+ @obj.os(0))
178
+ end
179
+
180
+ def test_os_access2
181
+ assert_equal({"name"=>"(strain 425 / isolate Leiden)",
182
+ "os"=>"Alfalfa mosaic virus"}, @obj.os[0])
183
+ end
184
+
185
+ def test_oc
186
+ assert_equal(["Viruses",
187
+ "Riboviria",
188
+ "Orthornavirae",
189
+ "Kitrinoviricota",
190
+ "Alsuviricetes",
191
+ "Martellivirales",
192
+ "Bromoviridae",
193
+ "Alfamovirus"],
194
+ @obj.oc)
195
+ end
196
+
197
+ def test_ox
198
+ assert_equal({"NCBI_TaxID"=>["12322"]}, @obj.ox)
199
+ end
200
+
201
+ def test_ref # Bio::UniProtKB#ref
202
+ assert_equal(Array, @obj.ref.class)
203
+ end
204
+
205
+ def test_cc
206
+ assert_equal(Hash, @obj.cc.class)
207
+ end
208
+
209
+ def test_cc_database
210
+ assert_equal(nil, @obj.cc('DATABASE'))
211
+ end
212
+
213
+ def test_cc_alternative_products
214
+ assert_equal(nil, @obj.cc('ALTERNATIVE PRODUCTS'))
215
+ end
216
+
217
+ def test_cc_mass_spectrometry
218
+ assert_equal(nil, @obj.cc('MASS SPECTROMETRY'))
219
+ end
220
+
221
+
222
+ def test_kw
223
+ keywords = ["ATP-binding",
224
+ "Helicase",
225
+ "Host endoplasmic reticulum",
226
+ "Host membrane",
227
+ "Hydrolase",
228
+ "Membrane",
229
+ "Methyltransferase",
230
+ "Nucleotide-binding",
231
+ "Reference proteome",
232
+ "Transferase"]
233
+ assert_equal(keywords, @obj.kw)
234
+ end
235
+
236
+ def test_ft
237
+ assert(@obj.ft)
238
+ ft = {"CHAIN" => [
239
+ {"From"=>1, "To"=>1126, "diff"=>[],
240
+ "original"=>["CHAIN", "1", "1126",
241
+ [["note", "Replication protein 1a"],
242
+ ["id", "PRO_0000083254"]]],
243
+ "note"=>"Replication protein 1a",
244
+ "id"=>"PRO_0000083254",
245
+ "FTId"=>"PRO_0000083254"}],
246
+ "DOMAIN"=>
247
+ [{"From"=>90, "To"=>278,"diff"=>[],
248
+ "original"=>["DOMAIN", "90", "278",
249
+ [["note", "Alphavirus-like MT"],
250
+ ["evidence",
251
+ "ECO:0000255|PROSITE-ProRule:PRU01079"]]],
252
+ "note"=>"Alphavirus-like MT",
253
+ "evidence"=>"ECO:0000255|PROSITE-ProRule:PRU01079"},
254
+ {"From"=>806, "To"=>963, "diff"=>[],
255
+ "original"=>["DOMAIN", "806", "963",
256
+ [["note", "(+)RNA virus helicase ATP-binding"]]],
257
+ "note"=>"(+)RNA virus helicase ATP-binding"},
258
+ {"From"=>964, "To"=>1125, "diff"=>[],
259
+ "original"=>["DOMAIN", "964", "1125",
260
+ [["note", "(+)RNA virus helicase C-terminal"]]],
261
+ "note"=>"(+)RNA virus helicase C-terminal"}],
262
+ "REGION"=>
263
+ [{"From"=>69, "To"=>406, "diff"=>[],
264
+ "original"=>["REGION", "69", "406",
265
+ [["note", "Methyltransferase"]]],
266
+ "note"=>"Methyltransferase"},
267
+ {"From"=>834, "To"=>1094, "diff"=>[],
268
+ "original"=>["REGION", "834", "1094",
269
+ [["note", "ATP-dependent helicase"]]],
270
+ "note"=>"ATP-dependent helicase"}],
271
+ "BINDING"=>
272
+ [{"From"=>838, "To"=>845, "diff"=>[],
273
+ "original"=>["BINDING", "838", "845",
274
+ [["ligand", "ATP"],
275
+ ["ligand_id", "ChEBI:CHEBI:30616"],
276
+ ["evidence", "ECO:0000255"]]],
277
+ "ligand"=>"ATP", "ligand_id"=>"ChEBI:CHEBI:30616",
278
+ "evidence"=>"ECO:0000255"}]}
279
+ assert_equal(ft, @obj.ft)
280
+ end
281
+
282
+ def test_sq
283
+ assert_equal({"CRC64"=>"BF5A8019B47D4CBF", "aalen"=>1126, "MW"=>125828},
284
+ @obj.sq)
285
+ end
286
+
287
+ def test_sq_crc64
288
+ assert_equal("BF5A8019B47D4CBF", @obj.sq('CRC64'))
289
+ end
290
+
291
+ def test_sq_mw
292
+ mw = 125828
293
+ assert_equal(mw, @obj.sq('mw'))
294
+ assert_equal(mw, @obj.sq('molecular'))
295
+ assert_equal(mw, @obj.sq('weight'))
296
+ end
297
+
298
+ def test_sq_len
299
+ length = 1126
300
+ assert_equal(length, @obj.sq('len'))
301
+ assert_equal(length, @obj.sq('length'))
302
+ assert_equal(length, @obj.sq('AA'))
303
+ end
304
+
305
+ def test_seq
306
+ seq ="MNADAQSTDASLSMREPLSHASIQEMLRRVVEKQAADDTTAIGKVFSEAGRAYAQDALPS" +
307
+ "DKGEVLKISFSLDATQQNILRANFPGRRTVFSNSSSSSHCFAAAHRLLETDFVYRCFGNT" +
308
+ "VDSIIDLGGNFVSHMKVKRHNVHCCCPILDARDGARLTERILSLKSYVRKHPEIVGEADY" +
309
+ "CMDTFQKCSRRADYAFAIHSTSDLDVGELACSLDQKGVMKFICTMMVDADMLIHNEGEIP" +
310
+ "NFNVRWEIDRKKDLIHFDFIDEPNLGYSHRFSLLKHYLTYNAVDLGHAAYRIERKQDFGG" +
311
+ "VMVIDLTYSLGFVPKMPHSNGRSCAWYNRVKGQMVVHTVNEGYYHHSYQTAVRRKVLVDK" +
312
+ "KVLTRVTEVAFRQFRPNADAHSAIQSIATMLSSSTNHTIIGGVTLISGKPLSPDDYIPVA" +
313
+ "TTIYYRVKKLYNAIPEMLSLLDKGERLSTDAVLKGSEGPMWYSGPTFLSALDKVNVPGDF" +
314
+ "VAKALLSLPKRDLKSLFSRSATSHSERTPVRDESPIRCTDGVFYPIRMLLKCLGSDKFES" +
315
+ "VTITDPRSNTETTVDLYQSFQKKIETVFSFILGKIDGPSPLISDPVYFQSLEDVYYAEWH" +
316
+ "QGNAIDASNYARTLLDDIRKQKEESLKAKAKEVEDAQKLNRAILQVHAYLEAHPDGGKIE" +
317
+ "GLGLSSQFIAKIPELAIPTPKPLPEFEKNAETGEILRINPHSDAILEAIDYLKSTSANSI" +
318
+ "ITLNKLGDHCQWTTKGLDVVWAGDDKRRAFIPKKNTWVGPTARSYPLAKYERAMSKDGYV" +
319
+ "TLRWDGEVLDANCVRSLSQYEIVFVDQSCVFASAEAIIPSLEKALGLEAHFSVTIVDGVA" +
320
+ "GCGKTTNIKQIARSSGRDVDLILTSNRSSADELKETIDCSPLTKLHYIRTCDSYLMSASA" +
321
+ "VKAQRLIFDECFLQHAGLVYAAATLAGCSEVIGFGDTEQIPFVSRNPSFVFRHHKLTGKV" +
322
+ "ERKLITWRSPADATYCLEKYFYKNKKPVKTNSRVLRSIEVVPINSPVSVERNTNALYLCH" +
323
+ "TQAEKAVLKAQTHLKGCDNIFTTHEAQGKTFDNVYFCRLTRTSTSLATGRDPINGPCNGL" +
324
+ "VALSRHKKTFKYFTIAHDSDDVIYNACRDAGNTDDSILARSYNHNF"
325
+ seq.freeze
326
+ assert_equal(seq, @obj.seq)
327
+ assert_equal(seq, @obj.aaseq)
328
+ end
329
+
330
+ def test_oh
331
+ oh = [
332
+ {"NCBI_TaxID"=>"4045", "HostName"=>"Apium graveolens (Celery)"},
333
+ {"NCBI_TaxID"=>"83862",
334
+ "HostName"=>"Astragalus glycyphyllos (Wild liquorice)"},
335
+ {"NCBI_TaxID"=>"4072",
336
+ "HostName"=>"Capsicum annuum (Capsicum pepper)"},
337
+ {"NCBI_TaxID"=>"41386", "HostName"=>"Caryopteris incana"},
338
+ {"NCBI_TaxID"=>"3827",
339
+ "HostName"=>"Cicer arietinum (Chickpea) (Garbanzo)"},
340
+ {"NCBI_TaxID"=>"3847",
341
+ "HostName"=>"Glycine max (Soybean) (Glycine hispida)"},
342
+ {"NCBI_TaxID"=>"35936",
343
+ "HostName"=>"Lablab purpureus (Hyacinth bean) (Dolichos lablab)"},
344
+ {"NCBI_TaxID"=>"4236",
345
+ "HostName"=>"Lactuca sativa (Garden lettuce)"},
346
+ {"NCBI_TaxID"=>"3864",
347
+ "HostName"=>"Lens culinaris (Lentil) (Cicer lens)"},
348
+ {"NCBI_TaxID"=>"3869", "HostName"=>"Lupinus"},
349
+ {"NCBI_TaxID"=>"145753",
350
+ "HostName"=>"Malva parviflora (Little mallow) (Cheeseweed mallow)"},
351
+ {"NCBI_TaxID"=>"3879",
352
+ "HostName"=>"Medicago sativa (Alfalfa)"},
353
+ {"NCBI_TaxID"=>"4097",
354
+ "HostName"=>"Nicotiana tabacum (Common tobacco)"},
355
+ {"NCBI_TaxID"=>"3885",
356
+ "HostName"=>"Phaseolus vulgaris (Kidney bean) (French bean)"},
357
+ {"NCBI_TaxID"=>"23113", "HostName"=>"Philadelphus"},
358
+ {"NCBI_TaxID"=>"3888", "HostName"=>"Pisum sativum (Garden pea)"},
359
+ {"NCBI_TaxID"=>"4081",
360
+ "HostName"=>
361
+ "Solanum lycopersicum (Tomato) (Lycopersicon esculentum)"},
362
+ {"NCBI_TaxID"=>"4113", "HostName"=>"Solanum tuberosum (Potato)"},
363
+ {"NCBI_TaxID"=>"157662", "HostName"=>"Teramnus repens"},
364
+ {"NCBI_TaxID"=>"60916",
365
+ "HostName"=>"Trifolium incarnatum (Crimson clover)"},
366
+ {"NCBI_TaxID"=>"85293",
367
+ "HostName"=>"Viburnum opulus (High-bush cranberry)"},
368
+ {"NCBI_TaxID"=>"3916",
369
+ "HostName"=>
370
+ "Vigna radiata var. radiata (Mung bean) (Phaseolus aureus)"},
371
+ {"NCBI_TaxID"=>"3917", "HostName"=>"Vigna unguiculata (Cowpea)"}
372
+ ]
373
+ assert_equal(oh, @obj.oh)
374
+ end
375
+
376
+ end # class TestUniProtKB
377
+ end # module Bio
378
+
@@ -0,0 +1,325 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # test/unit/bio/db/embl/test_uniprotkb_P28907.rb - Unit tests for Bio::UniProtKB
4
+ #
5
+ # Copyright::: Copyright (C) 2022 BioRuby Project <staff@bioruby.org>
6
+ # License:: The Ruby License
7
+ # Contributor:: 2005 Mitsuteru Nakao <n@bioruby.org>
8
+ # 2022 Naohisa Goto <ng@bioruby.org>
9
+ #
10
+
11
+ # loading helper routine for testing bioruby
12
+ require 'pathname'
13
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
14
+ 'bioruby_test_helper.rb')).cleanpath.to_s
15
+
16
+ # libraries needed for the tests
17
+ require 'test/unit'
18
+ require 'bio/db/embl/uniprotkb'
19
+
20
+ module Bio
21
+ class TestUniProtKB_P28907 < Test::Unit::TestCase
22
+
23
+ def setup
24
+ data = File.read(File.join(BioRubyTestDataPath,
25
+ 'uniprot', 'P28907.uniprot'))
26
+ @obj = Bio::UniProtKB.new(data)
27
+ end
28
+
29
+ def test_id_line
30
+ assert(@obj.id_line)
31
+ end
32
+
33
+ def test_id_line_entry_name
34
+ assert_equal('CD38_HUMAN', @obj.id_line('ENTRY_NAME'))
35
+ end
36
+
37
+ def test_id_line_data_class
38
+ assert_equal('Reviewed', @obj.id_line('DATA_CLASS'))
39
+ end
40
+
41
+ #def test_id_line_molecule_type
42
+ # assert_equal('PRT', @obj.id_line('MOLECULE_TYPE'))
43
+ #end
44
+
45
+ def test_id_line_sequence_length
46
+ assert_equal(300, @obj.id_line('SEQUENCE_LENGTH'))
47
+ end
48
+
49
+ def test_entry
50
+ entry = 'CD38_HUMAN'
51
+ assert_equal(entry, @obj.entry)
52
+ assert_equal(entry, @obj.entry_name)
53
+ assert_equal(entry, @obj.entry_id)
54
+ end
55
+
56
+ #def test_molecule
57
+ # assert_equal('PRT', @obj.molecule)
58
+ # assert_equal('PRT', @obj.molecule_type)
59
+ #end
60
+
61
+ def test_sequence_length
62
+ seqlen = 300
63
+ assert_equal(seqlen, @obj.sequence_length)
64
+ assert_equal(seqlen, @obj.aalen)
65
+ end
66
+
67
+ def test_ac
68
+ acs = ["P28907", "O00121", "O00122", "Q96HY4"].freeze
69
+ assert_equal(acs, @obj.ac)
70
+ assert_equal(acs, @obj.accessions)
71
+ end
72
+
73
+ def test_accession
74
+ assert_equal('P28907', @obj.accession)
75
+ end
76
+
77
+ def test_dr
78
+ assert_equal(81, @obj.dr.size)
79
+ assert_equal(39, @obj.dr['GO'].size)
80
+ assert_equal([["IPR003193", "ADP-ribosyl_cyclase"],
81
+ ["IPR033567", "CD38"]],
82
+ @obj.dr['InterPro'])
83
+ end
84
+
85
+ def test_dr_with_key
86
+ pfam = [{" " => "1",
87
+ "Version" => "Rib_hydrolayse",
88
+ "Accession" => "PF02267",
89
+ "Molecular Type" => nil
90
+ }].freeze
91
+ assert_equal(pfam, @obj.dr('Pfam'))
92
+ embl = [{"Accession" => "M34461",
93
+ "Version" => "AAA68482.1",
94
+ " " => "-",
95
+ "Molecular Type" => "mRNA"},
96
+ {"Accession" => "D84276",
97
+ "Version" => "BAA18964.1",
98
+ " " => "-",
99
+ "Molecular Type" => "mRNA"},
100
+ {"Accession" => "D84277",
101
+ "Version" => "BAA18965.1",
102
+ " " => "-",
103
+ "Molecular Type" => "mRNA"},
104
+ {"Accession" => "D84284",
105
+ "Version" => "BAA18966.1",
106
+ " " => "-",
107
+ "Molecular Type" => "Genomic_DNA"},
108
+ {"Accession" => "BC007964",
109
+ "Version" => "AAH07964.1",
110
+ " " => "-",
111
+ "Molecular Type" => "mRNA"}].freeze
112
+ assert_equal(embl, @obj.dr('EMBL'))
113
+ end
114
+
115
+ def test_dr_with_key_empty
116
+ assert_equal([], @obj.dr('NOT_A_DATABASE'))
117
+ end
118
+
119
+ def test_dt
120
+ assert(@obj.dt)
121
+ end
122
+
123
+ def test_dt_created
124
+ assert_equal('01-DEC-1992, integrated into UniProtKB/Swiss-Prot.',
125
+ @obj.dt('created'))
126
+ end
127
+
128
+ def test_dt_sequence
129
+ assert_equal('23-NOV-2004, sequence version 2.',
130
+ @obj.dt('sequence'))
131
+ end
132
+
133
+ def test_dt_annotation
134
+ assert_equal('03-AUG-2022, entry version 213.',
135
+ @obj.dt('annotation'))
136
+ end
137
+
138
+ def test_de
139
+ assert(@obj.de)
140
+ end
141
+
142
+ def test_protein_name
143
+ assert_equal("ADP-ribosyl cyclase/cyclic ADP-ribose hydrolase 1",
144
+ @obj.protein_name)
145
+ end
146
+
147
+ def test_synonyms
148
+ ary = [
149
+ "EC 3.2.2.6",
150
+ "2'-phospho-ADP-ribosyl cyclase",
151
+ "2'-phospho-ADP-ribosyl cyclase/2'-phospho-cyclic-ADP-ribose transferase",
152
+ "EC 2.4.99.20",
153
+ "2'-phospho-cyclic-ADP-ribose transferase",
154
+ "ADP-ribosyl cyclase 1",
155
+ "ADPRC 1",
156
+ "Cyclic ADP-ribose hydrolase 1",
157
+ "cADPr hydrolase 1",
158
+ "T10",
159
+ "CD_antigen=CD38"
160
+ ].freeze
161
+ assert_equal(ary, @obj.synonyms)
162
+ end
163
+
164
+ def test_protein_name_after_calling_de
165
+ assert(@obj.de)
166
+ assert_equal("ADP-ribosyl cyclase/cyclic ADP-ribose hydrolase 1",
167
+ @obj.protein_name)
168
+ end
169
+
170
+ def test_synonyms_after_calling_de
171
+ assert(@obj.de)
172
+ assert_equal(11, @obj.synonyms.size)
173
+ end
174
+
175
+ def test_gn
176
+ assert_equal([{:orfs=>[], :synonyms=>[], :name=>"CD38", :loci=>[]}],
177
+ @obj.gn)
178
+ end
179
+
180
+ def test_gn_uniprot_parser
181
+ assert_equal([{:orfs=>[], :loci=>[], :name=>"CD38", :synonyms=>[]}],
182
+ @obj.instance_eval("gn_uniprot_parser"))
183
+ end
184
+
185
+ def test_gn_old_parser
186
+ assert_equal([["Name=CD38;"]],
187
+ @obj.instance_eval("gn_old_parser"))
188
+ end
189
+
190
+ def test_gene_names
191
+ assert_equal(["CD38"], @obj.gene_names)
192
+ end
193
+
194
+ def test_gene_name
195
+ assert_equal('CD38', @obj.gene_name)
196
+ end
197
+
198
+ def test_os
199
+ assert(@obj.os)
200
+ end
201
+
202
+ def test_os_access
203
+ assert_equal("Homo sapiens (Human)", @obj.os(0))
204
+ end
205
+
206
+ def test_os_access2
207
+ assert_equal({"name"=>"(Human)", "os"=>"Homo sapiens"}, @obj.os[0])
208
+ end
209
+
210
+ def test_oc
211
+ assert_equal(["Eukaryota", "Metazoa", "Chordata", "Craniata",
212
+ "Vertebrata", "Euteleostomi", "Mammalia", "Eutheria",
213
+ "Euarchontoglires", "Primates",
214
+ "Haplorrhini", "Catarrhini", "Hominidae", "Homo"],
215
+ @obj.oc)
216
+ end
217
+
218
+ def test_ox
219
+ assert_equal({"NCBI_TaxID"=>["9606"]}, @obj.ox)
220
+ end
221
+
222
+ def test_ref # Bio::UniProtKB#ref
223
+ assert_equal(Array, @obj.ref.class)
224
+ end
225
+
226
+ def test_cc
227
+ assert_equal(Hash, @obj.cc.class)
228
+ end
229
+
230
+ def test_cc_database
231
+ assert_equal(nil, @obj.cc('DATABASE'))
232
+ end
233
+
234
+ def test_cc_alternative_products
235
+ ap = { "Event"=>["Alternative splicing"],
236
+ "Named isoforms"=>"2",
237
+ "Comment"=>"",
238
+ "Variants"=>
239
+ [{"Name"=>"1",
240
+ "Synonyms"=>[],
241
+ "IsoId"=>["P28907-1"],
242
+ "Sequence"=>["Displayed"]},
243
+ {"Name"=>"2",
244
+ "Synonyms"=>[],
245
+ "IsoId"=>["P28907-2"],
246
+ "Sequence"=>["VSP_000707", "VSP_000708"]}]}
247
+ assert_equal(ap, @obj.cc('ALTERNATIVE PRODUCTS'))
248
+ end
249
+
250
+ def test_cc_mass_spectrometry
251
+ assert_equal(nil, @obj.cc('MASS SPECTROMETRY'))
252
+ end
253
+
254
+
255
+ def test_kw
256
+ keywords = ["3D-structure", "Alternative splicing",
257
+ "Diabetes mellitus", "Disulfide bond",
258
+ "Glycoprotein", "Hydrolase", "Membrane",
259
+ "NAD", "NADP", "Receptor", "Reference proteome",
260
+ "Signal-anchor", "Transferase", "Transmembrane",
261
+ "Transmembrane helix"]
262
+ assert_equal(keywords, @obj.kw)
263
+ end
264
+
265
+ def test_ft
266
+ assert(@obj.ft)
267
+ name = 'TOPO_DOM'
268
+ data = [{"From"=>1,
269
+ "To"=>21,
270
+ "diff"=>[],
271
+ "original"=>
272
+ ["TOPO_DOM",
273
+ "1",
274
+ "21",
275
+ [["note", "Cytoplasmic"],
276
+ ["evidence", "ECO:0000255"]]],
277
+ "note"=>"Cytoplasmic",
278
+ "evidence"=>"ECO:0000255"},
279
+ {"From"=>43,
280
+ "To"=>300,
281
+ "diff"=>[],
282
+ "original"=>
283
+ ["TOPO_DOM",
284
+ "43",
285
+ "300",
286
+ [["note", "Extracellular"],
287
+ ["evidence", "ECO:0000255"]]],
288
+ "note"=>"Extracellular",
289
+ "evidence"=>"ECO:0000255"}].freeze
290
+
291
+ assert_equal(data, @obj.ft[name])
292
+ end
293
+
294
+ def test_sq
295
+ assert_equal({"CRC64"=>"47BBE38C3DE3E6AA", "aalen"=>300, "MW"=>34328},
296
+ @obj.sq)
297
+ end
298
+
299
+ def test_sq_crc64
300
+ assert_equal("47BBE38C3DE3E6AA", @obj.sq('CRC64'))
301
+ end
302
+
303
+ def test_sq_mw
304
+ mw = 34328
305
+ assert_equal(mw, @obj.sq('mw'))
306
+ assert_equal(mw, @obj.sq('molecular'))
307
+ assert_equal(mw, @obj.sq('weight'))
308
+ end
309
+
310
+ def test_sq_len
311
+ length = 300
312
+ assert_equal(length, @obj.sq('len'))
313
+ assert_equal(length, @obj.sq('length'))
314
+ assert_equal(length, @obj.sq('AA'))
315
+ end
316
+
317
+ def test_seq
318
+ seq = "MANCEFSPVSGDKPCCRLSRRAQLCLGVSILVLILVVVLAVVVPRWRQQWSGPGTTKRFPETVLARCVKYTEIHPEMRHVDCQSVWDAFKGAFISKHPCNITEEDYQPLMKLGTQTVPCNKILLWSRIKDLAHQFTQVQRDMFTLEDTLLGYLADDLTWCGEFNTSKINYQSCPDWRKDCSNNPVSVFWKTVSRRFAEAACDVVHVMLNGSRSKIFDKNSTFGSVEVHNLQPEKVQTLEAWVIHGGREDSRDLCQDPTIKELESIISKRNIQFSCKNIYRPDKFLQCVKNPEDSSCTSEI"
319
+ assert_equal(seq, @obj.seq)
320
+ assert_equal(seq, @obj.aaseq)
321
+ end
322
+
323
+ end # class TestUniProtKB
324
+ end # module Bio
325
+