bio 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bioruby +14 -122
- data/bin/br_biofetch.rb +2 -2
- data/bin/br_bioflat.rb +2 -2
- data/bin/br_biogetseq.rb +2 -2
- data/bin/br_pmfetch.rb +3 -3
- data/doc/Changes-0.7.rd +77 -0
- data/doc/KEGG_API.rd +523 -232
- data/doc/KEGG_API.rd.ja +529 -207
- data/doc/Tutorial.rd +48 -11
- data/lib/bio.rb +59 -6
- data/lib/bio/alignment.rb +713 -103
- data/lib/bio/appl/bl2seq/report.rb +2 -18
- data/lib/bio/appl/blast.rb +108 -91
- data/lib/bio/appl/blast/format0.rb +33 -18
- data/lib/bio/appl/blast/format8.rb +6 -20
- data/lib/bio/appl/blast/report.rb +293 -429
- data/lib/bio/appl/blast/rexml.rb +8 -22
- data/lib/bio/appl/blast/wublast.rb +21 -12
- data/lib/bio/appl/blast/xmlparser.rb +180 -183
- data/lib/bio/appl/blat/report.rb +127 -30
- data/lib/bio/appl/clustalw.rb +87 -59
- data/lib/bio/appl/clustalw/report.rb +20 -22
- data/lib/bio/appl/emboss.rb +113 -20
- data/lib/bio/appl/fasta.rb +173 -198
- data/lib/bio/appl/fasta/format10.rb +244 -347
- data/lib/bio/appl/gcg/msf.rb +212 -0
- data/lib/bio/appl/gcg/seq.rb +195 -0
- data/lib/bio/appl/genscan/report.rb +5 -23
- data/lib/bio/appl/hmmer.rb +8 -45
- data/lib/bio/appl/hmmer/report.rb +2 -20
- data/lib/bio/appl/iprscan/report.rb +374 -0
- data/lib/bio/appl/mafft.rb +87 -50
- data/lib/bio/appl/mafft/report.rb +151 -44
- data/lib/bio/appl/muscle.rb +52 -0
- data/lib/bio/appl/phylip/alignment.rb +129 -0
- data/lib/bio/appl/phylip/distance_matrix.rb +96 -0
- data/lib/bio/appl/probcons.rb +41 -0
- data/lib/bio/appl/psort.rb +89 -96
- data/lib/bio/appl/psort/report.rb +6 -22
- data/lib/bio/appl/pts1.rb +263 -0
- data/lib/bio/appl/sim4.rb +26 -36
- data/lib/bio/appl/sim4/report.rb +2 -18
- data/lib/bio/appl/sosui/report.rb +5 -20
- data/lib/bio/appl/spidey/report.rb +2 -2
- data/lib/bio/appl/targetp/report.rb +4 -20
- data/lib/bio/appl/tcoffee.rb +55 -0
- data/lib/bio/appl/tmhmm/report.rb +4 -20
- data/lib/bio/command.rb +235 -64
- data/lib/bio/data/aa.rb +21 -26
- data/lib/bio/data/codontable.rb +2 -20
- data/lib/bio/data/na.rb +19 -4
- data/lib/bio/db.rb +27 -12
- data/lib/bio/db/aaindex.rb +2 -20
- data/lib/bio/db/embl/common.rb +4 -21
- data/lib/bio/db/embl/embl.rb +33 -85
- data/lib/bio/db/embl/sptr.rb +612 -302
- data/lib/bio/db/embl/swissprot.rb +10 -29
- data/lib/bio/db/embl/trembl.rb +10 -29
- data/lib/bio/db/embl/uniprot.rb +10 -29
- data/lib/bio/db/fantom.rb +15 -20
- data/lib/bio/db/fasta.rb +3 -3
- data/lib/bio/db/genbank/common.rb +37 -46
- data/lib/bio/db/genbank/ddbj.rb +6 -18
- data/lib/bio/db/genbank/genbank.rb +47 -186
- data/lib/bio/db/genbank/genpept.rb +4 -17
- data/lib/bio/db/genbank/refseq.rb +4 -17
- data/lib/bio/db/gff.rb +103 -35
- data/lib/bio/db/go.rb +4 -20
- data/lib/bio/db/kegg/brite.rb +26 -36
- data/lib/bio/db/kegg/compound.rb +81 -85
- data/lib/bio/db/kegg/drug.rb +98 -0
- data/lib/bio/db/kegg/enzyme.rb +133 -110
- data/lib/bio/db/kegg/expression.rb +2 -20
- data/lib/bio/db/kegg/genes.rb +208 -238
- data/lib/bio/db/kegg/genome.rb +164 -285
- data/lib/bio/db/kegg/glycan.rb +114 -157
- data/lib/bio/db/kegg/keggtab.rb +242 -303
- data/lib/bio/db/kegg/kgml.rb +117 -160
- data/lib/bio/db/kegg/orthology.rb +112 -0
- data/lib/bio/db/kegg/reaction.rb +54 -69
- data/lib/bio/db/kegg/taxonomy.rb +331 -0
- data/lib/bio/db/lasergene.rb +209 -0
- data/lib/bio/db/litdb.rb +3 -27
- data/lib/bio/db/medline.rb +228 -249
- data/lib/bio/db/nbrf.rb +3 -3
- data/lib/bio/db/newick.rb +510 -0
- data/lib/bio/db/nexus.rb +1854 -0
- data/lib/bio/db/pdb.rb +5 -17
- data/lib/bio/db/pdb/atom.rb +2 -18
- data/lib/bio/db/pdb/chain.rb +2 -18
- data/lib/bio/db/pdb/chemicalcomponent.rb +2 -18
- data/lib/bio/db/pdb/model.rb +2 -18
- data/lib/bio/db/pdb/pdb.rb +73 -34
- data/lib/bio/db/pdb/residue.rb +4 -20
- data/lib/bio/db/pdb/utils.rb +2 -18
- data/lib/bio/db/prosite.rb +403 -422
- data/lib/bio/db/rebase.rb +84 -40
- data/lib/bio/db/soft.rb +404 -0
- data/lib/bio/db/transfac.rb +5 -17
- data/lib/bio/feature.rb +106 -52
- data/lib/bio/io/das.rb +32 -42
- data/lib/bio/io/dbget.rb +2 -20
- data/lib/bio/io/ddbjxml.rb +77 -138
- data/lib/bio/io/ebisoap.rb +158 -0
- data/lib/bio/io/ensembl.rb +229 -0
- data/lib/bio/io/fastacmd.rb +89 -82
- data/lib/bio/io/fetch.rb +163 -96
- data/lib/bio/io/flatfile.rb +170 -73
- data/lib/bio/io/flatfile/bdb.rb +3 -16
- data/lib/bio/io/flatfile/index.rb +2 -2
- data/lib/bio/io/flatfile/indexer.rb +3 -2
- data/lib/bio/io/higet.rb +12 -31
- data/lib/bio/io/keggapi.rb +210 -269
- data/lib/bio/io/ncbisoap.rb +155 -0
- data/lib/bio/io/pubmed.rb +169 -147
- data/lib/bio/io/registry.rb +4 -20
- data/lib/bio/io/soapwsdl.rb +43 -38
- data/lib/bio/io/sql.rb +242 -305
- data/lib/bio/location.rb +407 -285
- data/lib/bio/map.rb +410 -0
- data/lib/bio/pathway.rb +558 -695
- data/lib/bio/reference.rb +272 -75
- data/lib/bio/sequence.rb +255 -13
- data/lib/bio/sequence/aa.rb +71 -10
- data/lib/bio/sequence/common.rb +187 -33
- data/lib/bio/sequence/compat.rb +59 -4
- data/lib/bio/sequence/format.rb +54 -7
- data/lib/bio/sequence/generic.rb +3 -3
- data/lib/bio/sequence/na.rb +328 -26
- data/lib/bio/shell.rb +11 -4
- data/lib/bio/shell/core.rb +221 -160
- data/lib/bio/shell/demo.rb +18 -15
- data/lib/bio/shell/interface.rb +14 -12
- data/lib/bio/shell/irb.rb +95 -0
- data/lib/bio/shell/object.rb +45 -26
- data/lib/bio/shell/plugin/blast.rb +42 -0
- data/lib/bio/shell/plugin/codon.rb +22 -14
- data/lib/bio/shell/plugin/das.rb +58 -0
- data/lib/bio/shell/plugin/emboss.rb +2 -2
- data/lib/bio/shell/plugin/entry.rb +22 -11
- data/lib/bio/shell/plugin/flatfile.rb +2 -2
- data/lib/bio/shell/plugin/keggapi.rb +13 -6
- data/lib/bio/shell/plugin/midi.rb +4 -4
- data/lib/bio/shell/plugin/obda.rb +2 -2
- data/lib/bio/shell/plugin/psort.rb +56 -0
- data/lib/bio/shell/plugin/seq.rb +35 -8
- data/lib/bio/shell/plugin/soap.rb +87 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/bioruby_generator.rb +29 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_classes.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_log.rhtml +27 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_methods.rhtml +11 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_modules.rhtml +4 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_variables.rhtml +7 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-console.png +0 -0
- data/lib/bio/shell/rails/{public/images/icon.png → vendor/plugins/generators/bioruby/templates/bioruby-gem.png} +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.css +369 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.rhtml +47 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_controller.rb +144 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_helper.rb +47 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/commands.rhtml +8 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/history.rhtml +10 -0
- data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/index.rhtml +22 -0
- data/lib/bio/shell/script.rb +25 -0
- data/lib/bio/shell/setup.rb +109 -0
- data/lib/bio/shell/web.rb +70 -58
- data/lib/bio/tree.rb +850 -0
- data/lib/bio/util/color_scheme.rb +84 -107
- data/lib/bio/util/color_scheme/buried.rb +5 -24
- data/lib/bio/util/color_scheme/helix.rb +5 -24
- data/lib/bio/util/color_scheme/hydropathy.rb +5 -24
- data/lib/bio/util/color_scheme/nucleotide.rb +5 -24
- data/lib/bio/util/color_scheme/strand.rb +5 -24
- data/lib/bio/util/color_scheme/taylor.rb +5 -24
- data/lib/bio/util/color_scheme/turn.rb +5 -24
- data/lib/bio/util/color_scheme/zappo.rb +5 -24
- data/lib/bio/util/contingency_table.rb +70 -43
- data/lib/bio/util/restriction_enzyme.rb +228 -0
- data/lib/bio/util/restriction_enzyme/analysis.rb +249 -0
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +217 -0
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +107 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +321 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +130 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +103 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +38 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +76 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +107 -0
- data/lib/bio/util/restriction_enzyme/enzymes.yaml +7061 -0
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +24 -0
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +47 -0
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +67 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +257 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +242 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +51 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +41 -0
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +77 -0
- data/lib/bio/util/restriction_enzyme/single_strand.rb +199 -0
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +135 -0
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +23 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +111 -0
- data/lib/bio/util/sirna.rb +4 -22
- data/sample/color_scheme_na.rb +4 -12
- data/sample/enzymes.rb +78 -0
- data/sample/goslim.rb +5 -13
- data/sample/psortplot_html.rb +4 -12
- data/test/data/blast/2.2.15.blastp.m7 +876 -0
- data/test/data/embl/AB090716.embl.rel89 +63 -0
- data/test/data/fasta/example1.txt +75 -0
- data/test/data/fasta/example2.txt +21 -0
- data/test/data/iprscan/merged.raw +32 -0
- data/test/data/iprscan/merged.txt +74 -0
- data/test/data/soft/GDS100_partial.soft +92 -0
- data/test/data/soft/GSE3457_family_partial.soft +874 -0
- data/test/functional/bio/io/test_ensembl.rb +103 -0
- data/test/functional/bio/io/test_soapwsdl.rb +5 -17
- data/test/unit/bio/appl/bl2seq/test_report.rb +2 -2
- data/test/unit/bio/appl/blast/test_report.rb +3 -16
- data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -16
- data/test/unit/bio/appl/genscan/test_report.rb +3 -16
- data/test/unit/bio/appl/hmmer/test_report.rb +3 -16
- data/test/unit/bio/appl/iprscan/test_report.rb +338 -0
- data/test/unit/bio/appl/mafft/test_report.rb +63 -0
- data/test/unit/bio/appl/sosui/test_report.rb +3 -16
- data/test/unit/bio/appl/targetp/test_report.rb +3 -16
- data/test/unit/bio/appl/test_blast.rb +3 -16
- data/test/unit/bio/appl/test_fasta.rb +4 -16
- data/test/unit/bio/appl/test_pts1.rb +140 -0
- data/test/unit/bio/appl/tmhmm/test_report.rb +3 -16
- data/test/unit/bio/data/test_aa.rb +4 -17
- data/test/unit/bio/data/test_codontable.rb +3 -16
- data/test/unit/bio/data/test_na.rb +3 -3
- data/test/unit/bio/db/embl/test_common.rb +3 -16
- data/test/unit/bio/db/embl/test_embl.rb +3 -16
- data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
- data/test/unit/bio/db/embl/test_sptr.rb +1548 -41
- data/test/unit/bio/db/embl/test_uniprot.rb +3 -16
- data/test/unit/bio/db/kegg/test_genes.rb +3 -16
- data/test/unit/bio/db/pdb/test_pdb.rb +7 -24
- data/test/unit/bio/db/test_aaindex.rb +2 -2
- data/test/unit/bio/db/test_fasta.rb +3 -16
- data/test/unit/bio/db/test_gff.rb +3 -16
- data/test/unit/bio/db/test_lasergene.rb +95 -0
- data/test/unit/bio/db/test_newick.rb +56 -0
- data/test/unit/bio/db/test_nexus.rb +360 -0
- data/test/unit/bio/db/test_prosite.rb +5 -18
- data/test/unit/bio/db/test_rebase.rb +11 -25
- data/test/unit/bio/db/test_soft.rb +138 -0
- data/test/unit/bio/io/test_ddbjxml.rb +5 -17
- data/test/unit/bio/io/test_ensembl.rb +109 -0
- data/test/unit/bio/io/test_fastacmd.rb +3 -16
- data/test/unit/bio/io/test_flatfile.rb +237 -0
- data/test/unit/bio/io/test_soapwsdl.rb +4 -17
- data/test/unit/bio/sequence/test_aa.rb +3 -3
- data/test/unit/bio/sequence/test_common.rb +3 -16
- data/test/unit/bio/sequence/test_compat.rb +3 -16
- data/test/unit/bio/sequence/test_na.rb +29 -3
- data/test/unit/bio/shell/plugin/test_seq.rb +8 -8
- data/test/unit/bio/test_alignment.rb +16 -27
- data/test/unit/bio/test_command.rb +242 -25
- data/test/unit/bio/test_db.rb +3 -16
- data/test/unit/bio/test_feature.rb +4 -16
- data/test/unit/bio/test_location.rb +4 -16
- data/test/unit/bio/test_map.rb +230 -0
- data/test/unit/bio/test_pathway.rb +4 -16
- data/test/unit/bio/test_reference.rb +2 -2
- data/test/unit/bio/test_sequence.rb +7 -19
- data/test/unit/bio/test_shell.rb +3 -16
- data/test/unit/bio/test_tree.rb +593 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +299 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +103 -0
- data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +240 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +100 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +75 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +73 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +53 -0
- data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +104 -0
- data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +83 -0
- data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +246 -0
- data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +44 -0
- data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +115 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +147 -0
- data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +60 -0
- data/test/unit/bio/util/test_color_scheme.rb +6 -18
- data/test/unit/bio/util/test_contingency_table.rb +6 -18
- data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
- data/test/unit/bio/util/test_sirna.rb +3 -16
- metadata +228 -169
- data/doc/BioRuby.rd.ja +0 -225
- data/doc/Design.rd.ja +0 -341
- data/doc/TODO.rd.ja +0 -138
- data/lib/bio/appl/fasta/format6.rb +0 -37
- data/lib/bio/db/kegg/cell.rb +0 -88
- data/lib/bio/db/kegg/ko.rb +0 -178
- data/lib/bio/shell/rails/Rakefile +0 -10
- data/lib/bio/shell/rails/app/controllers/application.rb +0 -4
- data/lib/bio/shell/rails/app/controllers/shell_controller.rb +0 -94
- data/lib/bio/shell/rails/app/helpers/application_helper.rb +0 -3
- data/lib/bio/shell/rails/app/models/shell_connection.rb +0 -30
- data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +0 -37
- data/lib/bio/shell/rails/app/views/shell/history.rhtml +0 -5
- data/lib/bio/shell/rails/app/views/shell/index.rhtml +0 -2
- data/lib/bio/shell/rails/app/views/shell/show.rhtml +0 -13
- data/lib/bio/shell/rails/config/boot.rb +0 -19
- data/lib/bio/shell/rails/config/database.yml +0 -85
- data/lib/bio/shell/rails/config/environment.rb +0 -53
- data/lib/bio/shell/rails/config/environments/development.rb +0 -19
- data/lib/bio/shell/rails/config/environments/production.rb +0 -19
- data/lib/bio/shell/rails/config/environments/test.rb +0 -19
- data/lib/bio/shell/rails/config/routes.rb +0 -19
- data/lib/bio/shell/rails/doc/README_FOR_APP +0 -2
- data/lib/bio/shell/rails/public/404.html +0 -8
- data/lib/bio/shell/rails/public/500.html +0 -8
- data/lib/bio/shell/rails/public/dispatch.cgi +0 -10
- data/lib/bio/shell/rails/public/dispatch.fcgi +0 -24
- data/lib/bio/shell/rails/public/dispatch.rb +0 -10
- data/lib/bio/shell/rails/public/favicon.ico +0 -0
- data/lib/bio/shell/rails/public/images/rails.png +0 -0
- data/lib/bio/shell/rails/public/index.html +0 -277
- data/lib/bio/shell/rails/public/javascripts/controls.js +0 -750
- data/lib/bio/shell/rails/public/javascripts/dragdrop.js +0 -584
- data/lib/bio/shell/rails/public/javascripts/effects.js +0 -854
- data/lib/bio/shell/rails/public/javascripts/prototype.js +0 -1785
- data/lib/bio/shell/rails/public/robots.txt +0 -1
- data/lib/bio/shell/rails/public/stylesheets/main.css +0 -187
- data/lib/bio/shell/rails/script/about +0 -3
- data/lib/bio/shell/rails/script/breakpointer +0 -3
- data/lib/bio/shell/rails/script/console +0 -3
- data/lib/bio/shell/rails/script/destroy +0 -3
- data/lib/bio/shell/rails/script/generate +0 -3
- data/lib/bio/shell/rails/script/performance/benchmarker +0 -3
- data/lib/bio/shell/rails/script/performance/profiler +0 -3
- data/lib/bio/shell/rails/script/plugin +0 -3
- data/lib/bio/shell/rails/script/process/reaper +0 -3
- data/lib/bio/shell/rails/script/process/spawner +0 -3
- data/lib/bio/shell/rails/script/process/spinner +0 -3
- data/lib/bio/shell/rails/script/runner +0 -3
- data/lib/bio/shell/rails/script/server +0 -42
- data/lib/bio/shell/rails/test/test_helper.rb +0 -28
data/lib/bio/io/flatfile/bdb.rb
CHANGED
@@ -1,23 +1,10 @@
|
|
1
1
|
#
|
2
2
|
# bio/io/flatfile/bdb.rb - OBDA flatfile index by Berkley DB
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# Copyright:: Copyright (C) 2002 GOTO Naohisa <ng@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
5
6
|
#
|
6
|
-
#
|
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: bdb.rb,v 1.8 2005/09/26 13:00:08 k Exp $
|
7
|
+
# $Id: bdb.rb,v 1.10 2007/04/05 23:35:41 trevor Exp $
|
21
8
|
#
|
22
9
|
|
23
10
|
begin
|
@@ -3,9 +3,9 @@
|
|
3
3
|
#
|
4
4
|
# Copyright:: Copyright (C) 2002
|
5
5
|
# GOTO Naohisa <ng@bioruby.org>
|
6
|
-
# License:: Ruby
|
6
|
+
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id: index.rb,v 1.
|
8
|
+
# $Id: index.rb,v 1.19 2007/04/05 23:35:41 trevor Exp $
|
9
9
|
#
|
10
10
|
# = About Bio::FlatFileIndex
|
11
11
|
#
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# = bio/io/flatfile/indexer.rb - OBDA flatfile indexer
|
3
3
|
#
|
4
4
|
# Copyright:: Copyright (C) 2002 GOTO Naohisa <ng@bioruby.org>
|
5
|
-
# License:: Ruby
|
5
|
+
# License:: The Ruby License
|
6
6
|
#
|
7
|
-
# $Id: indexer.rb,v 1.
|
7
|
+
# $Id: indexer.rb,v 1.25 2007/04/05 23:35:41 trevor Exp $
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'bio/io/flatfile/index'
|
@@ -114,6 +114,7 @@ module Bio
|
|
114
114
|
DEBUG.print "fileid=#{fileid} file=#{@flatfilename.inspect}\n"
|
115
115
|
@flatfile = Bio::FlatFile.open(@dbclass, file, 'rb')
|
116
116
|
@flatfile.raw = nil
|
117
|
+
@flatfile.entry_pos_flag = true
|
117
118
|
@entry = nil
|
118
119
|
end
|
119
120
|
attr_reader :fileid
|
data/lib/bio/io/higet.rb
CHANGED
@@ -1,23 +1,9 @@
|
|
1
1
|
#
|
2
|
-
# bio/io/higet.rb - SOAP interface for HGC HiGet
|
2
|
+
# = bio/io/higet.rb - SOAP interface for HGC HiGet
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# Copyright:: Copyright (C) 2005 Toshiaki Katayama <k@bioruby.org>
|
5
5
|
#
|
6
|
-
#
|
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 $
|
6
|
+
# $Id: higet.rb,v 1.3 2006/09/19 05:46:22 k Exp $
|
21
7
|
#
|
22
8
|
|
23
9
|
require 'bio/io/soapwsdl'
|
@@ -25,6 +11,15 @@ require 'bio/io/soapwsdl'
|
|
25
11
|
module Bio
|
26
12
|
class HGC
|
27
13
|
|
14
|
+
# == Description
|
15
|
+
#
|
16
|
+
# Interface for the HiGet service provided by Human Genome Center (HGC), Japan.
|
17
|
+
# HiGet performs full-text search against various biological databases.
|
18
|
+
#
|
19
|
+
# == References
|
20
|
+
#
|
21
|
+
# * http://higet.hgc.jp/
|
22
|
+
#
|
28
23
|
class HiGet < Bio::SOAPWSDL
|
29
24
|
|
30
25
|
SERVER_URI = "http://higet.hgc.jp/soap/higet.wsdl"
|
@@ -76,17 +71,3 @@ if __FILE__ == $0
|
|
76
71
|
|
77
72
|
end
|
78
73
|
|
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
|
-
|
data/lib/bio/io/keggapi.rb
CHANGED
@@ -1,36 +1,198 @@
|
|
1
1
|
#
|
2
|
-
# bio/io/keggapi.rb - KEGG API access class
|
2
|
+
# = bio/io/keggapi.rb - KEGG API access class
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# Copyright:: Copyright (C) 2003, 2004 Toshiaki Katayama <k@bioruby.org>
|
5
|
+
# License:: The Ruby License
|
5
6
|
#
|
6
|
-
#
|
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 $
|
7
|
+
# $Id: keggapi.rb,v 1.14 2007/04/05 23:35:41 trevor Exp $
|
21
8
|
#
|
22
9
|
|
23
10
|
require 'bio/io/soapwsdl'
|
24
11
|
require 'uri'
|
25
12
|
require 'net/http'
|
13
|
+
require 'bio/command'
|
26
14
|
|
27
15
|
module Bio
|
28
16
|
class KEGG
|
29
17
|
|
18
|
+
# == Description
|
19
|
+
#
|
20
|
+
# KEGG API is a web service to use KEGG system via SOAP/WSDL.
|
21
|
+
#
|
22
|
+
# == References
|
23
|
+
#
|
24
|
+
# For more informations on KEGG API, see the following site and read the
|
25
|
+
# reference manual.
|
26
|
+
#
|
27
|
+
# * http://www.genome.jp/kegg/soap/
|
28
|
+
# * http://www.genome.jp/kegg/soap/doc/keggapi_manual.html
|
29
|
+
#
|
30
|
+
# == List of methods
|
31
|
+
#
|
32
|
+
# As of KEGG API v5.0
|
33
|
+
#
|
34
|
+
# * list_databases
|
35
|
+
# * list_organisms
|
36
|
+
# * list_pathways(org)
|
37
|
+
# * binfo(string)
|
38
|
+
# * bget(string)
|
39
|
+
# * bfind(string)
|
40
|
+
# * btit(string)
|
41
|
+
# * get_linkdb_by_entry(entry_id, db, start, max_results)
|
42
|
+
# * get_best_best_neighbors_by_gene(genes_id, start, max_results)
|
43
|
+
# * get_best_neighbors_by_gene(genes_id, start, max_results)
|
44
|
+
# * get_reverse_best_neighbors_by_gene(genes_id, start, max_results)
|
45
|
+
# * get_paralogs_by_gene(genes_id, start, max_results)
|
46
|
+
# * get_similarity_between_genes(genes_id1, genes_id2)
|
47
|
+
# * get_motifs_by_gene(genes_id, db)
|
48
|
+
# * get_genes_by_motifs(motif_id_list, start, max_results)
|
49
|
+
# * get_ko_by_gene(genes_id)
|
50
|
+
# * get_ko_members(ko_id)
|
51
|
+
# * get_oc_members_by_gene(genes_id, start, max_results)
|
52
|
+
# * get_pc_members_by_gene(genes_id, start, max_results)
|
53
|
+
# * mark_pathway_by_objects(pathway_id, object_id_list)
|
54
|
+
# * color_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list)
|
55
|
+
# * get_genes_by_pathway(pathway_id)
|
56
|
+
# * get_enzymes_by_pathway(pathway_id)
|
57
|
+
# * get_compounds_by_pathway(pathway_id)
|
58
|
+
# * get_reactions_by_pathway(pathway_id)
|
59
|
+
# * get_pathways_by_genes(genes_id_list)
|
60
|
+
# * get_pathways_by_enzymes(enzyme_id_list)
|
61
|
+
# * get_pathways_by_compounds(compound_id_list)
|
62
|
+
# * get_pathways_by_reactions(reaction_id_list)
|
63
|
+
# * get_linked_pathways(pathway_id)
|
64
|
+
# * get_genes_by_enzyme(enzyme_id, org)
|
65
|
+
# * get_enzymes_by_gene(genes_id)
|
66
|
+
# * get_enzymes_by_compound(compound_id)
|
67
|
+
# * get_enzymes_by_reaction(reaction_id)
|
68
|
+
# * get_compounds_by_enzyme(enzyme_id)
|
69
|
+
# * get_compounds_by_reaction(reaction_id)
|
70
|
+
# * get_reactions_by_enzyme(enzyme_id)
|
71
|
+
# * get_reactions_by_compound(compound_id)
|
72
|
+
# * get_genes_by_organism(org, start, max_results)
|
73
|
+
# * get_number_of_genes_by_organism(org)
|
74
|
+
#
|
75
|
+
# == KEGG API methods implemented only in BioRuby
|
76
|
+
#
|
77
|
+
# In BioRuby, returned values are added filter method to pick up
|
78
|
+
# values in a complex data type as an array.
|
79
|
+
#
|
80
|
+
# #!/usr/bin/env ruby
|
81
|
+
#
|
82
|
+
# require 'bio'
|
83
|
+
#
|
84
|
+
# serv = Bio::KEGG::API.new
|
85
|
+
# results = serv.get_best_neighbors_by_gene("eco:b0002", "bsu")
|
86
|
+
#
|
87
|
+
# # case 0 : without filter
|
88
|
+
# results.each do |hit|
|
89
|
+
# print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n"
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# # case 1 : select gene names and SW score only
|
93
|
+
# fields = [:genes_id1, :genes_id2, :sw_score]
|
94
|
+
# results.each do |hit|
|
95
|
+
# puts hit.filter(fields).join("\t")
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
# # case 2 : also uses aligned position in each amino acid sequence etc.
|
99
|
+
# fields1 = [:genes_id1, :start_position1, :end_position1, :best_flag_1to2]
|
100
|
+
# fields2 = [:genes_id2, :start_position2, :end_position2, :best_flag_2to1]
|
101
|
+
# results.each do |hit|
|
102
|
+
# print "> score: ", hit.sw_score, ", identity: ", hit.identity, "\n"
|
103
|
+
# print "1:\t", hit.filter(fields1).join("\t"), "\n"
|
104
|
+
# print "2:\t", hit.filter(fields2).join("\t"), "\n"
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# Using filter method will make it easy to change fields to select and
|
108
|
+
# keep the script clean.
|
109
|
+
#
|
110
|
+
# * Bio::KEGG::API#get_all_neighbors_by_gene(genes_id, org)
|
111
|
+
# * Bio::KEGG::API#get_all_best_best_neighbors_by_gene(genes_id)
|
112
|
+
# * Bio::KEGG::API#get_all_best_neighbors_by_gene(genes_id)
|
113
|
+
# * Bio::KEGG::API#get_all_reverse_best_neighbors_by_gene(genes_id)
|
114
|
+
# * Bio::KEGG::API#get_all_paralogs_by_gene(genes_id)
|
115
|
+
# * Bio::KEGG::API#get_all_genes_by_motifs(motif_id_list)
|
116
|
+
# * Bio::KEGG::API#get_all_oc_members_by_gene(genes_id)
|
117
|
+
# * Bio::KEGG::API#get_all_pc_members_by_gene(genes_id)
|
118
|
+
# * Bio::KEGG::API#get_all_genes_by_organism(org)
|
119
|
+
#
|
120
|
+
# These methods are wrapper for the methods without _all_ in its name
|
121
|
+
# and internally iterate to retrive all the results using start/max_results
|
122
|
+
# value pairs described above. For example,
|
123
|
+
#
|
124
|
+
# #!/usr/bin/env ruby
|
125
|
+
#
|
126
|
+
# require 'soap/wsdlDriver'
|
127
|
+
#
|
128
|
+
# wsdl = "http://soap.genome.jp/KEGG.wsdl"
|
129
|
+
# serv = SOAP::WSDLDriverFactory.new(wsdl).create_driver
|
130
|
+
# serv.generate_explicit_type = true
|
131
|
+
#
|
132
|
+
# start = 1
|
133
|
+
# max_results = 100
|
134
|
+
#
|
135
|
+
# loop do
|
136
|
+
# results = serv.get_best_neighbors_by_gene('eco:b0002', start, max_results)
|
137
|
+
# break unless results # when no more results returned
|
138
|
+
# results.each do |hit|
|
139
|
+
# print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n"
|
140
|
+
# end
|
141
|
+
# start += max_results
|
142
|
+
# end
|
143
|
+
#
|
144
|
+
# can be witten as
|
145
|
+
#
|
146
|
+
# #!/usr/bin/env ruby
|
147
|
+
#
|
148
|
+
# require 'bio'
|
149
|
+
#
|
150
|
+
# serv = Bio::KEGG::API.new
|
151
|
+
#
|
152
|
+
# results = serv.get_all_best_neighbors_by_gene('eco:b0002')
|
153
|
+
# results.each do |hit|
|
154
|
+
# print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n"
|
155
|
+
# end
|
156
|
+
#
|
157
|
+
#
|
158
|
+
# * Bio::KEGG::API#save_image(url, filename = nil)
|
159
|
+
#
|
160
|
+
# Some methods of the KEGG API will return a URL of the generated image.
|
161
|
+
# This method save an image specified by the URL. The filename can be
|
162
|
+
# specified by its second argument, otherwise basename of the URL will
|
163
|
+
# be used.
|
164
|
+
#
|
165
|
+
# #!/usr/bin/env ruby
|
166
|
+
#
|
167
|
+
# require 'bio'
|
168
|
+
#
|
169
|
+
# serv = Bio::KEGG::API.new("http://soap.genome.jp/v3.0/KEGG.wsdl")
|
170
|
+
#
|
171
|
+
# list = ["eco:b1002", "eco:b2388"]
|
172
|
+
# url = serv.mark_pathway_by_objects("path:eco00010", list)
|
173
|
+
#
|
174
|
+
# # Save with the original filename (eco00010.gif in this case)
|
175
|
+
# serv.save_image(url)
|
176
|
+
#
|
177
|
+
# # or save as "save_image.gif"
|
178
|
+
# serv.save_image(url, "save_image.gif")
|
179
|
+
#
|
180
|
+
# * Bio::KEGG::API#get_entries(entry_id_list)
|
181
|
+
# * Bio::KEGG::API#get_aaseqs(entry_id_list)
|
182
|
+
# * Bio::KEGG::API#get_naseqs(entry_id_list)
|
183
|
+
# * Bio::KEGG::API#get_definitions(entry_id_list)
|
184
|
+
#
|
185
|
+
# These methods are for the shortcut and backward compatibility
|
186
|
+
# (these methods existed in the older version of the KEGG API).
|
187
|
+
#
|
30
188
|
class API < Bio::SOAPWSDL
|
31
189
|
|
32
190
|
SERVER_URI = "http://soap.genome.jp/KEGG.wsdl"
|
33
191
|
|
192
|
+
# Connect to the KEGG API's SOAP server. A WSDL file will be automatically
|
193
|
+
# downloaded and parsed to generate the SOAP client driver. The default URL
|
194
|
+
# for the WSDL is http://soap.genome.jp/KEGG.wsdl but it can be changed by
|
195
|
+
# the argument or by wsdl= method.
|
34
196
|
def initialize(wsdl = nil)
|
35
197
|
@wsdl = wsdl || SERVER_URI
|
36
198
|
@log = nil
|
@@ -38,7 +200,17 @@ class API < Bio::SOAPWSDL
|
|
38
200
|
@max_results = 100
|
39
201
|
create_driver
|
40
202
|
end
|
41
|
-
|
203
|
+
|
204
|
+
# Returns current value for the 'start' count for the methods having
|
205
|
+
# start/max_results argument pairs or changes the default value for
|
206
|
+
# the 'start' count.
|
207
|
+
attr_accessor :start
|
208
|
+
|
209
|
+
# Returns current value for the 'max_results' number for the methods having
|
210
|
+
# start/max_results argument pairs or changes the default value for the
|
211
|
+
# 'max_results' count. If your request timeouts, try smaller value for
|
212
|
+
# the max_results.
|
213
|
+
attr_accessor :max_results
|
42
214
|
|
43
215
|
def method_missing(*arg)
|
44
216
|
begin
|
@@ -50,6 +222,7 @@ class API < Bio::SOAPWSDL
|
|
50
222
|
return results
|
51
223
|
end
|
52
224
|
|
225
|
+
|
53
226
|
# def get_all_neighbors_by_gene(genes_id, org)
|
54
227
|
# get_all(:get_neighbors_by_gene, genes_id, org)
|
55
228
|
# end
|
@@ -95,7 +268,7 @@ class API < Bio::SOAPWSDL
|
|
95
268
|
schema, user, host, port, reg, path, = URI.split(url)
|
96
269
|
filename ||= File.basename(path)
|
97
270
|
|
98
|
-
http =
|
271
|
+
http = Bio::Command.new_http(host, port)
|
99
272
|
response, = http.get(path)
|
100
273
|
File.open(filename, "w+") do |f|
|
101
274
|
f.print response.body
|
@@ -200,7 +373,7 @@ if __FILE__ == $0
|
|
200
373
|
serv = Bio::KEGG::API.new
|
201
374
|
# serv.log = STDERR
|
202
375
|
|
203
|
-
puts "
|
376
|
+
puts "# * parameters"
|
204
377
|
puts " wsdl : #{serv.wsdl}"
|
205
378
|
puts " log : #{serv.log}"
|
206
379
|
puts " start : #{serv.start}"
|
@@ -252,19 +425,19 @@ if __FILE__ == $0
|
|
252
425
|
puts "### btit('eco:b0002 eco:b0003')"
|
253
426
|
puts serv.btit("eco:b0002 eco:b0003")
|
254
427
|
|
255
|
-
puts "
|
428
|
+
puts "# * get_entries(['eco:b0002', 'eco:b0003'])"
|
256
429
|
puts serv.get_entries(["eco:b0002", "eco:b0003"])
|
257
430
|
|
258
|
-
puts "
|
431
|
+
puts "# * get_aaseqs(['eco:b0002', 'eco:b0003'])"
|
259
432
|
puts serv.get_aaseqs(["eco:b0002", "eco:b0003"])
|
260
433
|
|
261
|
-
puts "
|
434
|
+
puts "# * get_naseqs(['eco:b0002', 'eco:b0003'])"
|
262
435
|
puts serv.get_naseqs(["eco:b0002", "eco:b0003"])
|
263
436
|
|
264
|
-
puts "
|
437
|
+
puts "# * get_definitions(['eco:b0002', 'eco:b0003'])"
|
265
438
|
puts serv.get_definitions(["eco:b0002", "eco:b0003"])
|
266
439
|
|
267
|
-
puts "
|
440
|
+
puts "# * get_definitions(('eco:b0001'..'eco:b0200').to_a)"
|
268
441
|
puts serv.get_definitions(("eco:b0001".."eco:b0200").to_a)
|
269
442
|
|
270
443
|
puts "=== LinkDB"
|
@@ -275,7 +448,7 @@ if __FILE__ == $0
|
|
275
448
|
puts [ link.entry_id1, link.entry_id2, link.type, link.path ].join("\t")
|
276
449
|
end
|
277
450
|
|
278
|
-
puts "
|
451
|
+
puts "# * get_all_linkdb_by_entry('eco:b0002', 'pathway')"
|
279
452
|
list = serv.get_all_linkdb_by_entry("eco:b0002", "pathway")
|
280
453
|
list.each do |link|
|
281
454
|
puts [ link.entry_id1, link.entry_id2, link.type, link.path ].join("\t")
|
@@ -289,7 +462,7 @@ if __FILE__ == $0
|
|
289
462
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
290
463
|
end
|
291
464
|
|
292
|
-
puts "
|
465
|
+
puts "# * get_all_neighbors_by_gene('eco:b0002', 'bsu')"
|
293
466
|
list = serv.get_all_neighbors_by_gene("eco:b0002", "bsu")
|
294
467
|
list.each do |hit|
|
295
468
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
@@ -301,7 +474,7 @@ if __FILE__ == $0
|
|
301
474
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
302
475
|
end
|
303
476
|
|
304
|
-
puts "
|
477
|
+
puts "# * get_all_best_best_neighbors_by_gene('eco:b0002')"
|
305
478
|
list = serv.get_all_best_best_neighbors_by_gene("eco:b0002")
|
306
479
|
list.each do |hit|
|
307
480
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
@@ -313,7 +486,7 @@ if __FILE__ == $0
|
|
313
486
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
314
487
|
end
|
315
488
|
|
316
|
-
puts "
|
489
|
+
puts "# * get_all_best_neighbors_by_gene('eco:b0002')"
|
317
490
|
list = serv.get_all_best_neighbors_by_gene("eco:b0002")
|
318
491
|
list.each do |hit|
|
319
492
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
@@ -325,7 +498,7 @@ if __FILE__ == $0
|
|
325
498
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
326
499
|
end
|
327
500
|
|
328
|
-
puts "
|
501
|
+
puts "# * get_all_reverse_best_neighbors_by_gene('eco:b0002')"
|
329
502
|
list = serv.get_all_reverse_best_neighbors_by_gene("eco:b0002")
|
330
503
|
list.each do |hit|
|
331
504
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
@@ -337,7 +510,7 @@ if __FILE__ == $0
|
|
337
510
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
338
511
|
end
|
339
512
|
|
340
|
-
puts "
|
513
|
+
puts "# * get_all_paralogs_by_gene('eco:b0002')"
|
341
514
|
list = serv.get_all_paralogs_by_gene("eco:b0002")
|
342
515
|
list.each do |hit|
|
343
516
|
puts [ hit.genes_id1, hit.genes_id2, hit.sw_score ].join("\t")
|
@@ -391,7 +564,7 @@ if __FILE__ == $0
|
|
391
564
|
puts "### get_motifs_by_gene('eco:b0002', 'all')"
|
392
565
|
list = serv.get_motifs_by_gene("eco:b0002", "all")
|
393
566
|
list.each do |motif|
|
394
|
-
puts "
|
567
|
+
puts "# * motif result"
|
395
568
|
puts " motif_id : #{motif.motif_id}"
|
396
569
|
puts " definition : #{motif.definition}"
|
397
570
|
puts " genes_id : #{motif.genes_id}"
|
@@ -407,7 +580,7 @@ if __FILE__ == $0
|
|
407
580
|
puts [ gene.entry_id, gene.definition ].join("\t")
|
408
581
|
end
|
409
582
|
|
410
|
-
puts "
|
583
|
+
puts "# * get_all_genes_by_motifs(['pf:ACT', 'ps:ASPARTOKINASE'])"
|
411
584
|
list = serv.get_all_genes_by_motifs(["pf:ACT", "ps:ASPARTOKINASE"])
|
412
585
|
list.each do |gene|
|
413
586
|
puts [ gene.entry_id, gene.definition ].join("\t")
|
@@ -433,7 +606,7 @@ if __FILE__ == $0
|
|
433
606
|
puts gene
|
434
607
|
end
|
435
608
|
|
436
|
-
puts "
|
609
|
+
puts "# * get_all_oc_members_by_gene('eco:b0002')"
|
437
610
|
list = serv.get_all_oc_members_by_gene("eco:b0002")
|
438
611
|
list.each do |gene|
|
439
612
|
puts gene
|
@@ -445,7 +618,7 @@ if __FILE__ == $0
|
|
445
618
|
puts gene
|
446
619
|
end
|
447
620
|
|
448
|
-
puts "
|
621
|
+
puts "# * get_all_pc_members_by_gene('eco:b0002')"
|
449
622
|
list = serv.get_all_pc_members_by_gene("eco:b0002")
|
450
623
|
list.each do |gene|
|
451
624
|
puts gene
|
@@ -471,7 +644,7 @@ if __FILE__ == $0
|
|
471
644
|
url = serv.color_pathway_by_objects("path:eco00053", obj_list, fg_list, bg_list)
|
472
645
|
puts url
|
473
646
|
|
474
|
-
#puts "
|
647
|
+
#puts "# * save_image(#{url})"
|
475
648
|
#filename = serv.save_image(url, "test.gif")
|
476
649
|
#filename = serv.save_image(url)
|
477
650
|
#puts filename
|
@@ -616,7 +789,7 @@ if __FILE__ == $0
|
|
616
789
|
puts gene
|
617
790
|
end
|
618
791
|
|
619
|
-
puts "
|
792
|
+
puts "# * get_all_genes_by_organism('mge')"
|
620
793
|
list = serv.get_all_genes_by_organism("mge")
|
621
794
|
list.each do |gene|
|
622
795
|
puts gene
|
@@ -629,235 +802,3 @@ if __FILE__ == $0
|
|
629
802
|
|
630
803
|
end
|
631
804
|
|
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
|
-
|