bio 1.4.3.0001 → 1.5.0
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.
- checksums.yaml +7 -0
- data/.travis.yml +39 -33
- data/BSDL +22 -0
- data/COPYING +2 -2
- data/COPYING.ja +36 -36
- data/ChangeLog +2404 -1025
- data/KNOWN_ISSUES.rdoc +15 -55
- data/README.rdoc +17 -23
- data/RELEASE_NOTES.rdoc +246 -183
- data/Rakefile +3 -2
- data/bin/br_biofetch.rb +29 -5
- data/bioruby.gemspec +15 -32
- data/bioruby.gemspec.erb +10 -20
- data/doc/ChangeLog-1.4.3 +1478 -0
- data/doc/RELEASE_NOTES-1.4.3.rdoc +204 -0
- data/doc/Tutorial.rd +0 -6
- data/doc/Tutorial.rd.html +7 -12
- data/doc/Tutorial.rd.ja +960 -1064
- data/doc/Tutorial.rd.ja.html +977 -1067
- data/gemfiles/Gemfile.travis-jruby1.8 +2 -1
- data/gemfiles/Gemfile.travis-jruby1.9 +2 -4
- data/gemfiles/Gemfile.travis-rbx +13 -0
- data/gemfiles/Gemfile.travis-ruby1.8 +2 -1
- data/gemfiles/Gemfile.travis-ruby1.9 +2 -4
- data/gemfiles/Gemfile.travis-ruby2.2 +9 -0
- data/lib/bio.rb +10 -43
- data/lib/bio/alignment.rb +8 -14
- data/lib/bio/appl/blast.rb +1 -2
- data/lib/bio/appl/blast/format0.rb +18 -7
- data/lib/bio/appl/blast/remote.rb +0 -9
- data/lib/bio/appl/blast/report.rb +1 -1
- data/lib/bio/appl/clustalw/report.rb +3 -1
- data/lib/bio/appl/genscan/report.rb +1 -2
- data/lib/bio/appl/iprscan/report.rb +1 -2
- data/lib/bio/appl/meme/mast.rb +4 -4
- data/lib/bio/appl/meme/mast/report.rb +1 -1
- data/lib/bio/appl/paml/codeml.rb +2 -2
- data/lib/bio/appl/paml/codeml/report.rb +1 -0
- data/lib/bio/appl/paml/common.rb +1 -1
- data/lib/bio/appl/sosui/report.rb +1 -2
- data/lib/bio/command.rb +62 -2
- data/lib/bio/data/aa.rb +13 -31
- data/lib/bio/data/codontable.rb +1 -2
- data/lib/bio/db/biosql/biosql_to_biosequence.rb +1 -0
- data/lib/bio/db/biosql/sequence.rb +1 -1
- data/lib/bio/db/embl/common.rb +1 -1
- data/lib/bio/db/embl/embl.rb +5 -4
- data/lib/bio/db/embl/format_embl.rb +3 -3
- data/lib/bio/db/embl/sptr.rb +9 -1444
- data/lib/bio/db/embl/swissprot.rb +12 -29
- data/lib/bio/db/embl/trembl.rb +13 -30
- data/lib/bio/db/embl/uniprot.rb +12 -29
- data/lib/bio/db/embl/uniprotkb.rb +1455 -0
- data/lib/bio/db/fasta.rb +17 -0
- data/lib/bio/db/fasta/defline.rb +1 -3
- data/lib/bio/db/fastq.rb +1 -1
- data/lib/bio/db/genbank/ddbj.rb +9 -5
- data/lib/bio/db/genbank/refseq.rb +11 -3
- data/lib/bio/db/gff.rb +3 -4
- data/lib/bio/db/go.rb +5 -6
- data/lib/bio/db/kegg/module.rb +4 -5
- data/lib/bio/db/kegg/pathway.rb +4 -5
- data/lib/bio/db/kegg/reaction.rb +1 -1
- data/lib/bio/db/nexus.rb +3 -2
- data/lib/bio/db/pdb/pdb.rb +2 -2
- data/lib/bio/db/phyloxml/phyloxml_elements.rb +82 -59
- data/lib/bio/db/phyloxml/phyloxml_parser.rb +2 -2
- data/lib/bio/db/phyloxml/phyloxml_writer.rb +1 -2
- data/lib/bio/db/sanger_chromatogram/chromatogram.rb +1 -2
- data/lib/bio/db/transfac.rb +1 -1
- data/lib/bio/io/das.rb +40 -41
- data/lib/bio/io/fastacmd.rb +0 -16
- data/lib/bio/io/fetch.rb +111 -55
- data/lib/bio/io/flatfile/buffer.rb +4 -5
- data/lib/bio/io/hinv.rb +2 -3
- data/lib/bio/io/ncbirest.rb +43 -6
- data/lib/bio/io/pubmed.rb +76 -81
- data/lib/bio/io/togows.rb +33 -10
- data/lib/bio/map.rb +1 -1
- data/lib/bio/pathway.rb +1 -1
- data/lib/bio/sequence/compat.rb +1 -1
- data/lib/bio/sequence/na.rb +63 -12
- data/lib/bio/shell.rb +0 -2
- data/lib/bio/shell/core.rb +5 -6
- data/lib/bio/shell/interface.rb +3 -4
- data/lib/bio/shell/irb.rb +1 -2
- data/lib/bio/shell/plugin/entry.rb +2 -3
- data/lib/bio/shell/plugin/seq.rb +7 -6
- data/lib/bio/shell/setup.rb +1 -2
- data/lib/bio/tree.rb +2 -2
- data/lib/bio/util/contingency_table.rb +0 -2
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +2 -2
- data/lib/bio/util/sirna.rb +76 -16
- data/lib/bio/version.rb +8 -9
- data/sample/benchmark_clustalw_report.rb +47 -0
- data/sample/biofetch.rb +248 -151
- data/setup.rb +6 -7
- data/test/data/clustalw/example1-seqnos.aln +58 -0
- data/test/network/bio/appl/blast/test_remote.rb +1 -15
- data/test/network/bio/appl/test_blast.rb +0 -12
- data/test/network/bio/io/test_pubmed.rb +49 -0
- data/test/network/bio/io/test_togows.rb +0 -1
- data/test/network/bio/test_command.rb +65 -2
- data/test/unit/bio/appl/bl2seq/test_report.rb +0 -1
- data/test/unit/bio/appl/blast/test_report.rb +110 -48
- data/test/unit/bio/appl/clustalw/test_report.rb +67 -51
- data/test/unit/bio/appl/sim4/test_report.rb +46 -17
- data/test/unit/bio/appl/test_blast.rb +2 -2
- data/test/unit/bio/db/embl/test_embl.rb +0 -1
- data/test/unit/bio/db/embl/test_embl_rel89.rb +0 -1
- data/test/unit/bio/db/embl/{test_sptr.rb → test_uniprotkb.rb} +111 -115
- data/test/unit/bio/db/embl/{test_uniprot_new_part.rb → test_uniprotkb_new_part.rb} +11 -11
- data/test/unit/bio/db/genbank/test_genbank.rb +10 -4
- data/test/unit/bio/db/pdb/test_pdb.rb +14 -8
- data/test/unit/bio/db/test_fasta.rb +41 -1
- data/test/unit/bio/db/test_fastq.rb +14 -4
- data/test/unit/bio/db/test_gff.rb +2 -2
- data/test/unit/bio/db/test_phyloxml.rb +30 -30
- data/test/unit/bio/db/test_phyloxml_writer.rb +2 -2
- data/test/unit/bio/io/flatfile/test_autodetection.rb +1 -2
- data/test/unit/bio/io/flatfile/test_buffer.rb +7 -1
- data/test/unit/bio/io/flatfile/test_splitter.rb +1 -1
- data/test/unit/bio/io/test_togows.rb +3 -2
- data/test/unit/bio/sequence/test_dblink.rb +1 -1
- data/test/unit/bio/sequence/test_na.rb +3 -1
- data/test/unit/bio/test_alignment.rb +1 -2
- data/test/unit/bio/test_command.rb +5 -4
- data/test/unit/bio/test_db.rb +4 -2
- data/test/unit/bio/test_pathway.rb +25 -10
- data/test/unit/bio/util/test_sirna.rb +22 -22
- metadata +656 -1430
- data/doc/KEGG_API.rd +0 -1843
- data/doc/KEGG_API.rd.ja +0 -1834
- data/extconf.rb +0 -2
- data/lib/bio/appl/blast/ddbj.rb +0 -131
- data/lib/bio/db/kegg/taxonomy.rb +0 -280
- data/lib/bio/io/dbget.rb +0 -194
- data/lib/bio/io/ddbjrest.rb +0 -344
- data/lib/bio/io/ddbjxml.rb +0 -458
- data/lib/bio/io/ebisoap.rb +0 -158
- data/lib/bio/io/ensembl.rb +0 -229
- data/lib/bio/io/higet.rb +0 -73
- data/lib/bio/io/keggapi.rb +0 -363
- data/lib/bio/io/ncbisoap.rb +0 -156
- data/lib/bio/io/soapwsdl.rb +0 -119
- data/lib/bio/shell/plugin/keggapi.rb +0 -181
- data/lib/bio/shell/plugin/soap.rb +0 -87
- data/sample/dbget +0 -37
- data/sample/demo_ddbjxml.rb +0 -212
- data/sample/demo_kegg_taxonomy.rb +0 -92
- data/sample/demo_keggapi.rb +0 -502
- data/sample/psortplot_html.rb +0 -214
- data/test/network/bio/io/test_ddbjrest.rb +0 -47
- data/test/network/bio/io/test_ensembl.rb +0 -230
- data/test/network/bio/io/test_soapwsdl.rb +0 -53
- data/test/unit/bio/io/test_ddbjxml.rb +0 -81
- data/test/unit/bio/io/test_ensembl.rb +0 -111
- data/test/unit/bio/io/test_soapwsdl.rb +0 -33
@@ -5,7 +5,6 @@
|
|
5
5
|
# Diana Jaunzeikare <latvianlinuxgirl@gmail.com>
|
6
6
|
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id:$
|
9
8
|
#
|
10
9
|
# == Description
|
11
10
|
#
|
@@ -162,6 +161,7 @@ module PhyloXML
|
|
162
161
|
ensure
|
163
162
|
obj.close if obj and !obj.closed?
|
164
163
|
end
|
164
|
+
ret
|
165
165
|
else
|
166
166
|
obj
|
167
167
|
end
|
@@ -258,7 +258,7 @@ module PhyloXML
|
|
258
258
|
|
259
259
|
schema = _schema
|
260
260
|
begin
|
261
|
-
flag = xml_instance.validate_schema(schema) do |msg,
|
261
|
+
flag = xml_instance.validate_schema(schema) do |msg, _|
|
262
262
|
# The document of libxml-ruby says that the block is called
|
263
263
|
# when validation failed, but it seems it is never called
|
264
264
|
# even when validation failed!
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# Copyright:: Copyright (C) 2009 Anthony Underwood <anthony.underwood@hpa.org.uk>, <email2ants@gmail.com>
|
5
5
|
# License:: The Ruby License
|
6
6
|
#
|
7
|
-
# $Id:$
|
8
7
|
#
|
9
8
|
require 'bio/sequence/adapter'
|
10
9
|
module Bio
|
@@ -103,7 +102,7 @@ module Bio
|
|
103
102
|
@gtrace = tmp_trace.reverse
|
104
103
|
|
105
104
|
# reverse base qualities
|
106
|
-
if
|
105
|
+
if (defined? @aqual) && @aqual # if qualities exist
|
107
106
|
tmp_qual = @aqual
|
108
107
|
@aqual = @tqual.reverse
|
109
108
|
@tqual = tmp_qual.reverse
|
data/lib/bio/db/transfac.rb
CHANGED
@@ -118,7 +118,7 @@ class TRANSFAC < EMBLDB
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
ma_dat.keys.sort.each_with_index do |k, i|
|
121
|
-
|
121
|
+
ma_dat[k].slice!(-1, 1)
|
122
122
|
ma_dat[k].slice!(-1, 1)
|
123
123
|
ma_ary[i] = ma_dat[k].split(/\s+/)
|
124
124
|
ma_ary[i].each_with_index do |x, j|
|
data/lib/bio/io/das.rb
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
# Toshiaki Katayama <k@bioruby.org>
|
7
7
|
# License:: The Ruby License
|
8
8
|
#
|
9
|
-
# $Id:$
|
10
9
|
#
|
11
10
|
#--
|
12
11
|
# == TODO
|
@@ -49,9 +48,9 @@ class DAS
|
|
49
48
|
ary = []
|
50
49
|
result = Bio::Command.post_form("#{@server}/das/dsn")
|
51
50
|
doc = REXML::Document.new(result.body)
|
52
|
-
doc.elements.each('/descendant::DSN') do |
|
51
|
+
doc.elements.each('/descendant::DSN') do |ee|
|
53
52
|
dsn = DSN.new
|
54
|
-
|
53
|
+
ee.elements.each do |e|
|
55
54
|
case e.name
|
56
55
|
when 'SOURCE'
|
57
56
|
dsn.source = e.text
|
@@ -80,10 +79,10 @@ class DAS
|
|
80
79
|
end
|
81
80
|
result = Bio::Command.post_form("#{@server}/das/#{src}/entry_points")
|
82
81
|
doc = REXML::Document.new(result.body)
|
83
|
-
doc.elements.each('/descendant::ENTRY_POINTS') do |
|
84
|
-
entry_point.href =
|
85
|
-
entry_point.version =
|
86
|
-
|
82
|
+
doc.elements.each('/descendant::ENTRY_POINTS') do |ee|
|
83
|
+
entry_point.href = ee.attributes['href']
|
84
|
+
entry_point.version = ee.attributes['version']
|
85
|
+
ee.elements.each do |e|
|
87
86
|
segment = SEGMENT.new
|
88
87
|
segment.entry_id = e.attributes['id']
|
89
88
|
segment.start = e.attributes['start']
|
@@ -120,9 +119,9 @@ class DAS
|
|
120
119
|
sequence.start = e.attributes['start']
|
121
120
|
sequence.stop = e.attributes['stop']
|
122
121
|
sequence.version = e.attributes['version']
|
123
|
-
e.elements.each do |
|
124
|
-
sequence.sequence = Bio::Sequence::NA.new(
|
125
|
-
sequence.length =
|
122
|
+
e.elements.each do |el|
|
123
|
+
sequence.sequence = Bio::Sequence::NA.new(el.text)
|
124
|
+
sequence.length = el.attributes['length'].to_i
|
126
125
|
end
|
127
126
|
ary << sequence
|
128
127
|
end
|
@@ -183,22 +182,22 @@ class DAS
|
|
183
182
|
|
184
183
|
result = Bio::Command.post_form("#{@server}/das/#{dsn}/types", opts)
|
185
184
|
doc = REXML::Document.new(result.body)
|
186
|
-
doc.elements.each('/descendant::GFF') do |
|
187
|
-
types.version =
|
188
|
-
types.href =
|
189
|
-
|
185
|
+
doc.elements.each('/descendant::GFF') do |ee|
|
186
|
+
types.version = ee.attributes['version']
|
187
|
+
types.href = ee.attributes['href']
|
188
|
+
ee.elements.each do |e|
|
190
189
|
segment = SEGMENT.new
|
191
190
|
segment.entry_id = e.attributes['id']
|
192
191
|
segment.start = e.attributes['start']
|
193
192
|
segment.stop = e.attributes['stop']
|
194
193
|
segment.version = e.attributes['version']
|
195
194
|
segment.label = e.attributes['label']
|
196
|
-
e.elements.each do |
|
195
|
+
e.elements.each do |el|
|
197
196
|
t = TYPE.new
|
198
|
-
t.entry_id =
|
199
|
-
t.method =
|
200
|
-
t.category =
|
201
|
-
t.count =
|
197
|
+
t.entry_id = el.attributes['id']
|
198
|
+
t.method = el.attributes['method']
|
199
|
+
t.category = el.attributes['category']
|
200
|
+
t.count = el.text.to_i
|
202
201
|
segment.types << t
|
203
202
|
end
|
204
203
|
types.segments << segment
|
@@ -234,21 +233,21 @@ class DAS
|
|
234
233
|
|
235
234
|
result = Bio::Command.post_form("#{@server}/das/#{dsn}/features", opts)
|
236
235
|
doc = REXML::Document.new(result.body)
|
237
|
-
doc.elements.each('/descendant::GFF') do |
|
238
|
-
gff.version =
|
239
|
-
gff.href =
|
240
|
-
|
236
|
+
doc.elements.each('/descendant::GFF') do |elem|
|
237
|
+
gff.version = elem.attributes['version']
|
238
|
+
gff.href = elem.attributes['href']
|
239
|
+
elem.elements.each('SEGMENT') do |ele|
|
241
240
|
segment = SEGMENT.new
|
242
|
-
segment.entry_id =
|
243
|
-
segment.start =
|
244
|
-
segment.stop =
|
245
|
-
segment.version =
|
246
|
-
segment.label =
|
247
|
-
|
241
|
+
segment.entry_id = ele.attributes['id']
|
242
|
+
segment.start = ele.attributes['start']
|
243
|
+
segment.stop = ele.attributes['stop']
|
244
|
+
segment.version = ele.attributes['version']
|
245
|
+
segment.label = ele.attributes['label']
|
246
|
+
ele.elements.each do |el|
|
248
247
|
feature = FEATURE.new
|
249
|
-
feature.entry_id =
|
250
|
-
feature.label =
|
251
|
-
|
248
|
+
feature.entry_id = el.attributes['id']
|
249
|
+
feature.label = el.attributes['label']
|
250
|
+
el.elements.each do |e|
|
252
251
|
case e.name
|
253
252
|
when 'TYPE'
|
254
253
|
type = TYPE.new
|
@@ -289,21 +288,21 @@ class DAS
|
|
289
288
|
group.entry_id = e.attributes['id']
|
290
289
|
group.label = e.attributes['label']
|
291
290
|
group.type = e.attributes['type']
|
292
|
-
e.elements.each do |
|
293
|
-
case
|
291
|
+
e.elements.each do |ee|
|
292
|
+
case ee.name
|
294
293
|
when 'NOTE' # in GROUP
|
295
|
-
group.notes <<
|
294
|
+
group.notes << ee.text
|
296
295
|
when 'LINK' # in GROUP
|
297
296
|
link = LINK.new
|
298
|
-
link.href =
|
299
|
-
link.text =
|
297
|
+
link.href = ee.attributes['href']
|
298
|
+
link.text = ee.text
|
300
299
|
group.links << link
|
301
300
|
when 'TARGET' # in GROUP
|
302
301
|
target = TARGET.new
|
303
|
-
target.entry_id =
|
304
|
-
target.start =
|
305
|
-
target.stop =
|
306
|
-
target.name =
|
302
|
+
target.entry_id = ee.attributes['id']
|
303
|
+
target.start = ee.attributes['start']
|
304
|
+
target.stop = ee.attributes['stop']
|
305
|
+
target.name = ee.text
|
307
306
|
group.targets << target
|
308
307
|
end
|
309
308
|
end
|
data/lib/bio/io/fastacmd.rb
CHANGED
@@ -8,7 +8,6 @@
|
|
8
8
|
# Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
9
9
|
# License:: The Ruby License
|
10
10
|
#
|
11
|
-
# $Id: fastacmd.rb,v 1.16 2007/04/05 23:35:41 trevor Exp $
|
12
11
|
#
|
13
12
|
|
14
13
|
require 'bio/db/fasta'
|
@@ -146,18 +145,3 @@ end # class Fastacmd
|
|
146
145
|
end # class Blast
|
147
146
|
end # module Bio
|
148
147
|
|
149
|
-
if $0 == __FILE__
|
150
|
-
fastacmd = Bio::Blast::Fastacmd.new("/path_to_my_db/db_name")
|
151
|
-
seq = fastacmd.get_by_id('id_of_entry1')
|
152
|
-
puts seq.class
|
153
|
-
puts seq
|
154
|
-
|
155
|
-
seqs = fastacmd.fetch(['id_of_entry1','id_of_entry2'])
|
156
|
-
seqs.each do |seq|
|
157
|
-
puts seq
|
158
|
-
end
|
159
|
-
|
160
|
-
fastacmd.each_entry do |fasta|
|
161
|
-
puts fasta.seq.size.to_s + "\t" + fasta.definition
|
162
|
-
end
|
163
|
-
end
|
data/lib/bio/io/fetch.rb
CHANGED
@@ -5,24 +5,31 @@
|
|
5
5
|
# Copyright (C) 2006 Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
6
6
|
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id:$
|
9
|
-
#
|
10
8
|
# == DESCRIPTION
|
11
9
|
#
|
12
|
-
# Using
|
13
|
-
#
|
14
|
-
# br_server = Bio::Fetch.new()
|
15
|
-
# puts br_server.databases
|
16
|
-
# puts br_server.formats('embl')
|
17
|
-
# puts br_server.maxids
|
18
|
-
#
|
19
|
-
# Using EBI BioFetch server
|
10
|
+
# Using EBI Dbfetch server
|
20
11
|
#
|
21
|
-
# ebi_server = Bio::Fetch.new
|
12
|
+
# ebi_server = Bio::Fetch::EBI.new
|
13
|
+
# puts ebi_server.fetch('embl', 'J00231')
|
22
14
|
# puts ebi_server.fetch('embl', 'J00231', 'raw')
|
23
15
|
# puts ebi_server.fetch('embl', 'J00231', 'html')
|
24
|
-
#
|
25
|
-
#
|
16
|
+
#
|
17
|
+
# Getting metadata from EBI Dbfetch server
|
18
|
+
#
|
19
|
+
# puts ebi_server.databases
|
20
|
+
# puts ebi_server.formats('embl')
|
21
|
+
# puts ebi_server.maxids
|
22
|
+
#
|
23
|
+
# Using EBI Dbfetch server without creating a Bio::Fetch::EBI instance
|
24
|
+
#
|
25
|
+
# puts Bio::Fetch::EBI.query('ena_sequence', 'J00231')
|
26
|
+
# puts Bio::Fetch::EBI.query('ena_sequence', 'J00231', 'raw', 'fasta')
|
27
|
+
#
|
28
|
+
# Using a BioFetch server with specifying URL
|
29
|
+
#
|
30
|
+
# server = Bio::Fetch.new('http://www.ebi.ac.uk/Tools/dbfetch/dbfetch')
|
31
|
+
# puts server.fetch('ena_sequence', 'J00231')
|
32
|
+
# puts server.fetch('ena_sequence', 'J00231', 'raw', 'fasta')
|
26
33
|
#
|
27
34
|
|
28
35
|
require 'uri'
|
@@ -37,26 +44,39 @@ module Bio
|
|
37
44
|
# nucleic or amino acid sequence.
|
38
45
|
#
|
39
46
|
# Possible dbfetch servers include:
|
40
|
-
# * http://
|
41
|
-
#
|
47
|
+
# * http://www.ebi.ac.uk/Tools/dbfetch/dbfetch
|
48
|
+
#
|
49
|
+
# Note that old URL http://www.ebi.ac.uk/cgi-bin/dbfetch still alives
|
50
|
+
# probably because of compatibility, but using the new URL is recommended.
|
51
|
+
#
|
52
|
+
# Historically, there were other dbfetch servers including:
|
53
|
+
# * http://bioruby.org/cgi-bin/biofetch.rb (default before BioRuby 1.4)
|
54
|
+
# But they are unavailable now.
|
55
|
+
#
|
42
56
|
#
|
43
57
|
# If you're behind a proxy server, be sure to set your HTTP_PROXY
|
44
58
|
# environment variable accordingly.
|
45
59
|
#
|
46
60
|
# = USAGE
|
47
61
|
# require 'bio'
|
48
|
-
#
|
62
|
+
#
|
49
63
|
# # Retrieve the sequence of accession number M33388 from the EMBL
|
50
64
|
# # database.
|
51
|
-
# server = Bio::Fetch.new
|
65
|
+
# server = Bio::Fetch::EBI.new #uses EBI server
|
66
|
+
# puts server.fetch('ena_sequence','M33388')
|
67
|
+
#
|
68
|
+
# # database name "embl" can also be used though it is not officially listed
|
52
69
|
# puts server.fetch('embl','M33388')
|
53
|
-
#
|
54
|
-
# # Do the same thing without creating a Bio::Fetch object. This method always
|
55
|
-
# # uses the default dbfetch server: http://bioruby.org/cgi-bin/biofetch.rb
|
56
|
-
# puts Bio::Fetch.query('embl','M33388')
|
57
70
|
#
|
58
|
-
# #
|
59
|
-
# server = Bio::Fetch.new()
|
71
|
+
# # Do the same thing with explicitly giving the URL.
|
72
|
+
# server = Bio::Fetch.new(Bio::Fetch::EBI::URL) #uses EBI server
|
73
|
+
# puts server.fetch('ena_sequence','M33388')
|
74
|
+
#
|
75
|
+
# # Do the same thing without creating a Bio::Fetch::EBI object.
|
76
|
+
# puts Bio::Fetch::EBI.query('ena_sequence','M33388')
|
77
|
+
#
|
78
|
+
# # To know what databases are available on the dbfetch server:
|
79
|
+
# server = Bio::Fetch::EBI.new
|
60
80
|
# puts server.databases
|
61
81
|
#
|
62
82
|
# # Some databases provide their data in different formats (e.g. 'fasta',
|
@@ -66,15 +86,62 @@ module Bio
|
|
66
86
|
#
|
67
87
|
class Fetch
|
68
88
|
|
89
|
+
# Bio::Fetch::EBI is a client of EBI Dbfetch
|
90
|
+
# (http://www.ebi.ac.uk/Tools/dbfetch/dbfetch).
|
91
|
+
#
|
92
|
+
# An instance of this class works the same as:
|
93
|
+
# obj = Bio::Fetch.new("http://www.ebi.ac.uk/Tools/dbfetch/dbfetch")
|
94
|
+
# obj.database = "ena_sequence"
|
95
|
+
#
|
96
|
+
# See the documents of Bio::Fetch for more details.
|
97
|
+
class EBI < Fetch
|
98
|
+
|
99
|
+
# EBI Dbfetch server URL
|
100
|
+
URL = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch".freeze
|
101
|
+
|
102
|
+
# For the usage, see the document of Bio::Fetch.new.
|
103
|
+
def initialize(url = URL)
|
104
|
+
@database = "ena_sequence"
|
105
|
+
super
|
106
|
+
end
|
107
|
+
|
108
|
+
# Shortcut for using EBI Dbfetch server. You can fetch an entry
|
109
|
+
# without creating an instance of Bio::Fetch::EBI. This method uses
|
110
|
+
# EBI Dbfetch server http://www.ebi.ac.uk/Tools/dbfetch/dbfetch .
|
111
|
+
#
|
112
|
+
# Example:
|
113
|
+
# puts Bio::Fetch::EBI.query('refseq','NM_123456')
|
114
|
+
# puts Bio::Fetch::EBI.query('ena_sequence','J00231')
|
115
|
+
#
|
116
|
+
# ---
|
117
|
+
# *Arguments*:
|
118
|
+
# * _database_: name of database to query (see Bio::Fetch#databases to get list of supported databases)
|
119
|
+
# * _id_: single ID or ID list separated by commas or white space
|
120
|
+
# * _style_: [raw|html] (default = 'raw')
|
121
|
+
# * _format_: name of output format (see Bio::Fetch#formats)
|
122
|
+
def self.query(*args)
|
123
|
+
self.new.fetch(*args)
|
124
|
+
end
|
125
|
+
end #class EBI
|
126
|
+
|
69
127
|
# Create a new Bio::Fetch server object that can subsequently be queried
|
70
|
-
# using the Bio::Fetch#fetch method
|
128
|
+
# using the Bio::Fetch#fetch method.
|
129
|
+
#
|
130
|
+
# You must specify _url_ of a server.
|
131
|
+
# The preset default server is deprecated.
|
132
|
+
#
|
133
|
+
# If you want to use a server without explicitly specifying the URL,
|
134
|
+
# use Bio::Fetch::EBI.new that uses EBI Dbfetch server.
|
135
|
+
#
|
71
136
|
# ---
|
72
137
|
# *Arguments*:
|
73
|
-
# * _url_: URL of dbfetch server (default
|
138
|
+
# * _url_: URL of dbfetch server. (no default value)
|
74
139
|
# *Returns*:: Bio::Fetch object
|
75
|
-
def initialize(url =
|
140
|
+
def initialize(url = nil)
|
141
|
+
unless url then
|
142
|
+
raise ArgumentError, "No server URL is given in Bio::Fetch.new. The default server URL value have been deprecated. You must explicitly specify the url or use Bio::Fetch::EBI for using EBI Dbfetch."
|
143
|
+
end
|
76
144
|
@url = url
|
77
|
-
schema, user, @host, @port, reg, @path, = URI.split(@url)
|
78
145
|
end
|
79
146
|
|
80
147
|
# The default database to query
|
@@ -90,8 +157,8 @@ module Bio
|
|
90
157
|
end
|
91
158
|
|
92
159
|
# Fetch a database entry as specified by database (db), entry id (id),
|
93
|
-
# 'raw' text or 'html' (style), and format.
|
94
|
-
#
|
160
|
+
# 'raw' text or 'html' (style), and format.
|
161
|
+
#
|
95
162
|
# Examples:
|
96
163
|
# server = Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch')
|
97
164
|
# puts server.fetch('embl','M33388','raw','fasta')
|
@@ -111,23 +178,6 @@ module Bio
|
|
111
178
|
_get(query)
|
112
179
|
end
|
113
180
|
|
114
|
-
# Shortcut for using BioRuby's BioFetch server. You can fetch an entry
|
115
|
-
# without creating an instance of BioFetch server. This method uses the
|
116
|
-
# default dbfetch server, which is http://bioruby.org/cgi-bin/biofetch.rb
|
117
|
-
#
|
118
|
-
# Example:
|
119
|
-
# puts Bio::Fetch.query('refseq','NM_12345')
|
120
|
-
#
|
121
|
-
# ---
|
122
|
-
# *Arguments*:
|
123
|
-
# * _database_: name of database to query (see Bio::Fetch#databases to get list of supported databases)
|
124
|
-
# * _id_: single ID or ID list separated by commas or white space
|
125
|
-
# * _style_: [raw|html] (default = 'raw')
|
126
|
-
# * _format_: name of output format (see Bio::Fetch#formats)
|
127
|
-
def self.query(*args)
|
128
|
-
self.new.fetch(*args)
|
129
|
-
end
|
130
|
-
|
131
181
|
# Using this method, the user can ask a dbfetch server what databases
|
132
182
|
# it supports. This would normally be the first step you'd take when
|
133
183
|
# you use a dbfetch server for the first time.
|
@@ -135,9 +185,8 @@ module Bio
|
|
135
185
|
# server = Bio::Fetch.new()
|
136
186
|
# puts server.databases # returns "aa aax bl cpd dgenes dr ec eg emb ..."
|
137
187
|
#
|
138
|
-
# This method
|
139
|
-
#
|
140
|
-
# http://www.ebi.ac.uk/cgi-bin/dbfetch/
|
188
|
+
# This method works for EBI Dbfetch server (and for the bioruby dbfetch
|
189
|
+
# server). Not all servers support this method.
|
141
190
|
# ---
|
142
191
|
# *Returns*:: array of database names
|
143
192
|
def databases
|
@@ -145,11 +194,13 @@ module Bio
|
|
145
194
|
end
|
146
195
|
|
147
196
|
# Lists the formats that are available for a given database. Like the
|
148
|
-
# Bio::Fetch#databases method,
|
149
|
-
# the
|
197
|
+
# Bio::Fetch#databases method, not all servers support this method.
|
198
|
+
# This method is available on the EBI Dbfetch server (and on the bioruby
|
199
|
+
# dbfetch server).
|
200
|
+
#
|
150
201
|
# Example:
|
151
|
-
# server = Bio::Fetch.new()
|
152
|
-
# puts server.formats('embl') # returns "default
|
202
|
+
# server = Bio::Fetch::EBI.new()
|
203
|
+
# puts server.formats('embl') # returns [ "default", "annot", ... ]
|
153
204
|
# ---
|
154
205
|
# *Arguments*:
|
155
206
|
# * _database_:: name of database you want the supported formats for
|
@@ -164,8 +215,13 @@ module Bio
|
|
164
215
|
|
165
216
|
# A dbfetch server will only return entries up to a given maximum number.
|
166
217
|
# This method retrieves that number from the server. As for the databases
|
167
|
-
# and formats methods,
|
168
|
-
#
|
218
|
+
# and formats methods, not all servers support the maxids method.
|
219
|
+
# This method is available on the EBI Dbfetch server (and on the bioruby
|
220
|
+
# dbfetch server).
|
221
|
+
#
|
222
|
+
# Example:
|
223
|
+
# server = Bio::Fetch::EBI.new
|
224
|
+
# puts server.maxids # currently returns 200
|
169
225
|
# ---
|
170
226
|
# *Arguments*: none
|
171
227
|
# *Returns*:: number
|