bio 0.7.1 → 1.0.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.
- data/bin/bioruby +71 -27
- data/bin/br_biofetch.rb +5 -17
- data/bin/br_bioflat.rb +14 -26
- data/bin/br_biogetseq.rb +6 -18
- data/bin/br_pmfetch.rb +6 -16
- data/doc/Changes-0.7.rd +35 -0
- data/doc/KEGG_API.rd +287 -172
- data/doc/KEGG_API.rd.ja +273 -160
- data/doc/Tutorial.rd +18 -9
- data/doc/Tutorial.rd.ja +656 -138
- data/lib/bio.rb +6 -24
- data/lib/bio/alignment.rb +5 -5
- data/lib/bio/appl/blast.rb +132 -98
- data/lib/bio/appl/blast/format0.rb +9 -19
- data/lib/bio/appl/blast/wublast.rb +5 -18
- data/lib/bio/appl/emboss.rb +40 -47
- data/lib/bio/appl/hmmer.rb +116 -82
- data/lib/bio/appl/hmmer/report.rb +509 -364
- data/lib/bio/appl/spidey/report.rb +7 -18
- data/lib/bio/data/na.rb +3 -21
- data/lib/bio/db.rb +3 -21
- data/lib/bio/db/aaindex.rb +147 -52
- data/lib/bio/db/embl/common.rb +27 -6
- data/lib/bio/db/embl/embl.rb +18 -10
- data/lib/bio/db/embl/sptr.rb +87 -67
- data/lib/bio/db/embl/swissprot.rb +32 -3
- data/lib/bio/db/embl/trembl.rb +32 -3
- data/lib/bio/db/embl/uniprot.rb +32 -3
- data/lib/bio/db/fasta.rb +327 -289
- data/lib/bio/db/medline.rb +25 -4
- data/lib/bio/db/nbrf.rb +12 -20
- data/lib/bio/db/pdb.rb +4 -1
- data/lib/bio/db/pdb/chemicalcomponent.rb +240 -0
- data/lib/bio/db/pdb/pdb.rb +13 -8
- data/lib/bio/db/rebase.rb +93 -97
- data/lib/bio/feature.rb +2 -31
- data/lib/bio/io/ddbjxml.rb +167 -139
- data/lib/bio/io/fastacmd.rb +89 -56
- data/lib/bio/io/flatfile.rb +994 -278
- data/lib/bio/io/flatfile/index.rb +257 -194
- data/lib/bio/io/flatfile/indexer.rb +37 -29
- data/lib/bio/reference.rb +147 -64
- data/lib/bio/sequence.rb +57 -417
- data/lib/bio/sequence/aa.rb +64 -0
- data/lib/bio/sequence/common.rb +175 -0
- data/lib/bio/sequence/compat.rb +68 -0
- data/lib/bio/sequence/format.rb +134 -0
- data/lib/bio/sequence/generic.rb +24 -0
- data/lib/bio/sequence/na.rb +189 -0
- data/lib/bio/shell.rb +9 -23
- data/lib/bio/shell/core.rb +130 -125
- data/lib/bio/shell/demo.rb +143 -0
- data/lib/bio/shell/{session.rb → interface.rb} +42 -40
- data/lib/bio/shell/object.rb +52 -0
- data/lib/bio/shell/plugin/codon.rb +4 -22
- data/lib/bio/shell/plugin/emboss.rb +23 -0
- data/lib/bio/shell/plugin/entry.rb +34 -25
- data/lib/bio/shell/plugin/flatfile.rb +5 -23
- data/lib/bio/shell/plugin/keggapi.rb +11 -24
- data/lib/bio/shell/plugin/midi.rb +5 -23
- data/lib/bio/shell/plugin/obda.rb +4 -22
- data/lib/bio/shell/plugin/seq.rb +6 -24
- data/lib/bio/shell/rails/Rakefile +10 -0
- data/lib/bio/shell/rails/app/controllers/application.rb +4 -0
- data/lib/bio/shell/rails/app/controllers/shell_controller.rb +94 -0
- data/lib/bio/shell/rails/app/helpers/application_helper.rb +3 -0
- data/lib/bio/shell/rails/app/models/shell_connection.rb +30 -0
- data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +37 -0
- data/lib/bio/shell/rails/app/views/shell/history.rhtml +5 -0
- data/lib/bio/shell/rails/app/views/shell/index.rhtml +2 -0
- data/lib/bio/shell/rails/app/views/shell/show.rhtml +13 -0
- data/lib/bio/shell/rails/config/boot.rb +19 -0
- data/lib/bio/shell/rails/config/database.yml +85 -0
- data/lib/bio/shell/rails/config/environment.rb +53 -0
- data/lib/bio/shell/rails/config/environments/development.rb +19 -0
- data/lib/bio/shell/rails/config/environments/production.rb +19 -0
- data/lib/bio/shell/rails/config/environments/test.rb +19 -0
- data/lib/bio/shell/rails/config/routes.rb +19 -0
- data/lib/bio/shell/rails/doc/README_FOR_APP +2 -0
- data/lib/bio/shell/rails/public/404.html +8 -0
- data/lib/bio/shell/rails/public/500.html +8 -0
- data/lib/bio/shell/rails/public/dispatch.cgi +10 -0
- data/lib/bio/shell/rails/public/dispatch.fcgi +24 -0
- data/lib/bio/shell/rails/public/dispatch.rb +10 -0
- data/lib/bio/shell/rails/public/favicon.ico +0 -0
- data/lib/bio/shell/rails/public/images/icon.png +0 -0
- data/lib/bio/shell/rails/public/images/rails.png +0 -0
- data/lib/bio/shell/rails/public/index.html +277 -0
- data/lib/bio/shell/rails/public/javascripts/controls.js +750 -0
- data/lib/bio/shell/rails/public/javascripts/dragdrop.js +584 -0
- data/lib/bio/shell/rails/public/javascripts/effects.js +854 -0
- data/lib/bio/shell/rails/public/javascripts/prototype.js +1785 -0
- data/lib/bio/shell/rails/public/robots.txt +1 -0
- data/lib/bio/shell/rails/public/stylesheets/main.css +187 -0
- data/lib/bio/shell/rails/script/about +3 -0
- data/lib/bio/shell/rails/script/breakpointer +3 -0
- data/lib/bio/shell/rails/script/console +3 -0
- data/lib/bio/shell/rails/script/destroy +3 -0
- data/lib/bio/shell/rails/script/generate +3 -0
- data/lib/bio/shell/rails/script/performance/benchmarker +3 -0
- data/lib/bio/shell/rails/script/performance/profiler +3 -0
- data/lib/bio/shell/rails/script/plugin +3 -0
- data/lib/bio/shell/rails/script/process/reaper +3 -0
- data/lib/bio/shell/rails/script/process/spawner +3 -0
- data/lib/bio/shell/rails/script/process/spinner +3 -0
- data/lib/bio/shell/rails/script/runner +3 -0
- data/lib/bio/shell/rails/script/server +42 -0
- data/lib/bio/shell/rails/test/test_helper.rb +28 -0
- data/lib/bio/shell/web.rb +90 -0
- data/lib/bio/util/contingency_table.rb +231 -225
- data/sample/any2fasta.rb +59 -0
- data/test/data/HMMER/hmmpfam.out +64 -0
- data/test/data/HMMER/hmmsearch.out +88 -0
- data/test/data/aaindex/DAYM780301 +30 -0
- data/test/data/aaindex/PRAM900102 +20 -0
- data/test/data/bl2seq/cd8a_cd8b_blastp.bl2seq +53 -0
- data/test/data/bl2seq/cd8a_p53_e-5blastp.bl2seq +37 -0
- data/test/data/blast/{eco:b0002.faa → b0002.faa} +0 -0
- data/test/data/blast/{eco:b0002.faa.m0 → b0002.faa.m0} +2 -2
- data/test/data/blast/{eco:b0002.faa.m7 → b0002.faa.m7} +1 -1
- data/test/data/blast/{eco:b0002.faa.m8 → b0002.faa.m8} +0 -0
- data/test/unit/bio/appl/bl2seq/test_report.rb +134 -0
- data/test/unit/bio/appl/blast/test_report.rb +15 -12
- data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -4
- data/test/unit/bio/appl/hmmer/test_report.rb +355 -0
- data/test/unit/bio/appl/test_blast.rb +5 -5
- data/test/unit/bio/data/test_na.rb +9 -18
- data/test/unit/bio/db/pdb/test_pdb.rb +169 -0
- data/test/unit/bio/db/test_aaindex.rb +197 -0
- data/test/unit/bio/io/test_fastacmd.rb +55 -0
- data/test/unit/bio/sequence/test_aa.rb +102 -0
- data/test/unit/bio/sequence/test_common.rb +178 -0
- data/test/unit/bio/sequence/test_compat.rb +82 -0
- data/test/unit/bio/sequence/test_na.rb +242 -0
- data/test/unit/bio/shell/plugin/test_seq.rb +29 -19
- data/test/unit/bio/test_alignment.rb +15 -7
- data/test/unit/bio/test_reference.rb +198 -0
- data/test/unit/bio/test_sequence.rb +4 -49
- data/test/unit/bio/test_shell.rb +2 -2
- metadata +118 -15
- data/lib/bio/io/brdb.rb +0 -103
- data/lib/bioruby.rb +0 -34
data/lib/bio.rb
CHANGED
|
@@ -3,38 +3,19 @@
|
|
|
3
3
|
#
|
|
4
4
|
# Copyright:: Copyright (C) 2001-2006
|
|
5
5
|
# Toshiaki Katayama <k@bioruby.org>
|
|
6
|
-
# License::
|
|
6
|
+
# License:: Ruby's
|
|
7
7
|
#
|
|
8
|
-
# $Id: bio.rb,v 1.
|
|
9
|
-
#
|
|
10
|
-
#--
|
|
11
|
-
#
|
|
12
|
-
# This library is free software; you can redistribute it and/or
|
|
13
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
14
|
-
# License as published by the Free Software Foundation; either
|
|
15
|
-
# version 2 of the License, or (at your option) any later version.
|
|
16
|
-
#
|
|
17
|
-
# This library is distributed in the hope that it will be useful,
|
|
18
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20
|
-
# Lesser General Public License for more details.
|
|
21
|
-
#
|
|
22
|
-
# You should have received a copy of the GNU Lesser General Public
|
|
23
|
-
# License along with this library; if not, write to the Free Software
|
|
24
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
25
|
-
#
|
|
26
|
-
#++
|
|
8
|
+
# $Id: bio.rb,v 1.66 2006/02/27 09:11:01 k Exp $
|
|
27
9
|
#
|
|
28
10
|
|
|
29
11
|
module Bio
|
|
30
12
|
|
|
31
|
-
BIORUBY_VERSION = [
|
|
13
|
+
BIORUBY_VERSION = [1, 0, 0].extend(Comparable)
|
|
32
14
|
|
|
33
15
|
### Basic data types
|
|
34
16
|
|
|
35
17
|
## Sequence
|
|
36
18
|
|
|
37
|
-
autoload :Seq, 'bio/sequence'
|
|
38
19
|
autoload :Sequence, 'bio/sequence'
|
|
39
20
|
|
|
40
21
|
## Locations/Location
|
|
@@ -119,6 +100,8 @@ module Bio
|
|
|
119
100
|
autoload :FastaDefline, 'bio/db/fasta' # change to FastaFormat::Defline
|
|
120
101
|
autoload :GFF, 'bio/db/gff'
|
|
121
102
|
autoload :AAindex, 'bio/db/aaindex'
|
|
103
|
+
autoload :AAindex1, 'bio/db/aaindex' # change to AAindex::AAindex1 ?
|
|
104
|
+
autoload :AAindex2, 'bio/db/aaindex' # change to AAindex::AAindex2 ?
|
|
122
105
|
autoload :TRANSFAC, 'bio/db/transfac'
|
|
123
106
|
autoload :PROSITE, 'bio/db/prosite'
|
|
124
107
|
autoload :LITDB, 'bio/db/litdb'
|
|
@@ -167,7 +150,6 @@ module Bio
|
|
|
167
150
|
end
|
|
168
151
|
|
|
169
152
|
# autoload :ESOAP, 'bio/io/esoap' # NCBI::ESOAP ?
|
|
170
|
-
# autoload :BRDB, 'bio/io/brdb' # remove
|
|
171
153
|
|
|
172
154
|
|
|
173
155
|
### Applications
|
|
@@ -194,7 +176,7 @@ module Bio
|
|
|
194
176
|
# autoload :Report, 'bio/appl/hmmer/report'
|
|
195
177
|
#end
|
|
196
178
|
|
|
197
|
-
|
|
179
|
+
autoload :EMBOSS, 'bio/appl/emboss' # use bio/command, improve
|
|
198
180
|
|
|
199
181
|
autoload :PSORT, 'bio/appl/psort'
|
|
200
182
|
## below are described in bio/appl/psort.rb
|
data/lib/bio/alignment.rb
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#
|
|
7
7
|
# License:: LGPL
|
|
8
8
|
#
|
|
9
|
-
# $Id: alignment.rb,v 1.
|
|
9
|
+
# $Id: alignment.rb,v 1.15 2006/01/24 14:16:59 ngoto Exp $
|
|
10
10
|
#
|
|
11
11
|
#--
|
|
12
12
|
# This library is free software; you can redistribute it and/or
|
|
@@ -817,12 +817,12 @@ Mix-in for Hash or Hash-like classes.
|
|
|
817
817
|
end
|
|
818
818
|
alias slice alignment_slice
|
|
819
819
|
|
|
820
|
-
# For each sequence, the 'subseq' method (Bio::Seqeunce#subseq is
|
|
820
|
+
# For each sequence, the 'subseq' method (Bio::Seqeunce::Common#subseq is
|
|
821
821
|
# expected) is executed, and returns a new alignment as
|
|
822
822
|
# a Bio::Alignment::SequenceArray object.
|
|
823
823
|
#
|
|
824
824
|
# All sequences in the alignment are expected to be kind of
|
|
825
|
-
# Bio::Sequence objects.
|
|
825
|
+
# Bio::Sequence::NA or Bio::Sequence::AA objects.
|
|
826
826
|
#
|
|
827
827
|
# Unlike alignment_window method, the result alignment
|
|
828
828
|
# might contain nil.
|
|
@@ -1177,7 +1177,7 @@ Mix-in for Hash or Hash-like classes.
|
|
|
1177
1177
|
# Gets the sequence from given object.
|
|
1178
1178
|
def extract_seq(obj)
|
|
1179
1179
|
seq = nil
|
|
1180
|
-
if obj.is_a?(Bio::Sequence) then
|
|
1180
|
+
if obj.is_a?(Bio::Sequence::NA) or obj.is_a?(Bio::Sequence::AA) then
|
|
1181
1181
|
seq = obj
|
|
1182
1182
|
else
|
|
1183
1183
|
for m in [ :seq, :naseq, :aaseq ]
|
|
@@ -1602,7 +1602,7 @@ Mix-in for Hash or Hash-like classes.
|
|
|
1602
1602
|
# It resembles BioPerl's AlignI::add_seq method.
|
|
1603
1603
|
def add_seq(seq, key = nil)
|
|
1604
1604
|
#(BioPerl) AlignI::add_seq like method
|
|
1605
|
-
unless seq.is_a?(Bio::Sequence)
|
|
1605
|
+
unless seq.is_a?(Bio::Sequence::NA) or seq.is_a?(Bio::Sequence::AA)
|
|
1606
1606
|
s = extract_seq(seq)
|
|
1607
1607
|
key = extract_key(seq) unless key
|
|
1608
1608
|
seq = s
|
data/lib/bio/appl/blast.rb
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
#
|
|
2
|
-
# bio/appl/blast.rb - BLAST wrapper
|
|
2
|
+
# = bio/appl/blast.rb - BLAST wrapper
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
4
|
+
# Copyright:: Copyright (C) 2001
|
|
5
|
+
# Mitsuteru C. Nakao <n@bioruby.org>
|
|
6
|
+
# Copyrigth:: Copyright (C) 2002,2003
|
|
7
|
+
# KATAYAMA Toshiaki <k@bioruby.org>
|
|
8
|
+
# License:: Ruby's
|
|
6
9
|
#
|
|
7
|
-
#
|
|
8
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
9
|
-
# License as published by the Free Software Foundation; either
|
|
10
|
-
# version 2 of the License, or (at your option) any later version.
|
|
10
|
+
# $Id: blast.rb,v 1.28 2006/02/18 16:08:10 nakao Exp $
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
-
# Lesser General Public License for more details.
|
|
12
|
+
# = Description
|
|
16
13
|
#
|
|
17
|
-
#
|
|
18
|
-
# License along with this library; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
14
|
+
# = Examples
|
|
20
15
|
#
|
|
21
|
-
#
|
|
16
|
+
# program = 'blastp'
|
|
17
|
+
# database = 'SWISS'
|
|
18
|
+
# options = '-e 0.0001'
|
|
19
|
+
# serv = Bio::Blast.new(program, database, options)
|
|
20
|
+
# server = 'genomenet'
|
|
21
|
+
# genomenet = Bio::Blast.remote(program, database, options, server)
|
|
22
|
+
# report = serv.query(sequence_text)
|
|
23
|
+
#
|
|
24
|
+
# = References
|
|
25
|
+
#
|
|
26
|
+
# * http://www.ncbi.nlm.nih.gov/blast/
|
|
27
|
+
#
|
|
28
|
+
# * http://blast.genome.jp/ideas/ideas.html#blast
|
|
22
29
|
#
|
|
23
30
|
|
|
24
31
|
require 'net/http'
|
|
@@ -28,6 +35,40 @@ require 'shellwords'
|
|
|
28
35
|
|
|
29
36
|
module Bio
|
|
30
37
|
|
|
38
|
+
# BLAST wrapper
|
|
39
|
+
#
|
|
40
|
+
# == Description
|
|
41
|
+
#
|
|
42
|
+
# A blastall program wrapper.
|
|
43
|
+
#
|
|
44
|
+
# == Examples
|
|
45
|
+
#
|
|
46
|
+
# program = 'blastp'
|
|
47
|
+
# database = 'SWISS'
|
|
48
|
+
# options = '-e 0.0001'
|
|
49
|
+
# serv = Bio::Blast.new(program, database, options)
|
|
50
|
+
#
|
|
51
|
+
# server = 'genomenet'
|
|
52
|
+
# genomenet = Bio::Blast.remote(program, database, options, server)
|
|
53
|
+
#
|
|
54
|
+
# report = serv.query(sequence_text)
|
|
55
|
+
#
|
|
56
|
+
# == Available databases for Blast.remote(@program, @db, option, 'genomenet')
|
|
57
|
+
#
|
|
58
|
+
# ----------+-------+---------------------------------------------------
|
|
59
|
+
# @program | query | @db (supported in GenomeNet)
|
|
60
|
+
# ----------+-------+---------------------------------------------------
|
|
61
|
+
# blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd,
|
|
62
|
+
# ----------+-------+ pir, prf, pdbstr
|
|
63
|
+
# blastx | NA |
|
|
64
|
+
# ----------+-------+---------------------------------------------------
|
|
65
|
+
# blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss,
|
|
66
|
+
# ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd,
|
|
67
|
+
# tblastn | AA | genes-nt, genome, vgenes.nuc
|
|
68
|
+
# ----------+-------+---------------------------------------------------
|
|
69
|
+
#
|
|
70
|
+
# * See http://blast.genome.jp/ideas/ideas.html#blast for more details.
|
|
71
|
+
#
|
|
31
72
|
class Blast
|
|
32
73
|
|
|
33
74
|
autoload :Fastacmd, 'bio/io/fastacmd'
|
|
@@ -38,6 +79,76 @@ module Bio
|
|
|
38
79
|
|
|
39
80
|
include Bio::Command::Tools
|
|
40
81
|
|
|
82
|
+
# Sets up the blast program at the localhost
|
|
83
|
+
def self.local(program, db, option = '')
|
|
84
|
+
self.new(program, db, option, 'local')
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Sets up the blast program at the remote host (server)
|
|
88
|
+
def self.remote(program, db, option = '', server = 'genomenet')
|
|
89
|
+
self.new(program, db, option, server)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# the method Bio::Blast.report is moved from bio/appl/blast/report.rb.
|
|
93
|
+
# only for xml format
|
|
94
|
+
def self.reports(input, parser = nil)
|
|
95
|
+
ary = []
|
|
96
|
+
input.each("</BlastOutput>\n") do |xml|
|
|
97
|
+
xml.sub!(/[^<]*(<?)/, '\1') # skip before <?xml> tag
|
|
98
|
+
next if xml.empty? # skip trailing no hits
|
|
99
|
+
if block_given?
|
|
100
|
+
yield Report.new(xml, parser)
|
|
101
|
+
else
|
|
102
|
+
ary << Report.new(xml, parser)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
return ary
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# Program name for blastall -p (blastp, blastn, blastx, tblastn or tblastx).
|
|
110
|
+
attr_accessor :program
|
|
111
|
+
|
|
112
|
+
# Database name for blastall -d
|
|
113
|
+
attr_accessor :db
|
|
114
|
+
|
|
115
|
+
# Options for blastall
|
|
116
|
+
attr_accessor :options
|
|
117
|
+
|
|
118
|
+
#
|
|
119
|
+
attr_accessor :server
|
|
120
|
+
|
|
121
|
+
# Full path for blastall. (default: 'blastall').
|
|
122
|
+
attr_accessor :blastall
|
|
123
|
+
|
|
124
|
+
# Substitution matrix for blastall -M
|
|
125
|
+
attr_accessor :matrix
|
|
126
|
+
|
|
127
|
+
# Filter option for blastall -F (T or F).
|
|
128
|
+
attr_accessor :filter
|
|
129
|
+
|
|
130
|
+
# Returns a String containing blast execution output in as is the Bio::Blast#format.
|
|
131
|
+
attr_reader :output
|
|
132
|
+
|
|
133
|
+
# Output report format for blastall -m
|
|
134
|
+
#
|
|
135
|
+
# 0, pairwise; 1; 2; 3; 4; 5; 6; 7, XML Blast outpu;, 8, tabular;
|
|
136
|
+
# 9, tabular with comment lines; 10, ASN text; 11, ASN binery [intege].
|
|
137
|
+
attr_reader :format
|
|
138
|
+
|
|
139
|
+
#
|
|
140
|
+
attr_writer :parser # to change :xmlparser, :rexml, :tab
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# Returns a blast factory object (Bio::Blast).
|
|
144
|
+
#
|
|
145
|
+
# --- Bio::Blast.new(program, db, option = '', server = 'local')
|
|
146
|
+
# --- Bio::Blast.local(program, db, option = '')
|
|
147
|
+
# --- Bio::Blast.remote(program, db, option = '', server = 'genomenet')
|
|
148
|
+
#
|
|
149
|
+
# For the develpper, you can add server 'hoge' by adding
|
|
150
|
+
# exec_hoge(query) method.
|
|
151
|
+
#
|
|
41
152
|
def initialize(program, db, opt = [], server = 'local')
|
|
42
153
|
@program = program
|
|
43
154
|
@db = db
|
|
@@ -65,48 +176,24 @@ module Bio
|
|
|
65
176
|
end
|
|
66
177
|
@options = [ *a ]
|
|
67
178
|
end
|
|
68
|
-
attr_accessor :program, :db, :options, :server, :blastall, :matrix, :filter
|
|
69
|
-
attr_reader :output, :format
|
|
70
|
-
attr_writer :parser # to change :xmlparser, :rexml, :tab
|
|
71
|
-
|
|
72
|
-
def self.local(program, db, option = '')
|
|
73
|
-
self.new(program, db, option, 'local')
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def self.remote(program, db, option = '', server = 'genomenet')
|
|
77
|
-
self.new(program, db, option, server)
|
|
78
|
-
end
|
|
79
179
|
|
|
180
|
+
# Execute blast search and returns Report object (Bio::Blast::Report).
|
|
80
181
|
def query(query)
|
|
81
182
|
return self.send("exec_#{@server}", query.to_s)
|
|
82
183
|
end
|
|
83
184
|
|
|
185
|
+
# option reader
|
|
84
186
|
def option
|
|
85
187
|
# backward compatibility
|
|
86
188
|
make_command_line(@options)
|
|
87
189
|
end
|
|
88
190
|
|
|
191
|
+
# option setter
|
|
89
192
|
def option=(str)
|
|
90
193
|
# backward compatibility
|
|
91
194
|
@options = Shellwords.shellwords(str)
|
|
92
195
|
end
|
|
93
196
|
|
|
94
|
-
# the method Bio::Blast.report is moved from bio/appl/blast/report.rb.
|
|
95
|
-
# only for xml format
|
|
96
|
-
def self.reports(input, parser = nil)
|
|
97
|
-
ary = []
|
|
98
|
-
input.each("</BlastOutput>\n") do |xml|
|
|
99
|
-
xml.sub!(/[^<]*(<?)/, '\1') # skip before <?xml> tag
|
|
100
|
-
next if xml.empty? # skip trailing no hits
|
|
101
|
-
if block_given?
|
|
102
|
-
yield Report.new(xml, parser)
|
|
103
|
-
else
|
|
104
|
-
ary << Report.new(xml, parser)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
return ary
|
|
108
|
-
end
|
|
109
|
-
|
|
110
197
|
|
|
111
198
|
private
|
|
112
199
|
|
|
@@ -189,13 +276,13 @@ module Bio
|
|
|
189
276
|
return report
|
|
190
277
|
end
|
|
191
278
|
|
|
192
|
-
|
|
193
279
|
def exec_ncbi(query)
|
|
194
280
|
raise NotImplementedError
|
|
195
281
|
end
|
|
196
|
-
end
|
|
197
282
|
|
|
198
|
-
end
|
|
283
|
+
end # class Blast
|
|
284
|
+
|
|
285
|
+
end # module Bio
|
|
199
286
|
|
|
200
287
|
|
|
201
288
|
if __FILE__ == $0
|
|
@@ -214,56 +301,3 @@ if __FILE__ == $0
|
|
|
214
301
|
end
|
|
215
302
|
|
|
216
303
|
|
|
217
|
-
=begin
|
|
218
|
-
|
|
219
|
-
= Bio::Blast
|
|
220
|
-
|
|
221
|
-
--- Bio::Blast.new(program, db, option = '', server = 'local')
|
|
222
|
-
--- Bio::Blast.local(program, db, option = '')
|
|
223
|
-
--- Bio::Blast.remote(program, db, option = '', server = 'genomenet')
|
|
224
|
-
|
|
225
|
-
Returns a blast factory object (Bio::Blast).
|
|
226
|
-
|
|
227
|
-
For the develpper, you can add server 'hoge' by adding
|
|
228
|
-
exec_hoge(query) method.
|
|
229
|
-
|
|
230
|
-
--- Bio::Blast#query(query)
|
|
231
|
-
|
|
232
|
-
Execute blast search and returns Report object (Bio::Blast::Report).
|
|
233
|
-
|
|
234
|
-
--- Bio::Blast#output
|
|
235
|
-
|
|
236
|
-
Returns a String containing blast execution output in as is format.
|
|
237
|
-
|
|
238
|
-
--- Bio::Blast#program
|
|
239
|
-
--- Bio::Blast#db
|
|
240
|
-
--- Bio::Blast#options
|
|
241
|
-
--- Bio::Blast#server
|
|
242
|
-
--- Bio::Blast#blastall
|
|
243
|
-
--- Bio::Blast#filter
|
|
244
|
-
|
|
245
|
-
Accessors for the factory parameters.
|
|
246
|
-
|
|
247
|
-
--- Bio::Blast#option
|
|
248
|
-
--- Bio::Blast#option=(str)
|
|
249
|
-
|
|
250
|
-
Get/set options by string.
|
|
251
|
-
|
|
252
|
-
== Available databases for Blast.remote(@program, @db, option, 'genomenet')
|
|
253
|
-
|
|
254
|
-
# ----------+-------+---------------------------------------------------
|
|
255
|
-
# @program | query | @db (supported in GenomeNet)
|
|
256
|
-
# ----------+-------+---------------------------------------------------
|
|
257
|
-
# blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd,
|
|
258
|
-
# ----------+-------+ pir, prf, pdbstr
|
|
259
|
-
# blastx | NA |
|
|
260
|
-
# ----------+-------+---------------------------------------------------
|
|
261
|
-
# blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss,
|
|
262
|
-
# ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd,
|
|
263
|
-
# tblastn | AA | genes-nt, genome, vgenes.nuc
|
|
264
|
-
# ----------+-------+---------------------------------------------------
|
|
265
|
-
|
|
266
|
-
See http://blast.genome.jp/ideas/ideas.html#blast for more details.
|
|
267
|
-
|
|
268
|
-
=end
|
|
269
|
-
|
|
@@ -2,26 +2,10 @@
|
|
|
2
2
|
# = bio/appl/blast/format0.rb - BLAST default output (-m 0) parser
|
|
3
3
|
#
|
|
4
4
|
# Author:: Naohisa GOTO
|
|
5
|
-
# Copyright:: Copyright (C) 2003 GOTO Naohisa <ng@bioruby.org>
|
|
6
|
-
# License::
|
|
5
|
+
# Copyright:: Copyright (C) 2003-2006 GOTO Naohisa <ng@bioruby.org>
|
|
6
|
+
# License:: Ruby's
|
|
7
7
|
#
|
|
8
|
-
|
|
9
|
-
# This library is free software; you can redistribute it and/or
|
|
10
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
11
|
-
# License as published by the Free Software Foundation; either
|
|
12
|
-
# version 2 of the License, or (at your option) any later version.
|
|
13
|
-
#
|
|
14
|
-
# This library is distributed in the hope that it will be useful,
|
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17
|
-
# Lesser General Public License for more details.
|
|
18
|
-
#
|
|
19
|
-
# You should have received a copy of the GNU Lesser General Public
|
|
20
|
-
# License along with this library; if not, write to the Free Software
|
|
21
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22
|
-
#++
|
|
23
|
-
#
|
|
24
|
-
# $Id: format0.rb,v 1.16 2005/11/01 05:32:23 ngoto Exp $
|
|
8
|
+
# $Id: format0.rb,v 1.17 2006/02/22 08:46:15 ngoto Exp $
|
|
25
9
|
#
|
|
26
10
|
# NCBI BLAST default (-m 0 option) output parser.
|
|
27
11
|
#
|
|
@@ -56,6 +40,9 @@ module Bio
|
|
|
56
40
|
# Delimiter of each entry. Bio::FlatFile uses it.
|
|
57
41
|
DELIMITER = RS = "\nBLAST"
|
|
58
42
|
|
|
43
|
+
# (Integer) excess read size included in DELIMITER.
|
|
44
|
+
DELIMITER_OVERRUN = 5 # "BLAST"
|
|
45
|
+
|
|
59
46
|
# Opens file by using Bio::FlatFile.open.
|
|
60
47
|
def self.open(filename, *mode)
|
|
61
48
|
Bio::FlatFile.open(self, filename, *mode)
|
|
@@ -1201,6 +1188,9 @@ module Bio
|
|
|
1201
1188
|
class Report_TBlast < Report
|
|
1202
1189
|
# Delimter of each entry for TBLAST. Bio::FlatFile uses it.
|
|
1203
1190
|
DELIMITER = RS = "\nTBLAST"
|
|
1191
|
+
|
|
1192
|
+
# (Integer) excess read size included in DELIMITER.
|
|
1193
|
+
DELIMITER_OVERRUN = 6 # "TBLAST"
|
|
1204
1194
|
end #class Report_TBlast
|
|
1205
1195
|
|
|
1206
1196
|
end #module Default
|
|
@@ -2,25 +2,9 @@
|
|
|
2
2
|
# = bio/appl/blast/wublast.rb - WU-BLAST default output parser
|
|
3
3
|
#
|
|
4
4
|
# Copyright:: Copyright (C) 2003 GOTO Naohisa <ng@bioruby.org>
|
|
5
|
-
# License::
|
|
5
|
+
# License:: Ruby's
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
# This library is free software; you can redistribute it and/or
|
|
9
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
10
|
-
# License as published by the Free Software Foundation; either
|
|
11
|
-
# version 2 of the License, or (at your option) any later version.
|
|
12
|
-
#
|
|
13
|
-
# This library is distributed in the hope that it will be useful,
|
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16
|
-
# Lesser General Public License for more details.
|
|
17
|
-
#
|
|
18
|
-
# You should have received a copy of the GNU Lesser General Public
|
|
19
|
-
# License along with this library; if not, write to the Free Software
|
|
20
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21
|
-
#++
|
|
22
|
-
#
|
|
23
|
-
# $Id: wublast.rb,v 1.5 2005/12/18 15:58:39 k Exp $
|
|
7
|
+
# $Id: wublast.rb,v 1.6 2006/02/22 08:46:15 ngoto Exp $
|
|
24
8
|
#
|
|
25
9
|
# WU-BLAST default output parser.
|
|
26
10
|
#
|
|
@@ -337,6 +321,9 @@ module Bio
|
|
|
337
321
|
class Report_TBlast < Report
|
|
338
322
|
# Delimter of each entry for TBLAST. Bio::FlatFile uses it.
|
|
339
323
|
DELIMITER = RS = "\nTBLAST"
|
|
324
|
+
|
|
325
|
+
# (Integer) excess read size included in DELIMITER.
|
|
326
|
+
DELIMITER_OVERRUN = 6 # "TBLAST"
|
|
340
327
|
end #class Report_TBlast
|
|
341
328
|
|
|
342
329
|
end #module WU
|