bio 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bioruby +107 -0
- data/bin/br_biofetch.rb +59 -0
- data/bin/br_bioflat.rb +294 -0
- data/bin/br_biogetseq.rb +57 -0
- data/bin/br_pmfetch.rb +431 -0
- data/doc/BioRuby.rd.ja +225 -0
- data/doc/Changes-0.7.rd +236 -0
- data/doc/Design.rd.ja +341 -0
- data/doc/KEGG_API.rd +1437 -0
- data/doc/KEGG_API.rd.ja +1399 -0
- data/doc/TODO.rd.ja +138 -0
- data/doc/Tutorial.rd +1138 -0
- data/doc/Tutorial.rd.ja +2110 -0
- data/etc/bioinformatics/seqdatabase.ini +210 -0
- data/lib/bio.rb +256 -0
- data/lib/bio/alignment.rb +1906 -0
- data/lib/bio/appl/bl2seq/report.rb +350 -0
- data/lib/bio/appl/blast.rb +269 -0
- data/lib/bio/appl/blast/format0.rb +1402 -0
- data/lib/bio/appl/blast/format8.rb +95 -0
- data/lib/bio/appl/blast/report.rb +652 -0
- data/lib/bio/appl/blast/rexml.rb +151 -0
- data/lib/bio/appl/blast/wublast.rb +553 -0
- data/lib/bio/appl/blast/xmlparser.rb +222 -0
- data/lib/bio/appl/blat/report.rb +392 -0
- data/lib/bio/appl/clustalw.rb +191 -0
- data/lib/bio/appl/clustalw/report.rb +154 -0
- data/lib/bio/appl/emboss.rb +68 -0
- data/lib/bio/appl/fasta.rb +262 -0
- data/lib/bio/appl/fasta/format10.rb +428 -0
- data/lib/bio/appl/fasta/format6.rb +37 -0
- data/lib/bio/appl/genscan/report.rb +570 -0
- data/lib/bio/appl/hmmer.rb +129 -0
- data/lib/bio/appl/hmmer/report.rb +556 -0
- data/lib/bio/appl/mafft.rb +222 -0
- data/lib/bio/appl/mafft/report.rb +119 -0
- data/lib/bio/appl/psort.rb +555 -0
- data/lib/bio/appl/psort/report.rb +473 -0
- data/lib/bio/appl/sim4.rb +134 -0
- data/lib/bio/appl/sim4/report.rb +501 -0
- data/lib/bio/appl/sosui/report.rb +166 -0
- data/lib/bio/appl/spidey/report.rb +604 -0
- data/lib/bio/appl/targetp/report.rb +283 -0
- data/lib/bio/appl/tmhmm/report.rb +238 -0
- data/lib/bio/command.rb +166 -0
- data/lib/bio/data/aa.rb +354 -0
- data/lib/bio/data/codontable.rb +740 -0
- data/lib/bio/data/na.rb +226 -0
- data/lib/bio/db.rb +340 -0
- data/lib/bio/db/aaindex.rb +280 -0
- data/lib/bio/db/embl/common.rb +332 -0
- data/lib/bio/db/embl/embl.rb +446 -0
- data/lib/bio/db/embl/sptr.rb +954 -0
- data/lib/bio/db/embl/swissprot.rb +32 -0
- data/lib/bio/db/embl/trembl.rb +31 -0
- data/lib/bio/db/embl/uniprot.rb +32 -0
- data/lib/bio/db/fantom.rb +604 -0
- data/lib/bio/db/fasta.rb +869 -0
- data/lib/bio/db/genbank/common.rb +299 -0
- data/lib/bio/db/genbank/ddbj.rb +34 -0
- data/lib/bio/db/genbank/genbank.rb +354 -0
- data/lib/bio/db/genbank/genpept.rb +73 -0
- data/lib/bio/db/genbank/refseq.rb +31 -0
- data/lib/bio/db/gff.rb +106 -0
- data/lib/bio/db/go.rb +497 -0
- data/lib/bio/db/kegg/brite.rb +51 -0
- data/lib/bio/db/kegg/cell.rb +88 -0
- data/lib/bio/db/kegg/compound.rb +130 -0
- data/lib/bio/db/kegg/enzyme.rb +125 -0
- data/lib/bio/db/kegg/expression.rb +173 -0
- data/lib/bio/db/kegg/genes.rb +293 -0
- data/lib/bio/db/kegg/genome.rb +362 -0
- data/lib/bio/db/kegg/glycan.rb +213 -0
- data/lib/bio/db/kegg/keggtab.rb +418 -0
- data/lib/bio/db/kegg/kgml.rb +299 -0
- data/lib/bio/db/kegg/ko.rb +178 -0
- data/lib/bio/db/kegg/reaction.rb +97 -0
- data/lib/bio/db/litdb.rb +131 -0
- data/lib/bio/db/medline.rb +317 -0
- data/lib/bio/db/nbrf.rb +199 -0
- data/lib/bio/db/pdb.rb +38 -0
- data/lib/bio/db/pdb/atom.rb +60 -0
- data/lib/bio/db/pdb/chain.rb +117 -0
- data/lib/bio/db/pdb/model.rb +106 -0
- data/lib/bio/db/pdb/pdb.rb +1682 -0
- data/lib/bio/db/pdb/residue.rb +122 -0
- data/lib/bio/db/pdb/utils.rb +234 -0
- data/lib/bio/db/prosite.rb +616 -0
- data/lib/bio/db/rebase.rb +417 -0
- data/lib/bio/db/transfac.rb +387 -0
- data/lib/bio/feature.rb +201 -0
- data/lib/bio/io/brdb.rb +103 -0
- data/lib/bio/io/das.rb +471 -0
- data/lib/bio/io/dbget.rb +212 -0
- data/lib/bio/io/ddbjxml.rb +614 -0
- data/lib/bio/io/fastacmd.rb +123 -0
- data/lib/bio/io/fetch.rb +114 -0
- data/lib/bio/io/flatfile.rb +496 -0
- data/lib/bio/io/flatfile/bdb.rb +266 -0
- data/lib/bio/io/flatfile/index.rb +1308 -0
- data/lib/bio/io/flatfile/indexer.rb +778 -0
- data/lib/bio/io/higet.rb +92 -0
- data/lib/bio/io/keggapi.rb +863 -0
- data/lib/bio/io/pubmed.rb +189 -0
- data/lib/bio/io/registry.rb +308 -0
- data/lib/bio/io/soapwsdl.rb +114 -0
- data/lib/bio/io/sql.rb +428 -0
- data/lib/bio/location.rb +650 -0
- data/lib/bio/pathway.rb +991 -0
- data/lib/bio/reference.rb +308 -0
- data/lib/bio/sequence.rb +593 -0
- data/lib/bio/shell.rb +51 -0
- data/lib/bio/shell/core.rb +512 -0
- data/lib/bio/shell/plugin/codon.rb +228 -0
- data/lib/bio/shell/plugin/entry.rb +85 -0
- data/lib/bio/shell/plugin/flatfile.rb +119 -0
- data/lib/bio/shell/plugin/keggapi.rb +187 -0
- data/lib/bio/shell/plugin/midi.rb +448 -0
- data/lib/bio/shell/plugin/obda.rb +63 -0
- data/lib/bio/shell/plugin/seq.rb +238 -0
- data/lib/bio/shell/session.rb +214 -0
- data/lib/bio/util/color_scheme.rb +214 -0
- data/lib/bio/util/color_scheme/buried.rb +78 -0
- data/lib/bio/util/color_scheme/helix.rb +78 -0
- data/lib/bio/util/color_scheme/hydropathy.rb +83 -0
- data/lib/bio/util/color_scheme/nucleotide.rb +50 -0
- data/lib/bio/util/color_scheme/strand.rb +78 -0
- data/lib/bio/util/color_scheme/taylor.rb +69 -0
- data/lib/bio/util/color_scheme/turn.rb +78 -0
- data/lib/bio/util/color_scheme/zappo.rb +69 -0
- data/lib/bio/util/contingency_table.rb +337 -0
- data/lib/bio/util/sirna.rb +306 -0
- data/lib/bioruby.rb +34 -0
- data/sample/biofetch.rb +475 -0
- data/sample/color_scheme_na.rb +99 -0
- data/sample/dbget +37 -0
- data/sample/fasta2tab.rb +99 -0
- data/sample/fsplit.rb +51 -0
- data/sample/gb2fasta.rb +31 -0
- data/sample/gb2tab.rb +325 -0
- data/sample/gbtab2mysql.rb +161 -0
- data/sample/genes2nuc.rb +33 -0
- data/sample/genes2pep.rb +33 -0
- data/sample/genes2tab.rb +81 -0
- data/sample/genome2rb.rb +29 -0
- data/sample/genome2tab.rb +76 -0
- data/sample/goslim.rb +311 -0
- data/sample/gt2fasta.rb +47 -0
- data/sample/pmfetch.rb +42 -0
- data/sample/pmsearch.rb +42 -0
- data/sample/psortplot_html.rb +222 -0
- data/sample/ssearch2tab.rb +96 -0
- data/sample/tdiary.rb +158 -0
- data/sample/tfastx2tab.rb +100 -0
- data/sample/vs-genes.rb +212 -0
- data/test/data/SOSUI/sample.report +11 -0
- data/test/data/TMHMM/sample.report +21 -0
- data/test/data/blast/eco:b0002.faa +15 -0
- data/test/data/blast/eco:b0002.faa.m0 +128 -0
- data/test/data/blast/eco:b0002.faa.m7 +65 -0
- data/test/data/blast/eco:b0002.faa.m8 +1 -0
- data/test/data/embl/AB090716.embl +65 -0
- data/test/data/genscan/sample.report +63 -0
- data/test/data/prosite/prosite.dat +2233 -0
- data/test/data/refseq/nm_126355.entret +64 -0
- data/test/data/uniprot/p53_human.uniprot +1456 -0
- data/test/runner.rb +10 -0
- data/test/unit/bio/appl/blast/test_report.rb +427 -0
- data/test/unit/bio/appl/blast/test_xmlparser.rb +400 -0
- data/test/unit/bio/appl/genscan/test_report.rb +195 -0
- data/test/unit/bio/appl/sosui/test_report.rb +94 -0
- data/test/unit/bio/appl/targetp/test_report.rb +159 -0
- data/test/unit/bio/appl/test_blast.rb +159 -0
- data/test/unit/bio/appl/test_fasta.rb +142 -0
- data/test/unit/bio/appl/tmhmm/test_report.rb +139 -0
- data/test/unit/bio/data/test_aa.rb +103 -0
- data/test/unit/bio/data/test_codontable.rb +120 -0
- data/test/unit/bio/data/test_na.rb +89 -0
- data/test/unit/bio/db/embl/test_common.rb +130 -0
- data/test/unit/bio/db/embl/test_embl.rb +227 -0
- data/test/unit/bio/db/embl/test_sptr.rb +268 -0
- data/test/unit/bio/db/embl/test_uniprot.rb +44 -0
- data/test/unit/bio/db/kegg/test_genes.rb +58 -0
- data/test/unit/bio/db/test_fasta.rb +263 -0
- data/test/unit/bio/db/test_gff.rb +140 -0
- data/test/unit/bio/db/test_prosite.rb +1450 -0
- data/test/unit/bio/io/test_ddbjxml.rb +87 -0
- data/test/unit/bio/io/test_soapwsdl.rb +45 -0
- data/test/unit/bio/shell/plugin/test_seq.rb +175 -0
- data/test/unit/bio/test_alignment.rb +1028 -0
- data/test/unit/bio/test_command.rb +71 -0
- data/test/unit/bio/test_db.rb +109 -0
- data/test/unit/bio/test_feature.rb +128 -0
- data/test/unit/bio/test_location.rb +51 -0
- data/test/unit/bio/test_pathway.rb +485 -0
- data/test/unit/bio/test_sequence.rb +386 -0
- data/test/unit/bio/test_shell.rb +31 -0
- data/test/unit/bio/util/test_color_scheme.rb +45 -0
- data/test/unit/bio/util/test_contingency_table.rb +106 -0
- data/test/unit/bio/util/test_sirna.rb +258 -0
- metadata +295 -0
data/lib/bio/io/higet.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#
|
2
|
+
# bio/io/higet.rb - SOAP interface for HGC HiGet
|
3
|
+
#
|
4
|
+
# Copyright (C) 2005 KATAYAMA Toshiaki <k@bioruby.org>
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License as published by the Free Software Foundation; either
|
9
|
+
# version 2 of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
# Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with this library; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
#
|
20
|
+
# $Id: higet.rb,v 1.2 2005/09/26 13:00:08 k Exp $
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'bio/io/soapwsdl'
|
24
|
+
|
25
|
+
module Bio
|
26
|
+
class HGC
|
27
|
+
|
28
|
+
class HiGet < Bio::SOAPWSDL
|
29
|
+
|
30
|
+
SERVER_URI = "http://higet.hgc.jp/soap/higet.wsdl"
|
31
|
+
|
32
|
+
def initialize(wsdl = nil)
|
33
|
+
super(wsdl || SERVER_URI)
|
34
|
+
end
|
35
|
+
|
36
|
+
def higet_in_fasta(db, entries)
|
37
|
+
self.higet(db, entries, "-d fasta")
|
38
|
+
end
|
39
|
+
|
40
|
+
def higet_in_xml(db, entries)
|
41
|
+
self.higet(db, entries, "-d xml")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end # HGC
|
47
|
+
end # Bio
|
48
|
+
|
49
|
+
|
50
|
+
if __FILE__ == $0
|
51
|
+
|
52
|
+
begin
|
53
|
+
require 'pp'
|
54
|
+
alias p pp
|
55
|
+
rescue LoadError
|
56
|
+
end
|
57
|
+
|
58
|
+
puts ">>> Bio::HGC::HiGet"
|
59
|
+
serv = Bio::HGC::HiGet.new
|
60
|
+
serv.log = STDERR
|
61
|
+
|
62
|
+
puts "### HiFind"
|
63
|
+
puts serv.hifind("genbank", "human kinase", "-l 10")
|
64
|
+
|
65
|
+
puts "### HiGet"
|
66
|
+
puts serv.higet("genbank", "S40289", "")
|
67
|
+
|
68
|
+
puts "### HiGet (FASTA)"
|
69
|
+
puts serv.higet("genbank", "S40289", "-d fasta")
|
70
|
+
|
71
|
+
puts "### HiGet higet_in_fasta"
|
72
|
+
puts serv.higet_in_fasta("genbank", "S40289")
|
73
|
+
|
74
|
+
puts "### HiGet higet_in_xml"
|
75
|
+
puts serv.higet_in_xml("genbank", "S40289")
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
=begin
|
81
|
+
|
82
|
+
= Bio::HGC::HiGet
|
83
|
+
|
84
|
+
* ((<URL:http://higet.hgc.jp/>))
|
85
|
+
|
86
|
+
== HiGet#hifind
|
87
|
+
== HiGet#higet
|
88
|
+
== HiGet#higet_in_fasta
|
89
|
+
== HiGet#higet_in_xml
|
90
|
+
|
91
|
+
=end
|
92
|
+
|
@@ -0,0 +1,863 @@
|
|
1
|
+
#
|
2
|
+
# bio/io/keggapi.rb - KEGG API access class
|
3
|
+
#
|
4
|
+
# Copyright (C) 2003, 2004 KATAYAMA Toshiaki <k@bioruby.org>
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License as published by the Free Software Foundation; either
|
9
|
+
# version 2 of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
# Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with this library; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
#
|
20
|
+
# $Id: keggapi.rb,v 1.11 2005/12/18 19:10:55 k Exp $
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'bio/io/soapwsdl'
|
24
|
+
require 'uri'
|
25
|
+
require 'net/http'
|
26
|
+
|
27
|
+
module Bio
|
28
|
+
class KEGG
|
29
|
+
|
30
|
+
class API < Bio::SOAPWSDL
|
31
|
+
|
32
|
+
SERVER_URI = "http://soap.genome.jp/KEGG.wsdl"
|
33
|
+
|
34
|
+
def initialize(wsdl = nil)
|
35
|
+
@wsdl = wsdl || SERVER_URI
|
36
|
+
@log = nil
|
37
|
+
@start = 1
|
38
|
+
@max_results = 100
|
39
|
+
create_driver
|
40
|
+
end
|
41
|
+
attr_accessor :start, :max_results
|
42
|
+
|
43
|
+
def method_missing(*arg)
|
44
|
+
begin
|
45
|
+
results = @driver.send(*arg)
|
46
|
+
rescue Timeout::Error
|
47
|
+
retry
|
48
|
+
end
|
49
|
+
results = add_filter(results)
|
50
|
+
return results
|
51
|
+
end
|
52
|
+
|
53
|
+
# def get_all_neighbors_by_gene(genes_id, org)
|
54
|
+
# get_all(:get_neighbors_by_gene, genes_id, org)
|
55
|
+
# end
|
56
|
+
|
57
|
+
def get_all_best_best_neighbors_by_gene(genes_id)
|
58
|
+
get_all(:get_best_best_neighbors_by_gene, genes_id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_all_best_neighbors_by_gene(genes_id)
|
62
|
+
get_all(:get_best_neighbors_by_gene, genes_id)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_all_reverse_best_neighbors_by_gene(genes_id)
|
66
|
+
get_all(:get_reverse_best_neighbors_by_gene, genes_id)
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_all_paralogs_by_gene(genes_id)
|
70
|
+
get_all(:get_paralogs_by_gene, genes_id)
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_all_genes_by_motifs(motif_id_list)
|
74
|
+
get_all(:get_genes_by_motifs, motif_id_list)
|
75
|
+
end
|
76
|
+
|
77
|
+
def get_all_oc_members_by_gene(genes_id)
|
78
|
+
get_all(:get_oc_members_by_gene, genes_id)
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_all_pc_members_by_gene(genes_id)
|
82
|
+
get_all(:get_pc_members_by_gene, genes_id)
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_all_genes_by_organism(org)
|
86
|
+
get_all(:get_genes_by_organism, org)
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_all_linkdb_by_entry(entry_id, db)
|
90
|
+
get_all(:get_linkdb_by_entry, entry_id, db)
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
def save_image(url, filename = nil)
|
95
|
+
schema, user, host, port, reg, path, = URI.split(url)
|
96
|
+
filename ||= File.basename(path)
|
97
|
+
|
98
|
+
http = Net::HTTP.new(host, port)
|
99
|
+
response, = http.get(path)
|
100
|
+
File.open(filename, "w+") do |f|
|
101
|
+
f.print response.body
|
102
|
+
end
|
103
|
+
return filename
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
def get_entries(ary = [])
|
108
|
+
result = ''
|
109
|
+
step = [@max_results, 50].min
|
110
|
+
0.step(ary.length, step) do |i|
|
111
|
+
str = ary[i, step].join(" ")
|
112
|
+
if entry = @driver.send(:bget, str)
|
113
|
+
result << entry.to_s
|
114
|
+
end
|
115
|
+
end
|
116
|
+
return result
|
117
|
+
end
|
118
|
+
|
119
|
+
def get_aaseqs(ary = [])
|
120
|
+
result = ''
|
121
|
+
step = [@max_results, 50].min
|
122
|
+
0.step(ary.length, step) do |i|
|
123
|
+
str = "-f -n a " + ary[i, step].join(" ")
|
124
|
+
if entry = @driver.send(:bget, str)
|
125
|
+
result << entry.to_s
|
126
|
+
end
|
127
|
+
end
|
128
|
+
return result
|
129
|
+
end
|
130
|
+
|
131
|
+
def get_naseqs(ary = [])
|
132
|
+
result = ''
|
133
|
+
step = [@max_results, 50].min
|
134
|
+
0.step(ary.length, step) do |i|
|
135
|
+
str = "-f -n n " + ary[i, step].join(" ")
|
136
|
+
if entry = @driver.send(:bget, str)
|
137
|
+
result << entry.to_s
|
138
|
+
end
|
139
|
+
end
|
140
|
+
return result
|
141
|
+
end
|
142
|
+
|
143
|
+
def get_definitions(ary = [])
|
144
|
+
result = ''
|
145
|
+
step = [@max_results, 50].min
|
146
|
+
0.step(ary.length, step) do |i|
|
147
|
+
str = ary[i, step].join(" ")
|
148
|
+
if entry = @driver.send(:btit, str)
|
149
|
+
result << entry.to_s
|
150
|
+
end
|
151
|
+
end
|
152
|
+
return result
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
private
|
157
|
+
|
158
|
+
def add_filter(results)
|
159
|
+
if results.is_a?(Array)
|
160
|
+
results.each do |result|
|
161
|
+
def result.filter(fields)
|
162
|
+
fields.collect { |field| self.send(field) }
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
return results
|
167
|
+
end
|
168
|
+
|
169
|
+
def get_all(method, *args)
|
170
|
+
args << @start
|
171
|
+
args << @max_results
|
172
|
+
|
173
|
+
ary = []
|
174
|
+
loop do
|
175
|
+
results = @driver.send(method, *args)
|
176
|
+
break unless results
|
177
|
+
break if results.empty?
|
178
|
+
results = add_filter(results)
|
179
|
+
ary << results
|
180
|
+
args[-2] += @max_results # next start count
|
181
|
+
end
|
182
|
+
return ary.flatten
|
183
|
+
end
|
184
|
+
|
185
|
+
end # API
|
186
|
+
|
187
|
+
end # KEGG
|
188
|
+
end # Bio
|
189
|
+
|
190
|
+
|
191
|
+
if __FILE__ == $0
|
192
|
+
|
193
|
+
begin
|
194
|
+
require 'pp'
|
195
|
+
alias p pp
|
196
|
+
rescue LoadError
|
197
|
+
end
|
198
|
+
|
199
|
+
puts ">>> KEGG API"
|
200
|
+
serv = Bio::KEGG::API.new
|
201
|
+
# serv.log = STDERR
|
202
|
+
|
203
|
+
puts "--- parameters"
|
204
|
+
puts " wsdl : #{serv.wsdl}"
|
205
|
+
puts " log : #{serv.log}"
|
206
|
+
puts " start : #{serv.start}"
|
207
|
+
puts " max_results : #{serv.max_results}"
|
208
|
+
|
209
|
+
puts "=== META"
|
210
|
+
|
211
|
+
puts "### list_databases"
|
212
|
+
list = serv.list_databases
|
213
|
+
list.each do |db|
|
214
|
+
print db.entry_id, "\t", db.definition, "\n"
|
215
|
+
end
|
216
|
+
|
217
|
+
puts "### list_organisms"
|
218
|
+
list = serv.list_organisms
|
219
|
+
list.each do |org|
|
220
|
+
print org.entry_id, "\t", org.definition, "\n"
|
221
|
+
end
|
222
|
+
|
223
|
+
puts "### list_pathways('map') : reference pathway"
|
224
|
+
list = serv.list_pathways("map")
|
225
|
+
list.each do |path|
|
226
|
+
print path.entry_id, "\t", path.definition, "\n"
|
227
|
+
end
|
228
|
+
|
229
|
+
puts "### list_pathways('eco') : E. coli pathway"
|
230
|
+
list = serv.list_pathways("eco")
|
231
|
+
list.each do |path|
|
232
|
+
print path.entry_id, "\t", path.definition, "\n"
|
233
|
+
end
|
234
|
+
|
235
|
+
puts "=== DBGET"
|
236
|
+
|
237
|
+
puts "### binfo('all')"
|
238
|
+
puts serv.binfo("all")
|
239
|
+
|
240
|
+
puts "### binfo('genbank')"
|
241
|
+
puts serv.binfo("genbank")
|
242
|
+
|
243
|
+
puts "### bfind('genbank kinase cell cycle human')"
|
244
|
+
puts serv.bfind("genbank kinase cell cycle human")
|
245
|
+
|
246
|
+
puts "### bget('gb:AJ617376')"
|
247
|
+
puts serv.bget("gb:AJ617376")
|
248
|
+
|
249
|
+
puts "### bget('eco:b0002 eco:b0003')"
|
250
|
+
puts serv.bget("eco:b0002 eco:b0003")
|
251
|
+
|
252
|
+
puts "### btit('eco:b0002 eco:b0003')"
|
253
|
+
puts serv.btit("eco:b0002 eco:b0003")
|
254
|
+
|
255
|
+
puts "--- get_entries(['eco:b0002', 'eco:b0003'])"
|
256
|
+
puts serv.get_entries(["eco:b0002", "eco:b0003"])
|
257
|
+
|
258
|
+
puts "--- get_aaseqs(['eco:b0002', 'eco:b0003'])"
|
259
|
+
puts serv.get_aaseqs(["eco:b0002", "eco:b0003"])
|
260
|
+
|
261
|
+
puts "--- get_naseqs(['eco:b0002', 'eco:b0003'])"
|
262
|
+
puts serv.get_naseqs(["eco:b0002", "eco:b0003"])
|
263
|
+
|
264
|
+
puts "--- get_definitions(['eco:b0002', 'eco:b0003'])"
|
265
|
+
puts serv.get_definitions(["eco:b0002", "eco:b0003"])
|
266
|
+
|
267
|
+
puts "--- get_definitions(('eco:b0001'..'eco:b0200').to_a)"
|
268
|
+
puts serv.get_definitions(("eco:b0001".."eco:b0200").to_a)
|
269
|
+
|
270
|
+
puts "=== LinkDB"
|
271
|
+
|
272
|
+
puts "### get_linkdb_by_entry('eco:b0002', 'pathway', 1, 5)"
|
273
|
+
list = serv.get_linkdb_by_entry("eco:b0002", "pathway", 1, 5)
|
274
|
+
list.each do |link|
|
275
|
+
puts [ link.entry_id1, link.entry_id2, link.type, link.path ].join("\t")
|
276
|
+
end
|
277
|
+
|
278
|
+
puts "--- get_all_linkdb_by_entry('eco:b0002', 'pathway')"
|
279
|
+
list = serv.get_all_linkdb_by_entry("eco:b0002", "pathway")
|
280
|
+
list.each do |link|
|
281
|
+
puts [ link.entry_id1, link.entry_id2, link.type, link.path ].join("\t")
|
282
|
+
end
|
283
|
+
|
284
|
+
puts "=== SSDB"
|
285
|
+
|
286
|
+
puts "### get_neighbors_by_gene('eco:b0002', 'all', 1, 5)"
|
287
|
+
list = serv.get_neighbors_by_gene("eco:b0002", "all", 1, 5)
|
288
|
+
list.each do |hit|
|
289
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
290
|
+
end
|
291
|
+
|
292
|
+
puts "--- get_all_neighbors_by_gene('eco:b0002', 'bsu')"
|
293
|
+
list = serv.get_all_neighbors_by_gene("eco:b0002", "bsu")
|
294
|
+
list.each do |hit|
|
295
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
296
|
+
end
|
297
|
+
|
298
|
+
puts "### get_best_best_neighbors_by_gene('eco:b0002', 1, 5)"
|
299
|
+
list = serv.get_best_best_neighbors_by_gene("eco:b0002", 1, 5)
|
300
|
+
list.each do |hit|
|
301
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
302
|
+
end
|
303
|
+
|
304
|
+
puts "--- get_all_best_best_neighbors_by_gene('eco:b0002')"
|
305
|
+
list = serv.get_all_best_best_neighbors_by_gene("eco:b0002")
|
306
|
+
list.each do |hit|
|
307
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
308
|
+
end
|
309
|
+
|
310
|
+
puts "### get_best_neighbors_by_gene('eco:b0002', 1, 5)"
|
311
|
+
list = serv.get_best_neighbors_by_gene("eco:b0002", 1, 5)
|
312
|
+
list.each do |hit|
|
313
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
314
|
+
end
|
315
|
+
|
316
|
+
puts "--- get_all_best_neighbors_by_gene('eco:b0002')"
|
317
|
+
list = serv.get_all_best_neighbors_by_gene("eco:b0002")
|
318
|
+
list.each do |hit|
|
319
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
320
|
+
end
|
321
|
+
|
322
|
+
puts "### get_reverse_best_neighbors_by_gene('eco:b0002', 1, 5)"
|
323
|
+
list = serv.get_reverse_best_neighbors_by_gene("eco:b0002", 1, 5)
|
324
|
+
list.each do |hit|
|
325
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
326
|
+
end
|
327
|
+
|
328
|
+
puts "--- get_all_reverse_best_neighbors_by_gene('eco:b0002')"
|
329
|
+
list = serv.get_all_reverse_best_neighbors_by_gene("eco:b0002")
|
330
|
+
list.each do |hit|
|
331
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
332
|
+
end
|
333
|
+
|
334
|
+
puts "### get_paralogs_by_gene('eco:b0002', 1, 5)"
|
335
|
+
list = serv.get_paralogs_by_gene("eco:b0002", 1, 5)
|
336
|
+
list.each do |hit|
|
337
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
338
|
+
end
|
339
|
+
|
340
|
+
puts "--- get_all_paralogs_by_gene('eco:b0002')"
|
341
|
+
list = serv.get_all_paralogs_by_gene("eco:b0002")
|
342
|
+
list.each do |hit|
|
343
|
+
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
344
|
+
end
|
345
|
+
|
346
|
+
puts "### get_similarity_between_genes('eco:b0002', 'bsu:BG10350')"
|
347
|
+
relation = serv.get_similarity_between_genes("eco:b0002", "bsu:BG10350")
|
348
|
+
puts " genes_id1 : #{relation.genes_id1}" # string
|
349
|
+
puts " genes_id2 : #{relation.genes_id2}" # string
|
350
|
+
puts " sw_score : #{relation.sw_score}" # int
|
351
|
+
puts " bit_score : #{relation.bit_score}" # float
|
352
|
+
puts " identity : #{relation.identity}" # float
|
353
|
+
puts " overlap : #{relation.overlap}" # int
|
354
|
+
puts " start_position1 : #{relation.start_position1}" # int
|
355
|
+
puts " end_position1 : #{relation.end_position1}" # int
|
356
|
+
puts " start_position2 : #{relation.start_position2}" # int
|
357
|
+
puts " end_position2 : #{relation.end_position2}" # int
|
358
|
+
puts " best_flag_1to2 : #{relation.best_flag_1to2}" # boolean
|
359
|
+
puts " best_flag_2to1 : #{relation.best_flag_2to1}" # boolean
|
360
|
+
puts " definition1 : #{relation.definition1}" # string
|
361
|
+
puts " definition2 : #{relation.definition2}" # string
|
362
|
+
puts " length1 : #{relation.length1}" # int
|
363
|
+
puts " length2 : #{relation.length2}" # int
|
364
|
+
|
365
|
+
puts "=== MOTIF"
|
366
|
+
|
367
|
+
puts "### get_motifs_by_gene('eco:b0002', 'pfam')"
|
368
|
+
list = serv.get_motifs_by_gene("eco:b0002", "pfam")
|
369
|
+
list.each do |motif|
|
370
|
+
puts motif.motif_id
|
371
|
+
end if list
|
372
|
+
|
373
|
+
puts "### get_motifs_by_gene('eco:b0002', 'tfam')"
|
374
|
+
list = serv.get_motifs_by_gene("eco:b0002", "tfam")
|
375
|
+
list.each do |motif|
|
376
|
+
puts motif.motif_id
|
377
|
+
end if list
|
378
|
+
|
379
|
+
puts "### get_motifs_by_gene('eco:b0002', 'pspt')"
|
380
|
+
list = serv.get_motifs_by_gene("eco:b0002", "pspt")
|
381
|
+
list.each do |motif|
|
382
|
+
puts motif.motif_id
|
383
|
+
end if list
|
384
|
+
|
385
|
+
puts "### get_motifs_by_gene('eco:b0002', 'pspf')"
|
386
|
+
list = serv.get_motifs_by_gene("eco:b0002", "pspf")
|
387
|
+
list.each do |motif|
|
388
|
+
puts motif.motif_id
|
389
|
+
end if list
|
390
|
+
|
391
|
+
puts "### get_motifs_by_gene('eco:b0002', 'all')"
|
392
|
+
list = serv.get_motifs_by_gene("eco:b0002", "all")
|
393
|
+
list.each do |motif|
|
394
|
+
puts "--- motif result"
|
395
|
+
puts " motif_id : #{motif.motif_id}"
|
396
|
+
puts " definition : #{motif.definition}"
|
397
|
+
puts " genes_id : #{motif.genes_id}"
|
398
|
+
puts " start_position : #{motif.start_position}"
|
399
|
+
puts " end_position : #{motif.end_position}"
|
400
|
+
puts " score : #{motif.score}"
|
401
|
+
puts " evalue : #{motif.evalue}"
|
402
|
+
end
|
403
|
+
|
404
|
+
puts "### get_genes_by_motifs(['pf:ACT', 'ps:ASPARTOKINASE'], 1, 5)"
|
405
|
+
list = serv.get_genes_by_motifs(["pf:ACT", "ps:ASPARTOKINASE"], 1, 5)
|
406
|
+
list.each do |gene|
|
407
|
+
puts [ gene.entry_id, gene.definition ].join("\t")
|
408
|
+
end
|
409
|
+
|
410
|
+
puts "--- get_all_genes_by_motifs(['pf:ACT', 'ps:ASPARTOKINASE'])"
|
411
|
+
list = serv.get_all_genes_by_motifs(["pf:ACT", "ps:ASPARTOKINASE"])
|
412
|
+
list.each do |gene|
|
413
|
+
puts [ gene.entry_id, gene.definition ].join("\t")
|
414
|
+
end
|
415
|
+
|
416
|
+
puts "=== KO, OC, PC"
|
417
|
+
|
418
|
+
puts "### get_ko_by_gene('eco:b0002')"
|
419
|
+
list = serv.get_ko_by_gene("eco:b0002")
|
420
|
+
list.each do |ko|
|
421
|
+
puts ko
|
422
|
+
end
|
423
|
+
|
424
|
+
puts "### get_ko_members('ko:K00003')"
|
425
|
+
list = serv.get_ko_members("ko:K00003")
|
426
|
+
list.each do |gene|
|
427
|
+
puts gene
|
428
|
+
end
|
429
|
+
|
430
|
+
puts "### get_oc_members_by_gene('eco:b0002', 1, 5)"
|
431
|
+
list = serv.get_oc_members_by_gene("eco:b0002", 1, 5)
|
432
|
+
list.each do |gene|
|
433
|
+
puts gene
|
434
|
+
end
|
435
|
+
|
436
|
+
puts "--- get_all_oc_members_by_gene('eco:b0002')"
|
437
|
+
list = serv.get_all_oc_members_by_gene("eco:b0002")
|
438
|
+
list.each do |gene|
|
439
|
+
puts gene
|
440
|
+
end
|
441
|
+
|
442
|
+
puts "### get_pc_members_by_gene('eco:b0002', 1, 5)"
|
443
|
+
list = serv.get_pc_members_by_gene("eco:b0002", 1, 5)
|
444
|
+
list.each do |gene|
|
445
|
+
puts gene
|
446
|
+
end
|
447
|
+
|
448
|
+
puts "--- get_all_pc_members_by_gene('eco:b0002')"
|
449
|
+
list = serv.get_all_pc_members_by_gene("eco:b0002")
|
450
|
+
list.each do |gene|
|
451
|
+
puts gene
|
452
|
+
end
|
453
|
+
|
454
|
+
puts "=== PATHWAY"
|
455
|
+
|
456
|
+
puts "==== coloring pathway"
|
457
|
+
|
458
|
+
puts "### mark_pathway_by_objects('path:eco00260', obj_list)"
|
459
|
+
puts " obj_list = ['eco:b0002', 'cpd:C00263']"
|
460
|
+
obj_list = ["eco:b0002", "cpd:C00263"]
|
461
|
+
url = serv.mark_pathway_by_objects("path:eco00260", obj_list)
|
462
|
+
puts url
|
463
|
+
|
464
|
+
puts "### color_pathway_by_objects('path:eco00053', obj_list, fg_list, bg_list)"
|
465
|
+
puts " obj_list = ['eco:b0207', 'eco:b1300']"
|
466
|
+
puts " fg_list = ['blue', '#00ff00']"
|
467
|
+
puts " bg_list = ['#ff0000', 'yellow']"
|
468
|
+
obj_list = ["eco:b0207", "eco:b1300"]
|
469
|
+
fg_list = ["blue", "#00ff00"]
|
470
|
+
bg_list = ["#ff0000", "yellow"]
|
471
|
+
url = serv.color_pathway_by_objects("path:eco00053", obj_list, fg_list, bg_list)
|
472
|
+
puts url
|
473
|
+
|
474
|
+
#puts "--- save_image(#{url})"
|
475
|
+
#filename = serv.save_image(url, "test.gif")
|
476
|
+
#filename = serv.save_image(url)
|
477
|
+
#puts filename
|
478
|
+
|
479
|
+
puts "==== objects on pathway"
|
480
|
+
|
481
|
+
puts "### get_genes_by_pathway('path:map00010')"
|
482
|
+
list = serv.get_genes_by_pathway("path:map00010")
|
483
|
+
list.each do |gene|
|
484
|
+
puts gene
|
485
|
+
end
|
486
|
+
|
487
|
+
puts "### get_genes_by_pathway('path:eco00010')"
|
488
|
+
list = serv.get_genes_by_pathway("path:eco00010")
|
489
|
+
list.each do |gene|
|
490
|
+
puts gene
|
491
|
+
end
|
492
|
+
|
493
|
+
puts "### get_enzymes_by_pathway('path:map00010')"
|
494
|
+
list = serv.get_enzymes_by_pathway("path:map00010")
|
495
|
+
list.each do |enzyme|
|
496
|
+
puts enzyme
|
497
|
+
end
|
498
|
+
|
499
|
+
puts "### get_enzymes_by_pathway('path:eco00010')"
|
500
|
+
list = serv.get_enzymes_by_pathway("path:eco00010")
|
501
|
+
list.each do |enzyme|
|
502
|
+
puts enzyme
|
503
|
+
end
|
504
|
+
|
505
|
+
puts "### get_compounds_by_pathway('path:map00010')"
|
506
|
+
list = serv.get_compounds_by_pathway("path:map00010")
|
507
|
+
list.each do |compound|
|
508
|
+
puts compound
|
509
|
+
end
|
510
|
+
|
511
|
+
puts "### get_compounds_by_pathway('path:eco00010')"
|
512
|
+
list = serv.get_compounds_by_pathway("path:eco00010")
|
513
|
+
list.each do |compound|
|
514
|
+
puts compound
|
515
|
+
end
|
516
|
+
|
517
|
+
puts "### get_reactions_by_pathway('path:map00010')"
|
518
|
+
list = serv.get_reactions_by_pathway("path:map00010")
|
519
|
+
list.each do |reaction|
|
520
|
+
puts reaction
|
521
|
+
end
|
522
|
+
|
523
|
+
puts "### get_reactions_by_pathway('path:eco00010')"
|
524
|
+
list = serv.get_reactions_by_pathway("path:eco00010")
|
525
|
+
list.each do |reaction|
|
526
|
+
puts reaction
|
527
|
+
end
|
528
|
+
|
529
|
+
puts "==== pathway by objects"
|
530
|
+
|
531
|
+
puts "### get_pathways_by_genes(['eco:b0756', 'eco:b1002'])"
|
532
|
+
list = serv.get_pathways_by_genes(["eco:b0756", "eco:b1002"])
|
533
|
+
list.each do |path|
|
534
|
+
puts path
|
535
|
+
end
|
536
|
+
|
537
|
+
puts "### get_pathways_by_enzymes(['ec:5.1.3.3', 'ec:3.1.3.10'])"
|
538
|
+
list = serv.get_pathways_by_enzymes(["ec:5.1.3.3", "ec:3.1.3.10"])
|
539
|
+
list.each do |path|
|
540
|
+
puts path
|
541
|
+
end
|
542
|
+
|
543
|
+
puts "### get_pathways_by_compounds(['cpd:C00221', 'cpd:C00267'])"
|
544
|
+
list = serv.get_pathways_by_compounds(["cpd:C00221", "cpd:C00267"])
|
545
|
+
list.each do |path|
|
546
|
+
puts path
|
547
|
+
end
|
548
|
+
|
549
|
+
puts "### get_pathways_by_reactions(['rn:R00014', 'rn:R00710'])"
|
550
|
+
list = serv.get_pathways_by_reactions(["rn:R00014", "rn:R00710"])
|
551
|
+
list.each do |path|
|
552
|
+
puts path
|
553
|
+
end
|
554
|
+
|
555
|
+
puts "==== relation between objects"
|
556
|
+
|
557
|
+
puts "### get_linked_pathways('path:eco00620')"
|
558
|
+
list = serv.get_linked_pathways('path:eco00620')
|
559
|
+
list.each do |path|
|
560
|
+
puts path
|
561
|
+
end
|
562
|
+
|
563
|
+
puts "### get_genes_by_enzyme('ec:1.1.1.1', 'eco')"
|
564
|
+
list = serv.get_genes_by_enzyme("ec:1.1.1.1", "eco")
|
565
|
+
list.each do |gene|
|
566
|
+
puts gene
|
567
|
+
end
|
568
|
+
|
569
|
+
puts "### get_enzymes_by_gene('eco:b0002')"
|
570
|
+
list = serv.get_enzymes_by_gene("eco:b0002")
|
571
|
+
list.each do |enzyme|
|
572
|
+
puts enzyme
|
573
|
+
end
|
574
|
+
|
575
|
+
puts "### get_enzymes_by_compound('cpd:C00345')"
|
576
|
+
list = serv.get_enzymes_by_compound("cpd:C00345")
|
577
|
+
list.each do |enzyme|
|
578
|
+
puts enzyme
|
579
|
+
end
|
580
|
+
|
581
|
+
puts "### get_enzymes_by_reaction('rn:R00100')"
|
582
|
+
list = serv.get_enzymes_by_reaction("rn:R00100")
|
583
|
+
list.each do |enzyme|
|
584
|
+
puts enzyme
|
585
|
+
end
|
586
|
+
|
587
|
+
puts "### get_compounds_by_enzyme('ec:2.7.1.12')"
|
588
|
+
list = serv.get_compounds_by_enzyme("ec:2.7.1.12")
|
589
|
+
list.each do |compound|
|
590
|
+
puts compound
|
591
|
+
end
|
592
|
+
|
593
|
+
puts "### get_compounds_by_reaction('rn:R00100')"
|
594
|
+
list = serv.get_compounds_by_reaction("rn:R00100")
|
595
|
+
list.each do |compound|
|
596
|
+
puts compound
|
597
|
+
end
|
598
|
+
|
599
|
+
puts "### get_reactions_by_enzyme('ec:2.7.1.12')"
|
600
|
+
list = serv.get_reactions_by_enzyme("ec:2.7.1.12")
|
601
|
+
list.each do |reaction|
|
602
|
+
puts reaction
|
603
|
+
end
|
604
|
+
|
605
|
+
puts "### get_reactions_by_compound('cpd:C00199')"
|
606
|
+
list = serv.get_reactions_by_compound("cpd:C00199")
|
607
|
+
list.each do |reaction|
|
608
|
+
puts reaction
|
609
|
+
end
|
610
|
+
|
611
|
+
puts "=== GENES"
|
612
|
+
|
613
|
+
puts "### get_genes_by_organism('mge', 1, 5)"
|
614
|
+
list = serv.get_genes_by_organism("mge", 1, 5)
|
615
|
+
list.each do |gene|
|
616
|
+
puts gene
|
617
|
+
end
|
618
|
+
|
619
|
+
puts "--- get_all_genes_by_organism('mge')"
|
620
|
+
list = serv.get_all_genes_by_organism("mge")
|
621
|
+
list.each do |gene|
|
622
|
+
puts gene
|
623
|
+
end
|
624
|
+
|
625
|
+
puts "=== GENOME"
|
626
|
+
|
627
|
+
puts "### get_number_of_genes_by_organism(org)"
|
628
|
+
puts serv.get_number_of_genes_by_organism("mge")
|
629
|
+
|
630
|
+
end
|
631
|
+
|
632
|
+
|
633
|
+
=begin
|
634
|
+
|
635
|
+
= Bio::KEGG::API
|
636
|
+
|
637
|
+
KEGG API is a web service to use KEGG system via SOAP/WSDL. For more
|
638
|
+
informations on KEGG API, see the following site and its reference manual.
|
639
|
+
|
640
|
+
* ((<URL:http://www.genome.jp/kegg/soap/>))
|
641
|
+
|
642
|
+
--- Bio::KEGG::API.new(wsdl = nil)
|
643
|
+
|
644
|
+
Connect to the KEGG API's SOAP server. A WSDL file will be automatically
|
645
|
+
downloaded and parsed to generate the SOAP client driver. The default URL
|
646
|
+
for the WSDL is http://soap.genome.jp/KEGG.wsdl but it can be changed by
|
647
|
+
the argument or by wsdl= method.
|
648
|
+
|
649
|
+
--- Bio::KEGG::API#wsdl
|
650
|
+
|
651
|
+
Returns URL of the current WSDL file.
|
652
|
+
|
653
|
+
--- Bio::KEGG::API#wsdl=(url)
|
654
|
+
|
655
|
+
Change the URL for WSDL file of the KEGG API if needed for some reason:
|
656
|
+
|
657
|
+
serv = Bio::KEGG::API.new("http://133.103.100.186/KEGG.wsdl")
|
658
|
+
|
659
|
+
or
|
660
|
+
|
661
|
+
serv = Bio::KEGG::API.new
|
662
|
+
serv.wsdl = "http://133.103.100.186/KEGG.wsdl"
|
663
|
+
|
664
|
+
note that both can't read two or more different WSDL files.
|
665
|
+
|
666
|
+
--- Bio::KEGG::API#log
|
667
|
+
|
668
|
+
Returns current logging IO.
|
669
|
+
|
670
|
+
--- Bio::KEGG::API#log=(io)
|
671
|
+
|
672
|
+
Change the IO for logging. The argument is passed to wiredump_dev method
|
673
|
+
of the SOAP4R, thus
|
674
|
+
|
675
|
+
serv = Bio::KEGG::API.new
|
676
|
+
serv.log = STDERR
|
677
|
+
|
678
|
+
will print all the SOAP transactions in standard error.
|
679
|
+
This feature is especially useful for debug.
|
680
|
+
|
681
|
+
--- Bio::KEGG::API#start
|
682
|
+
|
683
|
+
Returns current value for the 'start' count for the methods having
|
684
|
+
start/max_results argument pairs.
|
685
|
+
|
686
|
+
--- Bio::KEGG::API#start=(number)
|
687
|
+
|
688
|
+
Changes the default value for the 'start' count.
|
689
|
+
|
690
|
+
--- Bio::KEGG::API#max_results
|
691
|
+
|
692
|
+
Returns current value for the 'max_results' number for the methods having
|
693
|
+
start/max_results argument pairs.
|
694
|
+
|
695
|
+
--- Bio::KEGG::API#max_results=(number)
|
696
|
+
|
697
|
+
Changes the default value for the 'max_results' count.
|
698
|
+
If your request timeouts, try smaller value for the max_results.
|
699
|
+
|
700
|
+
=== KEGG API methods implemented only in BioRuby
|
701
|
+
|
702
|
+
In BioRuby, returned values are added filter method to pick up
|
703
|
+
values in a complex data type as an array.
|
704
|
+
|
705
|
+
#!/usr/bin/env ruby
|
706
|
+
|
707
|
+
require 'bio'
|
708
|
+
|
709
|
+
serv = Bio::KEGG::API.new
|
710
|
+
results = serv.get_best_neighbors_by_gene("eco:b0002", "bsu")
|
711
|
+
|
712
|
+
# case 0 : without filter
|
713
|
+
results.each do |hit|
|
714
|
+
print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n"
|
715
|
+
end
|
716
|
+
|
717
|
+
# case 1 : select gene names and SW score only
|
718
|
+
fields = [:genes_id1, :genes_id2, :sw_score]
|
719
|
+
results.each do |hit|
|
720
|
+
puts hit.filter(fields).join("\t")
|
721
|
+
end
|
722
|
+
|
723
|
+
# case 2 : also uses aligned position in each amino acid sequence etc.
|
724
|
+
fields1 = [:genes_id1, :start_position1, :end_position1, :best_flag_1to2]
|
725
|
+
fields2 = [:genes_id2, :start_position2, :end_position2, :best_flag_2to1]
|
726
|
+
results.each do |hit|
|
727
|
+
print "> score: ", hit.sw_score, ", identity: ", hit.identity, "\n"
|
728
|
+
print "1:\t", hit.filter(fields1).join("\t"), "\n"
|
729
|
+
print "2:\t", hit.filter(fields2).join("\t"), "\n"
|
730
|
+
end
|
731
|
+
|
732
|
+
Using filter method will make it easy to change fields to select and
|
733
|
+
keep the script clean.
|
734
|
+
|
735
|
+
|
736
|
+
--- Bio::KEGG::API#get_all_neighbors_by_gene(genes_id, org)
|
737
|
+
--- Bio::KEGG::API#get_all_best_best_neighbors_by_gene(genes_id)
|
738
|
+
--- Bio::KEGG::API#get_all_best_neighbors_by_gene(genes_id)
|
739
|
+
--- Bio::KEGG::API#get_all_reverse_best_neighbors_by_gene(genes_id)
|
740
|
+
--- Bio::KEGG::API#get_all_paralogs_by_gene(genes_id)
|
741
|
+
--- Bio::KEGG::API#get_all_genes_by_motifs(motif_id_list)
|
742
|
+
--- Bio::KEGG::API#get_all_oc_members_by_gene(genes_id)
|
743
|
+
--- Bio::KEGG::API#get_all_pc_members_by_gene(genes_id)
|
744
|
+
--- Bio::KEGG::API#get_all_genes_by_organism(org)
|
745
|
+
|
746
|
+
These methods are wrapper for the methods without _all_ in its name
|
747
|
+
and internally iterate to retrive all the results using start/max_results
|
748
|
+
value pairs described above. For example,
|
749
|
+
|
750
|
+
#!/usr/bin/env ruby
|
751
|
+
|
752
|
+
require 'soap/wsdlDriver'
|
753
|
+
|
754
|
+
wsdl = "http://soap.genome.jp/KEGG.wsdl"
|
755
|
+
serv = SOAP::WSDLDriverFactory.new(wsdl).create_driver
|
756
|
+
serv.generate_explicit_type = true
|
757
|
+
|
758
|
+
start = 1
|
759
|
+
max_results = 100
|
760
|
+
|
761
|
+
loop do
|
762
|
+
results = serv.get_best_neighbors_by_gene('eco:b0002', start, max_results)
|
763
|
+
break unless results # when no more results returned
|
764
|
+
results.each do |hit|
|
765
|
+
print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n"
|
766
|
+
end
|
767
|
+
start += max_results
|
768
|
+
end
|
769
|
+
|
770
|
+
can be witten as
|
771
|
+
|
772
|
+
#!/usr/bin/env ruby
|
773
|
+
|
774
|
+
require 'bio'
|
775
|
+
|
776
|
+
serv = Bio::KEGG::API.new
|
777
|
+
|
778
|
+
results = serv.get_all_best_neighbors_by_gene('eco:b0002')
|
779
|
+
results.each do |hit|
|
780
|
+
print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n"
|
781
|
+
end
|
782
|
+
|
783
|
+
|
784
|
+
--- Bio::KEGG::API#save_image(url, filename = nil)
|
785
|
+
|
786
|
+
Some methods of the KEGG API will return a URL of the generated image.
|
787
|
+
This method save an image specified by the URL. The filename can be
|
788
|
+
specified by its second argument, otherwise basename of the URL will
|
789
|
+
be used.
|
790
|
+
|
791
|
+
#!/usr/bin/env ruby
|
792
|
+
|
793
|
+
require 'bio'
|
794
|
+
|
795
|
+
serv = Bio::KEGG::API.new("http://soap.genome.jp/v3.0/KEGG.wsdl")
|
796
|
+
|
797
|
+
list = ["eco:b1002", "eco:b2388"]
|
798
|
+
url = serv.mark_pathway_by_objects("path:eco00010", list)
|
799
|
+
|
800
|
+
# Save with the original filename (eco00010.gif in this case)
|
801
|
+
serv.save_image(url)
|
802
|
+
|
803
|
+
# or save as "save_image.gif"
|
804
|
+
serv.save_image(url, "save_image.gif")
|
805
|
+
|
806
|
+
--- Bio::KEGG::API#get_entries(entry_id_list)
|
807
|
+
--- Bio::KEGG::API#get_aaseqs(entry_id_list)
|
808
|
+
--- Bio::KEGG::API#get_naseqs(entry_id_list)
|
809
|
+
--- Bio::KEGG::API#get_definitions(entry_id_list)
|
810
|
+
|
811
|
+
For the shortcut and backward compatibility.
|
812
|
+
|
813
|
+
|
814
|
+
=== General KEGG API methods
|
815
|
+
|
816
|
+
For the methods listed below, consult the KEGG API manual at
|
817
|
+
|
818
|
+
* ((<URL:http://www.genome.jp/kegg/soap/doc/keggapi_manual.html>))
|
819
|
+
|
820
|
+
--- list_databases
|
821
|
+
--- list_organisms
|
822
|
+
--- list_pathways(org)
|
823
|
+
--- binfo(string)
|
824
|
+
--- bget(string)
|
825
|
+
--- bfind(string)
|
826
|
+
--- btit(string)
|
827
|
+
--- get_linkdb_by_entry(entry_id, db, start, max_results)
|
828
|
+
#--- get_neighbors_by_gene(genes_id, org, start, max_results)
|
829
|
+
--- get_best_best_neighbors_by_gene(genes_id, start, max_results)
|
830
|
+
--- get_best_neighbors_by_gene(genes_id, start, max_results)
|
831
|
+
--- get_reverse_best_neighbors_by_gene(genes_id, start, max_results)
|
832
|
+
--- get_paralogs_by_gene(genes_id, start, max_results)
|
833
|
+
--- get_similarity_between_genes(genes_id1, genes_id2)
|
834
|
+
--- get_motifs_by_gene(genes_id, db)
|
835
|
+
--- get_genes_by_motifs(motif_id_list, start, max_results)
|
836
|
+
--- get_ko_by_gene(genes_id)
|
837
|
+
--- get_ko_members(ko_id)
|
838
|
+
--- get_oc_members_by_gene(genes_id, start, max_results)
|
839
|
+
--- get_pc_members_by_gene(genes_id, start, max_results)
|
840
|
+
--- mark_pathway_by_objects(pathway_id, object_id_list)
|
841
|
+
--- color_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list)
|
842
|
+
--- get_genes_by_pathway(pathway_id)
|
843
|
+
--- get_enzymes_by_pathway(pathway_id)
|
844
|
+
--- get_compounds_by_pathway(pathway_id)
|
845
|
+
--- get_reactions_by_pathway(pathway_id)
|
846
|
+
--- get_pathways_by_genes(genes_id_list)
|
847
|
+
--- get_pathways_by_enzymes(enzyme_id_list)
|
848
|
+
--- get_pathways_by_compounds(compound_id_list)
|
849
|
+
--- get_pathways_by_reactions(reaction_id_list)
|
850
|
+
--- get_linked_pathways(pathway_id)
|
851
|
+
--- get_genes_by_enzyme(enzyme_id, org)
|
852
|
+
--- get_enzymes_by_gene(genes_id)
|
853
|
+
--- get_enzymes_by_compound(compound_id)
|
854
|
+
--- get_enzymes_by_reaction(reaction_id)
|
855
|
+
--- get_compounds_by_enzyme(enzyme_id)
|
856
|
+
--- get_compounds_by_reaction(reaction_id)
|
857
|
+
--- get_reactions_by_enzyme(enzyme_id)
|
858
|
+
--- get_reactions_by_compound(compound_id)
|
859
|
+
--- get_genes_by_organism(org, start, max_results)
|
860
|
+
--- get_number_of_genes_by_organism(org)
|
861
|
+
|
862
|
+
=end
|
863
|
+
|