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/registry.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
#
|
4
4
|
# Copyright:: Copyright (C) 2002, 2003, 2004, 2005
|
5
5
|
# Toshiaki Katayama <k@bioruby.org>
|
6
|
-
# License::
|
6
|
+
# License:: The Ruby License
|
7
7
|
#
|
8
|
-
# $Id: registry.rb,v 1.
|
8
|
+
# $Id: registry.rb,v 1.19 2007/04/05 23:35:41 trevor Exp $
|
9
9
|
#
|
10
10
|
# == Description
|
11
11
|
#
|
@@ -81,26 +81,10 @@
|
|
81
81
|
# * http://cvs.open-bio.org/cgi-bin/viewcvs/viewcvs.cgi/obda-specs/?cvsroot=obf-common
|
82
82
|
# * http://www.open-bio.org/registry/seqdatabase.ini
|
83
83
|
#
|
84
|
-
#--
|
85
|
-
# This library is free software; you can redistribute it and/or
|
86
|
-
# modify it under the terms of the GNU Lesser General Public
|
87
|
-
# License as published by the Free Software Foundation; either
|
88
|
-
# version 2 of the License, or (at your option) any later version.
|
89
|
-
#
|
90
|
-
# This library is distributed in the hope that it will be useful,
|
91
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
92
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
93
|
-
# Lesser General Public License for more details.
|
94
|
-
#
|
95
|
-
# You should have received a copy of the GNU Lesser General Public
|
96
|
-
# License along with this library; if not, write to the Free Software
|
97
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
98
|
-
#
|
99
|
-
#++
|
100
|
-
#
|
101
84
|
|
102
85
|
require 'uri'
|
103
86
|
require 'net/http'
|
87
|
+
require 'bio/command'
|
104
88
|
|
105
89
|
|
106
90
|
module Bio
|
@@ -187,7 +171,7 @@ class Registry
|
|
187
171
|
|
188
172
|
def read_remote(url)
|
189
173
|
schema, user, host, port, reg, path, = URI.split(url)
|
190
|
-
|
174
|
+
Bio::Command.start_http(host, port) do |http|
|
191
175
|
response, = http.get(path)
|
192
176
|
parse_stanza(response.body)
|
193
177
|
end
|
data/lib/bio/io/soapwsdl.rb
CHANGED
@@ -2,14 +2,18 @@
|
|
2
2
|
# = bio/io/soapwsdl.rb - SOAP/WSDL interface class
|
3
3
|
#
|
4
4
|
# Copyright:: Copyright (C) 2004
|
5
|
-
#
|
6
|
-
# License::
|
7
|
-
#
|
8
|
-
# $Id: soapwsdl.rb,v 1.3 2005/12/18 16:51:18 nakao Exp $
|
9
|
-
#
|
10
|
-
# SOAP/WSDL
|
5
|
+
# Toshiaki Katayama <k@bioruby.org>
|
6
|
+
# License:: The Ruby License
|
11
7
|
#
|
8
|
+
# $Id: soapwsdl.rb,v 1.7 2007/04/05 23:35:41 trevor Exp $
|
12
9
|
#
|
10
|
+
begin
|
11
|
+
require 'soap/wsdlDriver'
|
12
|
+
rescue LoadError
|
13
|
+
end
|
14
|
+
|
15
|
+
module Bio
|
16
|
+
|
13
17
|
# == Examples
|
14
18
|
#
|
15
19
|
# class API < Bio::SOAPWSDL
|
@@ -26,48 +30,24 @@
|
|
26
30
|
# (case might be insensitive) as required by SOAP4R.
|
27
31
|
#
|
28
32
|
# --- soap_use_proxy
|
33
|
+
#
|
29
34
|
# Set the value of this variable to 'on'.
|
30
35
|
#
|
31
36
|
# --- http_proxy
|
37
|
+
#
|
32
38
|
# Set the URL of your proxy server (http://myproxy.com:8080 etc.).
|
33
39
|
#
|
34
|
-
# === Example
|
40
|
+
# === Example to use HTTP proxy
|
35
41
|
#
|
36
42
|
# % export soap_use_proxy=on
|
37
43
|
# % export http_proxy=http://localhost:8080
|
38
44
|
#
|
39
|
-
#--
|
40
|
-
#
|
41
|
-
# This library is free software; you can redistribute it and/or
|
42
|
-
# modify it under the terms of the GNU Lesser General Public
|
43
|
-
# License as published by the Free Software Foundation; either
|
44
|
-
# version 2 of the License, or (at your option) any later version.
|
45
|
-
#
|
46
|
-
# This library is distributed in the hope that it will be useful,
|
47
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
48
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
49
|
-
# Lesser General Public License for more details.
|
50
|
-
#
|
51
|
-
# You should have received a copy of the GNU Lesser General Public
|
52
|
-
# License along with this library; if not, write to the Free Software
|
53
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
54
|
-
#
|
55
|
-
#++
|
56
|
-
#
|
57
|
-
|
58
|
-
begin
|
59
|
-
require 'soap/wsdlDriver'
|
60
|
-
rescue LoadError
|
61
|
-
end
|
62
|
-
|
63
|
-
module Bio
|
64
|
-
|
65
45
|
class SOAPWSDL
|
66
46
|
|
67
|
-
# WSDL
|
47
|
+
# Returns URL of the current WSDL file.
|
68
48
|
attr_reader :wsdl
|
69
49
|
|
70
|
-
#
|
50
|
+
# Returns current logging IO.
|
71
51
|
attr_reader :log
|
72
52
|
|
73
53
|
|
@@ -89,26 +69,51 @@ class SOAPWSDL
|
|
89
69
|
private :create_driver
|
90
70
|
|
91
71
|
|
92
|
-
#
|
72
|
+
# Change the URL for WSDL file
|
73
|
+
#
|
74
|
+
# serv = Bio::SOAPWSDL.new("http://soap.genome.jp/KEGG.wsdl")
|
75
|
+
#
|
76
|
+
# or
|
77
|
+
#
|
78
|
+
# serv = Bio::SOAPWSDL.new
|
79
|
+
# serv.wsdl = "http://soap.genome.jp/KEGG.wsdl"
|
80
|
+
#
|
81
|
+
# Note that you can't read two or more different WSDL files at once.
|
82
|
+
# In that case, create Bio::SOAPWSDL object for each.
|
83
|
+
#
|
93
84
|
def wsdl=(url)
|
94
85
|
@wsdl = url
|
95
86
|
create_driver
|
96
87
|
end
|
97
88
|
|
98
89
|
|
99
|
-
#
|
90
|
+
# Change the IO for logging. The argument is passed to wiredump_dev method
|
91
|
+
# of the SOAP4R, thus
|
92
|
+
#
|
93
|
+
# serv = Bio::SOAPWSDL.new
|
94
|
+
# serv.log = STDERR
|
95
|
+
#
|
96
|
+
# will print all the SOAP transactions in standard error.
|
97
|
+
# This feature is especially useful for debug.
|
98
|
+
#
|
100
99
|
def log=(io)
|
101
100
|
@log = io
|
102
101
|
@driver.wiredump_dev = @log
|
103
102
|
end
|
104
103
|
|
105
104
|
|
105
|
+
# List of methods defined by WSDL
|
106
|
+
def list_methods
|
107
|
+
@driver.methods(false)
|
108
|
+
end
|
109
|
+
|
110
|
+
|
106
111
|
def method_missing(*arg)
|
107
112
|
@driver.send(*arg)
|
108
113
|
end
|
109
114
|
private :method_missing
|
110
115
|
|
111
|
-
end #
|
116
|
+
end # SOAPWSDL
|
112
117
|
|
113
118
|
end # Bio
|
114
119
|
|
data/lib/bio/io/sql.rb
CHANGED
@@ -1,23 +1,11 @@
|
|
1
1
|
#
|
2
|
-
# bio/io/sql.rb - BioSQL access module
|
2
|
+
# = bio/io/sql.rb - BioSQL access module
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# Copyright:: Copyright (C) 2002 Toshiaki Katayama <k@bioruby.org>
|
5
|
+
# Copyright:: Copyright (C) 2006 Raoul Jean Pierre Bonnal <raoul.bonnal@itb.cnr.it>
|
6
|
+
# License:: The Ruby License
|
5
7
|
#
|
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: sql.rb,v 1.4 2005/09/26 13:04:28 k Exp $
|
8
|
+
# $Id: sql.rb,v 1.8 2007/04/05 23:35:41 trevor Exp $
|
21
9
|
#
|
22
10
|
|
23
11
|
begin
|
@@ -30,293 +18,304 @@ require 'bio/feature'
|
|
30
18
|
|
31
19
|
module Bio
|
32
20
|
|
33
|
-
|
21
|
+
class SQL
|
34
22
|
|
35
|
-
|
36
|
-
|
37
|
-
|
23
|
+
def initialize(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
|
24
|
+
@dbh = DBI.connect(db, user, pass)
|
25
|
+
end
|
38
26
|
|
39
|
-
|
40
|
-
|
41
|
-
|
27
|
+
def close
|
28
|
+
@dbh.disconnect
|
29
|
+
end
|
42
30
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
31
|
+
# Returns Bio::SQL::Sequence object.
|
32
|
+
def fetch(accession) # or display_id for fall back
|
33
|
+
query = "select * from bioentry where accession = ?"
|
34
|
+
entry = @dbh.execute(query, accession).fetch
|
35
|
+
return Sequence.new(@dbh, entry) if entry
|
47
36
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
37
|
+
query = "select * from bioentry where display_id = ?"
|
38
|
+
entry = @dbh.execute(query, accession).fetch
|
39
|
+
return Sequence.new(@dbh, entry) if entry
|
40
|
+
end
|
41
|
+
alias get_by_id fetch
|
53
42
|
|
54
43
|
|
55
|
-
|
44
|
+
# for lazy fetching
|
56
45
|
|
57
|
-
|
46
|
+
class Sequence
|
58
47
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
48
|
+
def initialize(dbh, entry)
|
49
|
+
@dbh = dbh
|
50
|
+
@bioentry_id = entry['bioentry_id']
|
51
|
+
@database_id = entry['biodatabase_id']
|
52
|
+
@entry_id = entry['display_id']
|
53
|
+
@accession = entry['accession']
|
54
|
+
@version = entry['entry_version']
|
55
|
+
@division = entry['division']
|
56
|
+
end
|
57
|
+
attr_reader :accession, :division, :entry_id, :version
|
69
58
|
|
70
59
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
60
|
+
def to_fasta
|
61
|
+
if seq = seq
|
62
|
+
return seq.to_fasta(@accession)
|
75
63
|
end
|
64
|
+
end
|
76
65
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
66
|
+
# Returns Bio::Sequence::NA or AA object.
|
67
|
+
def seq
|
68
|
+
query = "select * from biosequence where bioentry_id = ?"
|
69
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
70
|
+
return unless row
|
81
71
|
|
82
|
-
|
83
|
-
|
72
|
+
mol = row['alphabet']
|
73
|
+
seq = row['seq']
|
84
74
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
75
|
+
case mol
|
76
|
+
when /.na/i # 'dna' or 'rna'
|
77
|
+
Bio::Sequence::NA.new(seq)
|
78
|
+
else # 'protein'
|
79
|
+
Bio::Sequence::AA.new(seq)
|
91
80
|
end
|
81
|
+
end
|
92
82
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
83
|
+
# Returns Bio::Sequence::NA or AA object (by lazy fetching).
|
84
|
+
def subseq(from, to)
|
85
|
+
length = to - from + 1
|
86
|
+
query = "select alphabet, substring(seq, ?, ?) as subseq" +
|
87
|
+
" from biosequence where bioentry_id = ?"
|
88
|
+
row = @dbh.execute(query, from, length, @bioentry_id).fetch
|
89
|
+
return unless row
|
90
|
+
|
91
|
+
mol = row['alphabet']
|
92
|
+
seq = row['subseq']
|
93
|
+
|
94
|
+
case mol
|
95
|
+
when /.na/i # 'dna' or 'rna'
|
96
|
+
Bio::Sequence::NA.new(seq)
|
97
|
+
else # 'protein'
|
98
|
+
Bio::Sequence::AA.new(seq)
|
109
99
|
end
|
100
|
+
end
|
110
101
|
|
111
102
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
f_id = row['seqfeature_id']
|
119
|
-
k_id = row['seqfeature_key_id']
|
120
|
-
s_id = row['seqfeature_source_id']
|
121
|
-
rank = row['seqfeature_rank'].to_i - 1
|
103
|
+
# Returns Bio::Features object.
|
104
|
+
def features
|
105
|
+
array = []
|
106
|
+
query = "select * from seqfeature where bioentry_id = ?"
|
107
|
+
@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
|
108
|
+
next unless row
|
122
109
|
|
123
|
-
|
124
|
-
|
110
|
+
f_id = row['seqfeature_id']
|
111
|
+
k_id = row['type_term_id']
|
112
|
+
s_id = row['source_term_id']
|
113
|
+
rank = row['rank'].to_i - 1
|
125
114
|
|
126
|
-
|
127
|
-
|
115
|
+
# key : type (gene, CDS, ...)
|
116
|
+
type = feature_key(k_id)
|
128
117
|
|
129
|
-
|
130
|
-
|
118
|
+
# source : database (EMBL/GenBank/SwissProt)
|
119
|
+
database = feature_source(s_id)
|
131
120
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
# rank
|
136
|
-
array[rank] = Bio::Feature.new(type, locations, qualifiers)
|
137
|
-
end
|
138
|
-
return Bio::Features.new(array)
|
139
|
-
end
|
121
|
+
# location : position
|
122
|
+
locations = feature_locations(f_id)
|
140
123
|
|
124
|
+
# qualifier
|
125
|
+
qualifiers = feature_qualifiers(f_id)
|
141
126
|
|
142
|
-
|
143
|
-
array =
|
144
|
-
query = <<-END
|
145
|
-
select * from bioentry_reference, reference
|
146
|
-
where bioentry_id = ? and
|
147
|
-
bioentry_reference.reference_id = reference.reference_id
|
148
|
-
END
|
149
|
-
@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
|
150
|
-
next unless row
|
151
|
-
|
152
|
-
hash = {
|
153
|
-
'start' => row['reference_start'],
|
154
|
-
'end' => row['reference_end'],
|
155
|
-
'journal' => row['reference_location'],
|
156
|
-
'title' => row['reference_title'],
|
157
|
-
'authors' => row['reference_authors'],
|
158
|
-
'medline' => row['reference_medline']
|
159
|
-
}
|
160
|
-
hash.default = ''
|
161
|
-
|
162
|
-
rank = row['reference_rank'].to_i - 1
|
163
|
-
array[rank] = hash
|
164
|
-
end
|
165
|
-
return array
|
127
|
+
# rank
|
128
|
+
array[rank] = Bio::Feature.new(type, locations, qualifiers)
|
166
129
|
end
|
130
|
+
return Bio::Features.new(array)
|
131
|
+
end
|
167
132
|
|
168
133
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
134
|
+
# Returns reference informations in Array of Hash (not Bio::Reference).
|
135
|
+
def references
|
136
|
+
array = []
|
137
|
+
query = <<-END
|
138
|
+
select * from bioentry_reference, reference
|
139
|
+
where bioentry_id = ? and
|
140
|
+
bioentry_reference.reference_id = reference.reference_id
|
141
|
+
END
|
142
|
+
@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
|
143
|
+
next unless row
|
144
|
+
|
145
|
+
hash = {
|
146
|
+
'start' => row['start_pos'],
|
147
|
+
'end' => row['end_pos'],
|
148
|
+
'journal' => row['location'],
|
149
|
+
'title' => row['title'],
|
150
|
+
'authors' => row['authors'],
|
151
|
+
'medline' => row['crc']
|
152
|
+
}
|
153
|
+
hash.default = ''
|
154
|
+
|
155
|
+
rank = row['rank'].to_i - 1
|
156
|
+
array[rank] = hash
|
173
157
|
end
|
158
|
+
return array
|
159
|
+
end
|
174
160
|
|
175
|
-
def comments
|
176
|
-
array = []
|
177
|
-
query = "select * from comment where bioentry_id = ?"
|
178
|
-
@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
|
179
|
-
next unless row
|
180
|
-
rank = row['comment_rank'].to_i - 1
|
181
|
-
array[rank] = row['comment_text']
|
182
|
-
end
|
183
|
-
return array
|
184
|
-
end
|
185
161
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
162
|
+
# Returns the first comment. For complete comments, use comments method.
|
163
|
+
def comment
|
164
|
+
query = "select * from comment where bioentry_id = ?"
|
165
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
166
|
+
row ? row['comment_text'] : ''
|
167
|
+
end
|
191
168
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
169
|
+
# Returns comments in an Array of Strings.
|
170
|
+
def comments
|
171
|
+
array = []
|
172
|
+
query = "select * from comment where bioentry_id = ?"
|
173
|
+
@dbh.execute(query, @bioentry_id).fetch_all.each do |row|
|
174
|
+
next unless row
|
175
|
+
rank = row['rank'].to_i - 1
|
176
|
+
array[rank] = row['comment_text']
|
196
177
|
end
|
178
|
+
return array
|
179
|
+
end
|
197
180
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
181
|
+
def database
|
182
|
+
query = "select * from biodatabase where biodatabase_id = ?"
|
183
|
+
row = @dbh.execute(query, @database_id).fetch
|
184
|
+
row ? row['name'] : ''
|
185
|
+
end
|
203
186
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
187
|
+
def date
|
188
|
+
query = "select * from bioentry_date where bioentry_id = ?"
|
189
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
190
|
+
row ? row['date'] : ''
|
191
|
+
end
|
209
192
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
193
|
+
def dblink
|
194
|
+
query = "select * from bioentry_direct_links where source_bioentry_id = ?"
|
195
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
196
|
+
row ? [row['dbname'], row['accession']] : []
|
197
|
+
end
|
215
198
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
END
|
222
|
-
row = @dbh.execute(query, @bioentry_id).fetch
|
223
|
-
@lineage = row ? row['full_lineage'] : ''
|
224
|
-
@common_name = row ? row['common_name'] : ''
|
225
|
-
@ncbi_taxa_id = row ? row['ncbi_taxa_id'] : ''
|
226
|
-
row ? [@lineage, @common_name, @ncbi_taxa_id] : []
|
227
|
-
end
|
199
|
+
def definition
|
200
|
+
query = "select * from bioentry_description where bioentry_id = ?"
|
201
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
202
|
+
row ? row['description'] : ''
|
203
|
+
end
|
228
204
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
205
|
+
def keyword
|
206
|
+
query = "select * from bioentry_keywords where bioentry_id = ?"
|
207
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
208
|
+
row ? row['keywords'] : ''
|
209
|
+
end
|
233
210
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
211
|
+
# Use lineage, common_name, ncbi_taxa_id methods to extract in detail.
|
212
|
+
def taxonomy
|
213
|
+
query = <<-END
|
214
|
+
select taxon_name.name, taxon.ncbi_taxon_id from bioentry
|
215
|
+
join taxon_name using(taxon_id) join taxon using (taxon_id)
|
216
|
+
where bioentry_id = ?
|
217
|
+
END
|
218
|
+
row = @dbh.execute(query, @bioentry_id).fetch
|
219
|
+
# @lineage = row ? row['full_lineage'] : ''
|
220
|
+
@common_name = row ? row['name'] : ''
|
221
|
+
@ncbi_taxa_id = row ? row['ncbi_taxon_id'] : ''
|
222
|
+
row ? [@lineage, @common_name, @ncbi_taxa_id] : []
|
223
|
+
end
|
238
224
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
225
|
+
def lineage
|
226
|
+
taxonomy unless @lineage
|
227
|
+
return @lineage
|
228
|
+
end
|
243
229
|
|
230
|
+
def common_name
|
231
|
+
taxonomy unless @common_name
|
232
|
+
return @common_name
|
233
|
+
end
|
244
234
|
|
245
|
-
|
235
|
+
def ncbi_taxa_id
|
236
|
+
taxonomy unless @ncbi_taxa_id
|
237
|
+
return @ncbi_taxa_id
|
238
|
+
end
|
246
239
|
|
247
|
-
def feature_key(k_id)
|
248
|
-
query = "select * from seqfeature_key where seqfeature_key_id = ?"
|
249
|
-
row = @dbh.execute(query, k_id).fetch
|
250
|
-
row ? row['key_name'] : ''
|
251
|
-
end
|
252
240
|
|
253
|
-
|
254
|
-
query = "select * from seqfeature_source where seqfeature_source_id = ?"
|
255
|
-
row = @dbh.execute(query, s_id).fetch
|
256
|
-
row ? row['source_name'] : ''
|
257
|
-
end
|
241
|
+
private
|
258
242
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
243
|
+
def feature_key(k_id)
|
244
|
+
query = "select * from term where term_id= ?"
|
245
|
+
row = @dbh.execute(query, k_id).fetch
|
246
|
+
row ? row['name'] : ''
|
247
|
+
end
|
264
248
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
249
|
+
def feature_source(s_id)
|
250
|
+
query = "select * from term where term_id = ?"
|
251
|
+
row = @dbh.execute(query, s_id).fetch
|
252
|
+
row ? row['name'] : ''
|
253
|
+
end
|
269
254
|
|
270
|
-
|
271
|
-
|
255
|
+
def feature_locations(f_id)
|
256
|
+
locations = []
|
257
|
+
query = "select * from location where seqfeature_id = ?"
|
258
|
+
@dbh.execute(query, f_id).fetch_all.each do |row|
|
259
|
+
next unless row
|
272
260
|
|
273
|
-
|
274
|
-
|
261
|
+
location = Bio::Location.new
|
262
|
+
location.strand = row['strand']
|
263
|
+
location.from = row['start_pos']
|
264
|
+
location.to = row['end_pos']
|
275
265
|
|
276
|
-
|
277
|
-
|
278
|
-
end
|
279
|
-
return Bio::Locations.new(locations)
|
280
|
-
end
|
266
|
+
xref = feature_locations_remote(row['dbxref_if'])
|
267
|
+
location.xref_id = xref.shift unless xref.empty?
|
281
268
|
|
282
|
-
|
283
|
-
|
284
|
-
row = @dbh.execute(query, l_id).fetch
|
285
|
-
row ? [row['accession'], row['version']] : []
|
286
|
-
end
|
269
|
+
# just omit fuzzy location for now...
|
270
|
+
#feature_locations_qv(row['seqfeature_location_id'])
|
287
271
|
|
288
|
-
|
289
|
-
|
290
|
-
row = @dbh.execute(query, l_id).fetch
|
291
|
-
row ? [row['qualifier_value'], row['slot_value']] : []
|
272
|
+
rank = row['rank'].to_i - 1
|
273
|
+
locations[rank] = location
|
292
274
|
end
|
275
|
+
return Bio::Locations.new(locations)
|
276
|
+
end
|
293
277
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
278
|
+
def feature_locations_remote(l_id)
|
279
|
+
query = "select * from dbxref where dbxref_id = ?"
|
280
|
+
row = @dbh.execute(query, l_id).fetch
|
281
|
+
row ? [row['accession'], row['version']] : []
|
282
|
+
end
|
299
283
|
|
300
|
-
|
301
|
-
|
302
|
-
|
284
|
+
def feature_locations_qv(l_id)
|
285
|
+
query = "select * from location_qualifier_value where location_id = ?"
|
286
|
+
row = @dbh.execute(query, l_id).fetch
|
287
|
+
row ? [row['value'], row['int_value']] : []
|
288
|
+
end
|
303
289
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
290
|
+
def feature_qualifiers(f_id)
|
291
|
+
qualifiers = []
|
292
|
+
query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
|
293
|
+
@dbh.execute(query, f_id).fetch_all.each do |row|
|
294
|
+
next unless row
|
309
295
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
296
|
+
key = feature_qualifiers_key(row['seqfeature_id'])
|
297
|
+
value = row['value']
|
298
|
+
qualifier = Bio::Feature::Qualifier.new(key, value)
|
299
|
+
|
300
|
+
rank = row['rank'].to_i - 1
|
301
|
+
qualifiers[rank] = qualifier
|
314
302
|
end
|
303
|
+
return qualifiers.compact # .compact is nasty hack for a while
|
315
304
|
end
|
316
305
|
|
306
|
+
def feature_qualifiers_key(q_id)
|
307
|
+
query = <<-END
|
308
|
+
select * from seqfeature_qualifier_value
|
309
|
+
join term using(term_id) where seqfeature_id = ?
|
310
|
+
END
|
311
|
+
row = @dbh.execute(query, q_id).fetch
|
312
|
+
row ? row['name'] : ''
|
313
|
+
end
|
317
314
|
end
|
318
315
|
|
319
|
-
end
|
316
|
+
end # SQL
|
317
|
+
|
318
|
+
end # Bio
|
320
319
|
|
321
320
|
|
322
321
|
if __FILE__ == $0
|
@@ -364,65 +363,3 @@ if __FILE__ == $0
|
|
364
363
|
|
365
364
|
end
|
366
365
|
|
367
|
-
|
368
|
-
=begin
|
369
|
-
|
370
|
-
= Bio::SQL
|
371
|
-
|
372
|
-
--- Bio::SQL.new(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
|
373
|
-
|
374
|
-
--- Bio::SQL.close
|
375
|
-
|
376
|
-
--- Bio::SQL#fetch(accession)
|
377
|
-
|
378
|
-
Returns Bio::SQL::Sequence object.
|
379
|
-
|
380
|
-
== Bio::SQL::Sequence
|
381
|
-
|
382
|
-
--- Bio::SQL::Sequence.new(dbh, entry)
|
383
|
-
|
384
|
-
--- Bio::SQL::Sequence#accession -> String
|
385
|
-
--- Bio::SQL::Sequence#comment -> String
|
386
|
-
|
387
|
-
Returns the first comment. For complete comments, use comments method.
|
388
|
-
|
389
|
-
--- Bio::SQL::Sequence#comments -> Array
|
390
|
-
|
391
|
-
Returns comments in an Array of Strings.
|
392
|
-
|
393
|
-
--- Bio::SQL::Sequence#common_name -> String
|
394
|
-
--- Bio::SQL::Sequence#database -> String
|
395
|
-
--- Bio::SQL::Sequence#date -> String
|
396
|
-
--- Bio::SQL::Sequence#dblink -> Array
|
397
|
-
--- Bio::SQL::Sequence#definition -> String
|
398
|
-
--- Bio::SQL::Sequence#division -> String
|
399
|
-
--- Bio::SQL::Sequence#entry_id -> String
|
400
|
-
|
401
|
-
--- Bio::SQL::Sequence#features
|
402
|
-
|
403
|
-
Returns Bio::Features object.
|
404
|
-
|
405
|
-
--- Bio::SQL::Sequence#keyword -> String
|
406
|
-
--- Bio::SQL::Sequence#lineage -> String
|
407
|
-
--- Bio::SQL::Sequence#ncbi_taxa_id -> String
|
408
|
-
|
409
|
-
--- Bio::SQL::Sequence#references -> Array
|
410
|
-
|
411
|
-
Returns reference informations in Array of Hash (not Bio::Reference).
|
412
|
-
|
413
|
-
--- Bio::SQL::Sequence#seq
|
414
|
-
|
415
|
-
Returns Bio::Sequence::NA or AA object.
|
416
|
-
|
417
|
-
--- Bio::SQL::Sequence#subseq(from, to)
|
418
|
-
|
419
|
-
Returns Bio::Sequence::NA or AA object (by lazy fetching).
|
420
|
-
|
421
|
-
--- Bio::SQL::Sequence#taxonomy -> DBI::Row
|
422
|
-
|
423
|
-
Use lineage, common_name, ncbi_taxa_id methods to extract in detail.
|
424
|
-
|
425
|
-
--- Bio::SQL::Sequence#version -> String
|
426
|
-
|
427
|
-
=end
|
428
|
-
|