bio 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +954 -0
- data/KNOWN_ISSUES.rdoc +40 -5
- data/README.rdoc +36 -35
- data/RELEASE_NOTES.rdoc +87 -59
- data/bioruby.gemspec +24 -2
- data/doc/RELEASE_NOTES-1.4.1.rdoc +104 -0
- data/doc/Tutorial.rd +162 -200
- data/doc/Tutorial.rd.html +149 -146
- data/lib/bio.rb +1 -0
- data/lib/bio/appl/blast.rb +1 -1
- data/lib/bio/appl/blast/ddbj.rb +26 -34
- data/lib/bio/appl/blast/genomenet.rb +21 -11
- data/lib/bio/db/embl/sptr.rb +193 -21
- data/lib/bio/db/fasta.rb +1 -1
- data/lib/bio/db/fastq.rb +14 -0
- data/lib/bio/db/fastq/format_fastq.rb +2 -2
- data/lib/bio/db/genbank/ddbj.rb +1 -2
- data/lib/bio/db/genbank/format_genbank.rb +1 -1
- data/lib/bio/db/medline.rb +1 -0
- data/lib/bio/db/newick.rb +3 -1
- data/lib/bio/db/pdb/pdb.rb +9 -9
- data/lib/bio/db/pdb/residue.rb +2 -2
- data/lib/bio/io/ddbjrest.rb +344 -0
- data/lib/bio/io/ncbirest.rb +121 -1
- data/lib/bio/location.rb +2 -2
- data/lib/bio/reference.rb +3 -4
- data/lib/bio/shell/plugin/entry.rb +7 -3
- data/lib/bio/shell/plugin/ncbirest.rb +5 -1
- data/lib/bio/util/restriction_enzyme.rb +3 -0
- data/lib/bio/util/restriction_enzyme/dense_int_array.rb +195 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +7 -7
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +57 -18
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +2 -2
- data/lib/bio/util/restriction_enzyme/sorted_num_array.rb +219 -0
- data/lib/bio/version.rb +1 -1
- data/sample/test_restriction_enzyme_long.rb +4403 -0
- data/test/data/fasta/EFTU_BACSU.fasta +8 -0
- data/test/data/genbank/CAA35997.gp +48 -0
- data/test/data/genbank/SCU49845.gb +167 -0
- data/test/data/litdb/1717226.litdb +13 -0
- data/test/data/pir/CRAB_ANAPL.pir +6 -0
- data/test/functional/bio/appl/blast/test_remote.rb +93 -0
- data/test/functional/bio/appl/test_blast.rb +61 -0
- data/test/functional/bio/io/test_ddbjrest.rb +47 -0
- data/test/functional/bio/test_command.rb +3 -3
- data/test/unit/bio/db/embl/test_sptr.rb +6 -6
- data/test/unit/bio/db/embl/test_uniprot_new_part.rb +208 -0
- data/test/unit/bio/db/genbank/test_common.rb +274 -0
- data/test/unit/bio/db/genbank/test_genbank.rb +401 -0
- data/test/unit/bio/db/genbank/test_genpept.rb +81 -0
- data/test/unit/bio/db/pdb/test_pdb.rb +3287 -11
- data/test/unit/bio/db/test_fasta.rb +34 -12
- data/test/unit/bio/db/test_fastq.rb +26 -0
- data/test/unit/bio/db/test_litdb.rb +95 -0
- data/test/unit/bio/db/test_medline.rb +1 -0
- data/test/unit/bio/db/test_nbrf.rb +82 -0
- data/test/unit/bio/db/test_newick.rb +22 -4
- data/test/unit/bio/test_reference.rb +35 -0
- data/test/unit/bio/util/restriction_enzyme/test_dense_int_array.rb +201 -0
- data/test/unit/bio/util/restriction_enzyme/test_sorted_num_array.rb +281 -0
- metadata +44 -38
@@ -96,9 +96,9 @@ module Bio
|
|
96
96
|
@sort = "sort"
|
97
97
|
@data = @data.join("\r\n") + "\r\n"
|
98
98
|
else
|
99
|
-
@sort =
|
100
|
-
|
101
|
-
raise "Unsupported environment:
|
99
|
+
@sort = `which sort`.chomp
|
100
|
+
if @sort.empty? or !FileTest.executable?(@sort) then
|
101
|
+
raise "Unsupported environment: sort not found in PATH"
|
102
102
|
end
|
103
103
|
@data = @data.join("\n") + "\n"
|
104
104
|
end
|
@@ -864,12 +864,12 @@ CC URL="http://www.genetests.org/query?gene=GJB1".'
|
|
864
864
|
'NAME=Connexin-deafness homepage; URL="http://www.crg.es/deafness/".',
|
865
865
|
'NAME=GeneReviews; URL="http://www.genetests.org/query?gene=GJB1".'],
|
866
866
|
sp.cc['WEB RESOURCE'])
|
867
|
-
assert_equal([{'
|
868
|
-
'URL' => 'http://www.molgen.ua.ac.be/CMTMutations/', '
|
869
|
-
{'
|
870
|
-
'URL' => 'http://www.crg.es/deafness/', '
|
871
|
-
{'
|
872
|
-
'URL' => 'http://www.genetests.org/query?gene=GJB1', '
|
867
|
+
assert_equal([{'Name' => "Inherited peripheral neuropathies mutation db",
|
868
|
+
'URL' => 'http://www.molgen.ua.ac.be/CMTMutations/', 'Note' => nil},
|
869
|
+
{'Name' => "Connexin-deafness homepage",
|
870
|
+
'URL' => 'http://www.crg.es/deafness/', 'Note' => nil},
|
871
|
+
{'Name' => "GeneReviews",
|
872
|
+
'URL' => 'http://www.genetests.org/query?gene=GJB1', 'Note' => nil}],
|
873
873
|
sp.cc('WEB RESOURCE'))
|
874
874
|
|
875
875
|
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/db/embl/test_uniprot_new_part.rb - Unit test for Bio::UniProt for new file formats using part of psudo entries
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2011 Naohisa Goto <ng@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
|
8
|
+
# loading helper routine for testing bioruby
|
9
|
+
require 'pathname'
|
10
|
+
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
11
|
+
'bioruby_test_helper.rb')).cleanpath.to_s
|
12
|
+
|
13
|
+
# libraries needed for the tests
|
14
|
+
require 'test/unit'
|
15
|
+
require 'bio/db/embl/uniprot'
|
16
|
+
|
17
|
+
module Bio
|
18
|
+
class TestUniProt_ID_since_rel9_0 < Test::Unit::TestCase
|
19
|
+
|
20
|
+
def setup
|
21
|
+
text = "ID ABC_DEFGH Reviewed; 256 AA.\n"
|
22
|
+
@obj = Bio::UniProt.new(text)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_id_line
|
26
|
+
expected = {
|
27
|
+
"ENTRY_NAME" => "ABC_DEFGH",
|
28
|
+
"DATA_CLASS" => "Reviewed",
|
29
|
+
"SEQUENCE_LENGTH" => 256,
|
30
|
+
"MOLECULE_TYPE" => nil
|
31
|
+
}
|
32
|
+
assert_equal(expected, @obj.id_line)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_entry_id
|
36
|
+
assert_equal("ABC_DEFGH", @obj.entry_id)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_entry_name
|
40
|
+
assert_equal("ABC_DEFGH", @obj.entry_name)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_entry
|
44
|
+
assert_equal("ABC_DEFGH", @obj.entry)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_sequence_length
|
48
|
+
assert_equal(256, @obj.sequence_length)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_aalen
|
52
|
+
assert_equal(256, @obj.aalen)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_molecule
|
56
|
+
assert_nil(@obj.molecule)
|
57
|
+
end
|
58
|
+
end #class TestUniProt_ID_since_rel9_0
|
59
|
+
|
60
|
+
class TestUniProt_DE_since_rel14_0 < Test::Unit::TestCase
|
61
|
+
|
62
|
+
def setup
|
63
|
+
text = <<the_end_of_the_text
|
64
|
+
ID ABC_DEFGH Unreviewed; 256 AA.
|
65
|
+
DE RecName: Full=Aaa Bbbb Ccccc-Dddddd Eeeeeee factor;
|
66
|
+
DE Short=ABC-DEF;
|
67
|
+
DE Short=A-DF;
|
68
|
+
DE EC=9.8.0.1;
|
69
|
+
DE AltName: Full=Bbbb-Aaa Eeeeeee Ccccc;
|
70
|
+
DE Short=Bbbb-Aaa;
|
71
|
+
DE EC=9.8.0.-;
|
72
|
+
DE AltName: Allergen=Bet v 1-B;
|
73
|
+
DE AltName: Biotech=this is fake entry;
|
74
|
+
DE AltName: CD_antigen=CD42c;
|
75
|
+
DE AltName: INN=Pseudo;
|
76
|
+
DE SubName: Full=submitter named this ABC_DEFGH;
|
77
|
+
DE EC=9.8.2.1;
|
78
|
+
DE Includes:
|
79
|
+
DE RecName: Full=Included protein example;
|
80
|
+
DE Short=IPE;
|
81
|
+
DE EC=9.9.9.9;
|
82
|
+
DE AltName: Full=Inclided protein altname;
|
83
|
+
DE Short=IPA;
|
84
|
+
DE Contains:
|
85
|
+
DE RecName: Full=Contained protein alpha chain;
|
86
|
+
DE Short=CPAC;
|
87
|
+
DE Flags: Precursor; Fragment;
|
88
|
+
the_end_of_the_text
|
89
|
+
|
90
|
+
@obj = Bio::UniProt.new(text)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_private_parse_DE_line_rel14
|
94
|
+
expected =
|
95
|
+
[ [ "RecName",
|
96
|
+
["Full", "Aaa Bbbb Ccccc-Dddddd Eeeeeee factor"],
|
97
|
+
["Short", "ABC-DEF"],
|
98
|
+
["Short", "A-DF"],
|
99
|
+
["EC", "9.8.0.1"]
|
100
|
+
],
|
101
|
+
[ "AltName",
|
102
|
+
["Full", "Bbbb-Aaa Eeeeeee Ccccc"],
|
103
|
+
["Short", "Bbbb-Aaa"],
|
104
|
+
["EC", "9.8.0.-"]
|
105
|
+
],
|
106
|
+
[ "AltName",
|
107
|
+
["Allergen", "Bet v 1-B"]
|
108
|
+
],
|
109
|
+
[ "AltName",
|
110
|
+
["Biotech", "this is fake entry"]
|
111
|
+
],
|
112
|
+
[ "AltName",
|
113
|
+
["CD_antigen", "CD42c"]
|
114
|
+
],
|
115
|
+
[ "AltName",
|
116
|
+
["INN", "Pseudo"]
|
117
|
+
],
|
118
|
+
[ "SubName",
|
119
|
+
["Full", "submitter named this ABC_DEFGH"],
|
120
|
+
["EC", "9.8.2.1"]
|
121
|
+
],
|
122
|
+
[ "Includes" ],
|
123
|
+
[ "RecName",
|
124
|
+
["Full", "Included protein example"],
|
125
|
+
["Short", "IPE"],
|
126
|
+
["EC", "9.9.9.9"]
|
127
|
+
],
|
128
|
+
["AltName",
|
129
|
+
["Full", "Inclided protein altname"],
|
130
|
+
["Short", "IPA"]
|
131
|
+
],
|
132
|
+
[ "Contains" ],
|
133
|
+
[ "RecName",
|
134
|
+
["Full", "Contained protein alpha chain"],
|
135
|
+
["Short", "CPAC"]
|
136
|
+
],
|
137
|
+
[ "Flags",
|
138
|
+
["Precursor", "Fragment"]
|
139
|
+
]
|
140
|
+
]
|
141
|
+
@obj.protein_name
|
142
|
+
ary = @obj.instance_eval { @data['DE'] }
|
143
|
+
assert_equal(expected, ary)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_protein_name
|
147
|
+
assert_equal('Aaa Bbbb Ccccc-Dddddd Eeeeeee factor',
|
148
|
+
@obj.protein_name)
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_synonyms
|
152
|
+
expected = [ 'ABC-DEF',
|
153
|
+
'A-DF',
|
154
|
+
'EC 9.8.0.1',
|
155
|
+
'Bbbb-Aaa Eeeeeee Ccccc',
|
156
|
+
'Bbbb-Aaa',
|
157
|
+
'EC 9.8.0.-',
|
158
|
+
'Allergen=Bet v 1-B',
|
159
|
+
'this is fake entry',
|
160
|
+
'CD_antigen=CD42c',
|
161
|
+
'Pseudo',
|
162
|
+
'submitter named this ABC_DEFGH',
|
163
|
+
'EC 9.8.2.1'
|
164
|
+
]
|
165
|
+
assert_equal(expected, @obj.synonyms)
|
166
|
+
end
|
167
|
+
|
168
|
+
end #class TestUniProt_DE_since_rel14_0
|
169
|
+
|
170
|
+
class TestUniProt_CC_WEB_RESOURCE_since_rel12_2 < Test::Unit::TestCase
|
171
|
+
|
172
|
+
def setup
|
173
|
+
text = <<the_end_of_the_text
|
174
|
+
ID ABC_DEFGH Unreviewed; 256 AA.
|
175
|
+
CC -!- WEB RESOURCE: Name=BioRuby web site; Note=BioRuby main web site
|
176
|
+
CC located in Tokyo, Japan;
|
177
|
+
CC URL="http://bioruby.org";
|
178
|
+
CC -!- WEB RESOURCE: Name=official mirror of BioRuby web site hosted in
|
179
|
+
CC the Open Bioinformatics Foundation;
|
180
|
+
CC URL="http://bioruby.open-bio.org/";
|
181
|
+
CC -!- WEB RESOURCE: Name=BioRuby Wiki site;
|
182
|
+
CC URL="http://bioruby.open-bio.org/wiki/";
|
183
|
+
the_end_of_the_text
|
184
|
+
|
185
|
+
@obj = Bio::UniProt.new(text)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_cc_web_resource
|
189
|
+
expected =
|
190
|
+
[ { "Name" => "BioRuby web site",
|
191
|
+
"Note" => "BioRuby main web site located in Tokyo, Japan",
|
192
|
+
"URL" => "http://bioruby.org"
|
193
|
+
},
|
194
|
+
{ "Name" => "official mirror of BioRuby web site hosted in the Open Bioinformatics Foundation",
|
195
|
+
"Note" => nil,
|
196
|
+
"URL" => "http://bioruby.open-bio.org/"
|
197
|
+
},
|
198
|
+
{ "Name" => "BioRuby Wiki site",
|
199
|
+
"Note" => nil,
|
200
|
+
"URL" => "http://bioruby.open-bio.org/wiki/"
|
201
|
+
}
|
202
|
+
]
|
203
|
+
|
204
|
+
assert_equal(expected, @obj.cc('WEB RESOURCE'))
|
205
|
+
end
|
206
|
+
end #class TestUniProt_CC_WEB_RESOURCE_since_rel12_2
|
207
|
+
|
208
|
+
end #module Bio
|
@@ -0,0 +1,274 @@
|
|
1
|
+
#
|
2
|
+
# test/unit/bio/db/genbank/test_common.rb - Unit test for Bio::NCBIDB::Common
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2010 Kazuhiro Hayashi <k.hayashi.info@gmail.com>
|
5
|
+
# License:: The Ruby License
|
6
|
+
#
|
7
|
+
|
8
|
+
# loading helper routine for testing bioruby
|
9
|
+
require 'pathname'
|
10
|
+
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
11
|
+
'bioruby_test_helper.rb')).cleanpath.to_s
|
12
|
+
|
13
|
+
# libraries needed for the tests
|
14
|
+
require 'test/unit'
|
15
|
+
require 'bio/db/genbank/common'
|
16
|
+
require 'bio/reference'
|
17
|
+
require 'bio/compat/references' # Bio::References in this file seems to be obsolete, but Bio::NCBIDB::Common should require it.
|
18
|
+
require 'bio/feature'
|
19
|
+
require 'bio/compat/features' # Bio::Features in this file seems to be obsolete, but Bio::NCBIDB::Common should require it.
|
20
|
+
|
21
|
+
|
22
|
+
# - This class has low coverage, because a sample entry used in it lacks a lot of fields.
|
23
|
+
# - There are all the methods for test.
|
24
|
+
module Bio
|
25
|
+
class NCBIDB
|
26
|
+
class TestCommon < Test::Unit::TestCase
|
27
|
+
|
28
|
+
#Mock Class including the target module.
|
29
|
+
#BioNCBIDBCommon is used for the test.
|
30
|
+
class BioNCBIDBCommon < Bio::NCBIDB
|
31
|
+
include Bio::NCBIDB::Common
|
32
|
+
end
|
33
|
+
|
34
|
+
#a sample entry is a part of data/genbank/SCU49845.gb
|
35
|
+
def setup
|
36
|
+
entry =<<EOF
|
37
|
+
LOCUS SCU49845 5028 bp DNA linear PLN 23-MAR-2010
|
38
|
+
DEFINITION Saccharomyces cerevisiae TCP1-beta gene, partial cds; and Axl2p
|
39
|
+
(AXL2) and Rev7p (REV7) genes, complete cds.
|
40
|
+
ACCESSION U49845
|
41
|
+
VERSION U49845.1 GI:1293613
|
42
|
+
KEYWORDS .
|
43
|
+
SOURCE Saccharomyces cerevisiae (baker's yeast)
|
44
|
+
ORGANISM Saccharomyces cerevisiae
|
45
|
+
Eukaryota; Fungi; Dikarya; Ascomycota; Saccharomyceta;
|
46
|
+
Saccharomycotina; Saccharomycetes; Saccharomycetales;
|
47
|
+
Saccharomycetaceae; Saccharomyces.
|
48
|
+
EOF
|
49
|
+
@obj = BioNCBIDBCommon.new(entry)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_locus
|
53
|
+
#Since locus method is supposed to be overloaded in a child class, it may not be neccesary to test the method here.
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_definition
|
57
|
+
expected = "Saccharomyces cerevisiae TCP1-beta gene, partial cds; and Axl2p (AXL2) and Rev7p (REV7) genes, complete cds."
|
58
|
+
assert_equal(expected, @obj.definition)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_accessions
|
62
|
+
expected = ["U49845"]
|
63
|
+
assert_equal(expected, @obj.accessions)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_accession
|
67
|
+
expected = "U49845"
|
68
|
+
assert_equal(expected, @obj.accession)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_versions
|
72
|
+
expected = ["U49845.1", "GI:1293613"]
|
73
|
+
assert_equal(expected, @obj.versions)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_version
|
77
|
+
expected = 1
|
78
|
+
assert_equal(expected, @obj.version)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_acc_version
|
82
|
+
expected = "U49845.1"
|
83
|
+
assert_equal(expected, @obj.acc_version)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_gi
|
87
|
+
expected = "GI:1293613"
|
88
|
+
assert_equal(expected, @obj.gi)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_nid
|
92
|
+
expected = ""
|
93
|
+
assert_equal(expected, @obj.nid)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_keywords
|
97
|
+
expected = []
|
98
|
+
assert_equal(expected, @obj.keywords)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_segment
|
102
|
+
expected = ""
|
103
|
+
assert_equal(expected, @obj.segment)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_source
|
107
|
+
expected = {"organism"=>"Saccharomyces cerevisiae",
|
108
|
+
"common_name"=>"Saccharomyces cerevisiae (baker's yeast)",
|
109
|
+
"taxonomy"=>
|
110
|
+
"Eukaryota; Fungi; Dikarya; Ascomycota; Saccharomyceta; Saccharomycotina; Saccharomycetes; Saccharomycetales; Saccharomycetaceae; Saccharomyces."}
|
111
|
+
assert_equal(expected, @obj.source)
|
112
|
+
|
113
|
+
#another pattern to pass line 103-105
|
114
|
+
source_pattern2 =<<EOS
|
115
|
+
SOURCE Saccharomyces cerevisiae (baker's yeast)
|
116
|
+
ORGANISM Saccharomyces cerevisiae
|
117
|
+
Saccharomyces.
|
118
|
+
EOS
|
119
|
+
obj2 = BioNCBIDBCommon.new(source_pattern2)
|
120
|
+
expected2 = {"organism"=>"Saccharomyces cerevisiae",
|
121
|
+
"common_name"=>"Saccharomyces cerevisiae (baker's yeast)",
|
122
|
+
"taxonomy"=>"Saccharomyces."}
|
123
|
+
assert_equal(expected2, obj2.source)
|
124
|
+
|
125
|
+
#the other pattern to pass line 106-109
|
126
|
+
source_pattern3 =<<EOS
|
127
|
+
SOURCE Saccharomyces cerevisiae (baker's yeast)
|
128
|
+
ORGANISM Saccharomyces cerevisiae
|
129
|
+
EOS
|
130
|
+
obj3 = BioNCBIDBCommon.new(source_pattern3)
|
131
|
+
expected3 = {"organism"=>"Saccharomyces cerevisiae",
|
132
|
+
"common_name"=>"Saccharomyces cerevisiae (baker's yeast)",
|
133
|
+
"taxonomy"=>""}
|
134
|
+
assert_equal(expected3, obj3.source)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_common_name
|
138
|
+
expected = "Saccharomyces cerevisiae (baker's yeast)"
|
139
|
+
assert_equal(expected, @obj.common_name)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_organism
|
143
|
+
expected = "Saccharomyces cerevisiae"
|
144
|
+
assert_equal(expected, @obj.organism)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_taxonomy
|
148
|
+
expected = "Eukaryota; Fungi; Dikarya; Ascomycota; Saccharomyceta; Saccharomycotina; Saccharomycetes; Saccharomycetales; Saccharomycetaceae; Saccharomyces."
|
149
|
+
assert_equal(expected, @obj.taxonomy)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_references
|
153
|
+
str=<<EOS
|
154
|
+
REFERENCE 2 (bases 1 to 2264)
|
155
|
+
AUTHORS Zhao,X., Brade,T., Cunningham,T.J. and Duester,G.
|
156
|
+
TITLE Retinoic acid controls expression of tissue remodeling genes Hmgn1
|
157
|
+
and Fgf18 at the digit-interdigit junction
|
158
|
+
JOURNAL Dev. Dyn. 239 (2), 665-671 (2010)
|
159
|
+
PUBMED 20034106
|
160
|
+
REMARK GeneRIF: limited to the digit-interdigit junction rather than being
|
161
|
+
expressed throughout the interdigital zone
|
162
|
+
EOS
|
163
|
+
com = BioNCBIDBCommon.new(str)
|
164
|
+
obj = com.references
|
165
|
+
expected =
|
166
|
+
{:mesh=>[],
|
167
|
+
:volume=>"239",
|
168
|
+
:doi=>nil,
|
169
|
+
:pages=>"665-671",
|
170
|
+
:embl_gb_record_number=>2,
|
171
|
+
:pubmed=>"20034106",
|
172
|
+
:abstract=>"",
|
173
|
+
:issue=>"2",
|
174
|
+
:year=>"2010",
|
175
|
+
:sequence_position=>"1-2264",
|
176
|
+
:affiliations=>[],
|
177
|
+
:journal=>"Dev. Dyn.",
|
178
|
+
:title=>
|
179
|
+
"Retinoic acid controls expression of tissue remodeling genes Hmgn1 and Fgf18 at the digit-interdigit junction",
|
180
|
+
:authors=>["Zhao, X.", "Brade, T.", "Cunningham, T.J.", "Duester, G."],
|
181
|
+
:medline=>"",
|
182
|
+
:url=>nil,
|
183
|
+
:comments=>
|
184
|
+
["GeneRIF: limited to the digit-interdigit junction rather than being expressed throughout the interdigital zone"]}
|
185
|
+
actual = {:abstract => obj[0].abstract,
|
186
|
+
:affiliations => obj[0].affiliations,
|
187
|
+
:authors => obj[0].authors,
|
188
|
+
:comments => obj[0].comments,
|
189
|
+
:doi => obj[0].doi,
|
190
|
+
:embl_gb_record_number => obj[0].embl_gb_record_number,
|
191
|
+
:issue => obj[0].issue,
|
192
|
+
:journal => obj[0].journal,
|
193
|
+
:medline => obj[0].medline,
|
194
|
+
:mesh => obj[0].mesh,
|
195
|
+
:pages => obj[0].pages,
|
196
|
+
:pubmed => obj[0].pubmed,
|
197
|
+
:sequence_position => obj[0].sequence_position,
|
198
|
+
:title => obj[0].title,
|
199
|
+
:url => obj[0].url,
|
200
|
+
:volume => obj[0].volume,
|
201
|
+
:year => obj[0].year}
|
202
|
+
assert_equal(expected, actual)
|
203
|
+
actual2 = ""
|
204
|
+
com.references do |reference|
|
205
|
+
actual2 = reference.authors
|
206
|
+
break
|
207
|
+
end
|
208
|
+
assert_equal(["Zhao, X.", "Brade, T.", "Cunningham, T.J.", "Duester, G."],actual2)
|
209
|
+
|
210
|
+
|
211
|
+
#the other pattern where a journal doesn't match the regexp.
|
212
|
+
ref=<<EOS
|
213
|
+
REFERENCE 2 (bases 1 to 2264)
|
214
|
+
JOURNAL testcase
|
215
|
+
EOS
|
216
|
+
obj2 = BioNCBIDBCommon.new(ref)
|
217
|
+
actual3 = obj2.references[0].journal
|
218
|
+
assert_equal("testcase",actual3)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_comment
|
222
|
+
expected = ""
|
223
|
+
assert_equal(expected, @obj.comment)
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_features
|
227
|
+
expected =
|
228
|
+
{:feature=>"CDS",
|
229
|
+
:position=>"<1..206",
|
230
|
+
:qualifiers=>
|
231
|
+
[{:qualifier=>"product",
|
232
|
+
:value=>"TCP1-beta"},
|
233
|
+
{:value=>3, :qualifier=>"codon_start"},
|
234
|
+
{:qualifier=>"translation",
|
235
|
+
:value=>
|
236
|
+
"SSIYNGISTSGLDLNNGTIADMRQLGIVESYKLKRAVVSSASEAAEVLLRVDNIIRARPRTANRQHM"}]}
|
237
|
+
fet =<<EOS
|
238
|
+
FEATURES Location/Qualifiers
|
239
|
+
CDS <1..206
|
240
|
+
/product="TCP1-beta"
|
241
|
+
/codon_start=3
|
242
|
+
/translation="SSIYNGISTSGLDLNNGTIADMRQLGIVESYKLKRAVVSSASEA
|
243
|
+
AEVLLRVDNIIRARPRTANRQHM"
|
244
|
+
EOS
|
245
|
+
obj = BioNCBIDBCommon.new(fet)
|
246
|
+
actual =
|
247
|
+
{:feature=>obj.features[0].feature,
|
248
|
+
:position=>obj.features[0].position,
|
249
|
+
:qualifiers=>
|
250
|
+
[{:qualifier=>obj.features[0].qualifiers[0].qualifier,
|
251
|
+
:value=>obj.features[0].qualifiers[0].value},
|
252
|
+
{:qualifier=>obj.features[0].qualifiers[1].qualifier,
|
253
|
+
:value=>
|
254
|
+
obj.features[0].qualifiers[1].value},
|
255
|
+
{:qualifier=>obj.features[0].qualifiers[2].qualifier,
|
256
|
+
:value=>
|
257
|
+
obj.features[0].qualifiers[2].value}]}
|
258
|
+
assert_equal(expected, actual)
|
259
|
+
actual2 = ""
|
260
|
+
obj.features do |feature|
|
261
|
+
actual2 = feature.feature
|
262
|
+
end
|
263
|
+
|
264
|
+
assert_equal("CDS", actual2)
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_origin
|
268
|
+
expected = ""
|
269
|
+
assert_equal(expected, @obj.origin)
|
270
|
+
end
|
271
|
+
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|