bio 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/bioruby +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
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
#
|
|
2
2
|
# bio/util/color_scheme/turn.rb - Color codings for turn propensity
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# $Id: turn.rb,v 1.2 2005/12/13 14:58:07 trevor Exp $
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#--
|
|
11
|
-
#
|
|
12
|
-
# This library is free software; you can redistribute it and/or
|
|
13
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
14
|
-
# License as published by the Free Software Foundation; either
|
|
15
|
-
# version 2 of the License, or (at your option) any later version.
|
|
16
|
-
#
|
|
17
|
-
# This library is distributed in the hope that it will be useful,
|
|
18
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20
|
-
# Lesser General Public License for more details.
|
|
21
|
-
#
|
|
22
|
-
# You should have received a copy of the GNU Lesser General Public
|
|
23
|
-
# License along with this library; if not, write to the Free Software
|
|
24
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
25
|
-
#
|
|
26
|
-
#++
|
|
4
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
|
5
|
+
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
|
6
|
+
# License:: The Ruby License
|
|
27
7
|
#
|
|
8
|
+
# $Id: turn.rb,v 1.4 2007/04/05 23:35:41 trevor Exp $
|
|
28
9
|
#
|
|
29
10
|
|
|
30
11
|
require 'bio/util/color_scheme'
|
|
31
12
|
|
|
32
13
|
module Bio::ColorScheme
|
|
33
|
-
class Turn < Score
|
|
14
|
+
class Turn < Score #:nodoc:
|
|
34
15
|
|
|
35
16
|
#########
|
|
36
17
|
protected
|
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
#
|
|
2
2
|
# bio/util/color_scheme/zappo.rb - Zappo color codings for amino acids
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# $Id: zappo.rb,v 1.2 2005/12/13 14:58:07 trevor Exp $
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#--
|
|
11
|
-
#
|
|
12
|
-
# This library is free software; you can redistribute it and/or
|
|
13
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
14
|
-
# License as published by the Free Software Foundation; either
|
|
15
|
-
# version 2 of the License, or (at your option) any later version.
|
|
16
|
-
#
|
|
17
|
-
# This library is distributed in the hope that it will be useful,
|
|
18
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20
|
-
# Lesser General Public License for more details.
|
|
21
|
-
#
|
|
22
|
-
# You should have received a copy of the GNU Lesser General Public
|
|
23
|
-
# License along with this library; if not, write to the Free Software
|
|
24
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
25
|
-
#
|
|
26
|
-
#++
|
|
4
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
|
5
|
+
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
|
6
|
+
# License:: The Ruby License
|
|
27
7
|
#
|
|
8
|
+
# $Id: zappo.rb,v 1.4 2007/04/05 23:35:41 trevor Exp $
|
|
28
9
|
#
|
|
29
10
|
|
|
30
11
|
require 'bio/util/color_scheme'
|
|
31
12
|
|
|
32
13
|
module Bio::ColorScheme
|
|
33
|
-
class Zappo < Simple
|
|
14
|
+
class Zappo < Simple #:nodoc:
|
|
34
15
|
|
|
35
16
|
#########
|
|
36
17
|
protected
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
#
|
|
2
|
-
#
|
|
2
|
+
# bio/util/contingency_table.rb - Statistical contingency table analysis for aligned sequences
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
4
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
|
5
|
+
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
|
6
|
+
# License:: The Ruby License
|
|
6
7
|
#
|
|
7
|
-
# $Id: contingency_table.rb,v 1.
|
|
8
|
+
# $Id: contingency_table.rb,v 1.7 2007/04/05 23:35:41 trevor Exp $
|
|
8
9
|
#
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
module Bio #:nodoc:
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# bio/util/contingency_table.rb - Statistical contingency table analysis for aligned sequences
|
|
15
|
+
#
|
|
16
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
|
17
|
+
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
|
18
|
+
# License:: The Ruby License
|
|
19
|
+
#
|
|
20
|
+
# = Description
|
|
10
21
|
#
|
|
11
22
|
# The Bio::ContingencyTable class provides basic statistical contingency table
|
|
12
23
|
# analysis for two positions within aligned sequences.
|
|
@@ -33,19 +44,18 @@
|
|
|
33
44
|
# correlation.
|
|
34
45
|
#
|
|
35
46
|
#
|
|
36
|
-
#
|
|
47
|
+
# = Further Reading
|
|
37
48
|
#
|
|
38
49
|
# * http://en.wikipedia.org/wiki/Contingency_table
|
|
39
50
|
# * http://www.physics.csbsju.edu/stats/exact.details.html
|
|
40
51
|
# * Numerical Recipes in C by Press, Flannery, Teukolsky, and Vetterling
|
|
41
|
-
#
|
|
42
|
-
#
|
|
52
|
+
#
|
|
53
|
+
# = Usage
|
|
43
54
|
#
|
|
44
55
|
# What follows is an example of ContingencyTable in typical usage
|
|
45
56
|
# analyzing results from a clustal alignment.
|
|
46
57
|
#
|
|
47
58
|
# require 'bio'
|
|
48
|
-
# require 'bio/contingency_table'
|
|
49
59
|
#
|
|
50
60
|
# seqs = {}
|
|
51
61
|
# max_length = 0
|
|
@@ -78,9 +88,8 @@
|
|
|
78
88
|
# File.new('results.yml', 'a+') { |f| f.puts correlations.to_yaml }
|
|
79
89
|
#
|
|
80
90
|
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
|
|
91
|
+
# = Tutorial
|
|
92
|
+
#
|
|
84
93
|
# ContingencyTable returns the statistical significance of change
|
|
85
94
|
# between two positions in an alignment. If you would like to see how
|
|
86
95
|
# every possible combination of positions in your alignment compares
|
|
@@ -209,15 +218,13 @@
|
|
|
209
218
|
# with statistics, is to increase the sample size.
|
|
210
219
|
#
|
|
211
220
|
#
|
|
212
|
-
#
|
|
221
|
+
# = A Note on Efficiency
|
|
213
222
|
#
|
|
214
|
-
|
|
215
223
|
# ContingencyTable is slow. It involves many calculations for even a
|
|
216
224
|
# seemingly small five-string data set. Even worse, it's very
|
|
217
225
|
# dependent on matrix traversal, and this is done with two dimensional
|
|
218
226
|
# hashes which dashes any hope of decent speed.
|
|
219
227
|
#
|
|
220
|
-
|
|
221
228
|
# Finally, half of the matrix is redundant and positions could be
|
|
222
229
|
# summed with their companion position to reduce calculations. For
|
|
223
230
|
# example the positions (5,2) and (2,5) could both have their values
|
|
@@ -229,30 +236,8 @@
|
|
|
229
236
|
# is short and to the point in aims of achieving that purpose. If the
|
|
230
237
|
# BioRuby project moves towards C extensions in the future a
|
|
231
238
|
# professional caliber version will likely be created.
|
|
232
|
-
#
|
|
233
|
-
#
|
|
234
|
-
#--
|
|
235
|
-
#
|
|
236
|
-
# This library is free software; you can redistribute it and/or
|
|
237
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
238
|
-
# License as published by the Free Software Foundation; either
|
|
239
|
-
# version 2 of the License, or (at your option) any later version.
|
|
240
|
-
#
|
|
241
|
-
# This library is distributed in the hope that it will be useful,
|
|
242
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
243
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
244
|
-
# Lesser General Public License for more details.
|
|
245
239
|
#
|
|
246
|
-
|
|
247
|
-
# License along with this library; if not, write to the Free Software
|
|
248
|
-
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
249
|
-
#
|
|
250
|
-
#++
|
|
251
|
-
#
|
|
252
|
-
#
|
|
253
|
-
|
|
254
|
-
module Bio
|
|
255
|
-
|
|
240
|
+
|
|
256
241
|
class ContingencyTable
|
|
257
242
|
# Since we're making this math-notation friendly here is the layout of @table:
|
|
258
243
|
# * @table[row][column]
|
|
@@ -263,6 +248,11 @@ class ContingencyTable
|
|
|
263
248
|
|
|
264
249
|
# Create a ContingencyTable that has characters_in_sequence.size rows and
|
|
265
250
|
# characters_in_sequence.size columns for each row
|
|
251
|
+
#
|
|
252
|
+
# ---
|
|
253
|
+
# *Arguments*
|
|
254
|
+
# * +characters_in_sequences+: (_optional_) The allowable characters that will be present in the aligned sequences.
|
|
255
|
+
# *Returns*:: +ContingencyTable+ object to be filled with values and calculated upon
|
|
266
256
|
def initialize(characters_in_sequences = nil)
|
|
267
257
|
@characters = ( characters_in_sequences or %w{a c d e f g h i k l m n p q r s t v w y - x u} )
|
|
268
258
|
tmp = Hash[*@characters.collect { |v| [v, 0] }.flatten]
|
|
@@ -270,6 +260,11 @@ class ContingencyTable
|
|
|
270
260
|
end
|
|
271
261
|
|
|
272
262
|
# Report the sum of all values in a given row
|
|
263
|
+
#
|
|
264
|
+
# ---
|
|
265
|
+
# *Arguments*
|
|
266
|
+
# * +i+: Row to sum
|
|
267
|
+
# *Returns*:: +Integer+ sum of row
|
|
273
268
|
def row_sum(i)
|
|
274
269
|
total = 0
|
|
275
270
|
@table[i].each { |k, v| total += v }
|
|
@@ -277,6 +272,11 @@ class ContingencyTable
|
|
|
277
272
|
end
|
|
278
273
|
|
|
279
274
|
# Report the sum of all values in a given column
|
|
275
|
+
#
|
|
276
|
+
# ---
|
|
277
|
+
# *Arguments*
|
|
278
|
+
# * +j+: Column to sum
|
|
279
|
+
# *Returns*:: +Integer+ sum of column
|
|
280
280
|
def column_sum(j)
|
|
281
281
|
total = 0
|
|
282
282
|
@table.each { |row_key, column| total += column[j] }
|
|
@@ -287,6 +287,10 @@ class ContingencyTable
|
|
|
287
287
|
#
|
|
288
288
|
# * This is the same thing as asking for the sum of all values in the table.
|
|
289
289
|
#
|
|
290
|
+
# ---
|
|
291
|
+
# *Arguments*
|
|
292
|
+
# * _none_
|
|
293
|
+
# *Returns*:: +Integer+ sum of all columns
|
|
290
294
|
def column_sum_all
|
|
291
295
|
total = 0
|
|
292
296
|
@characters.each { |j| total += column_sum(j) }
|
|
@@ -297,6 +301,10 @@ class ContingencyTable
|
|
|
297
301
|
#
|
|
298
302
|
# * This is the same thing as asking for the sum of all values in the table.
|
|
299
303
|
#
|
|
304
|
+
# ---
|
|
305
|
+
# *Arguments*
|
|
306
|
+
# * _none_
|
|
307
|
+
# *Returns*:: +Integer+ sum of all rows
|
|
300
308
|
def row_sum_all
|
|
301
309
|
total = 0
|
|
302
310
|
@characters.each { |i| total += row_sum(i) }
|
|
@@ -304,14 +312,23 @@ class ContingencyTable
|
|
|
304
312
|
end
|
|
305
313
|
alias table_sum_all row_sum_all
|
|
306
314
|
|
|
315
|
+
# Calculate _e_, the _expected_ value.
|
|
307
316
|
#
|
|
308
|
-
#
|
|
309
|
-
#
|
|
317
|
+
# ---
|
|
318
|
+
# *Arguments*
|
|
319
|
+
# * +i+: row
|
|
320
|
+
# * +j+: column
|
|
321
|
+
# *Returns*:: +Float+ e(sub:ij) = (r(sub:i)/N) * (c(sub:j))
|
|
310
322
|
def expected(i, j)
|
|
311
323
|
(row_sum(i).to_f / table_sum_all) * column_sum(j)
|
|
312
324
|
end
|
|
313
325
|
|
|
314
326
|
# Report the chi square of the entire table
|
|
327
|
+
#
|
|
328
|
+
# ---
|
|
329
|
+
# *Arguments*
|
|
330
|
+
# * _none_
|
|
331
|
+
# *Returns*:: +Float+ chi square value
|
|
315
332
|
def chi_square
|
|
316
333
|
total = 0
|
|
317
334
|
c = @characters
|
|
@@ -324,7 +341,13 @@ class ContingencyTable
|
|
|
324
341
|
total
|
|
325
342
|
end
|
|
326
343
|
|
|
327
|
-
# Report the chi
|
|
344
|
+
# Report the chi-square relation of two elements in the table
|
|
345
|
+
#
|
|
346
|
+
# ---
|
|
347
|
+
# *Arguments*
|
|
348
|
+
# * +i+: row
|
|
349
|
+
# * +j+: column
|
|
350
|
+
# *Returns*:: +Float+ chi-square of an intersection
|
|
328
351
|
def chi_square_element(i, j)
|
|
329
352
|
eij = expected(i, j)
|
|
330
353
|
return 0 if eij == 0
|
|
@@ -332,12 +355,16 @@ class ContingencyTable
|
|
|
332
355
|
end
|
|
333
356
|
|
|
334
357
|
# Report the contingency coefficient of the table
|
|
358
|
+
#
|
|
359
|
+
# ---
|
|
360
|
+
# *Arguments*
|
|
361
|
+
# * _none_
|
|
362
|
+
# *Returns*:: +Float+ contingency_coefficient of the table
|
|
335
363
|
def contingency_coefficient
|
|
336
364
|
c_s = chi_square
|
|
337
365
|
Math.sqrt(c_s / (table_sum_all + c_s) )
|
|
338
366
|
end
|
|
339
367
|
|
|
340
|
-
end
|
|
341
|
-
|
|
368
|
+
end # ContingencyTable
|
|
342
369
|
end # Bio
|
|
343
370
|
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#
|
|
2
|
+
# bio/util/restriction_enzyme.rb - Digests DNA based on restriction enzyme cut patterns
|
|
3
|
+
#
|
|
4
|
+
# Author:: Trevor Wennblom <mailto:trevor@corevx.com>
|
|
5
|
+
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
|
|
6
|
+
# License:: The Ruby License
|
|
7
|
+
#
|
|
8
|
+
# $Id: restriction_enzyme.rb,v 1.16 2007/07/16 19:28:48 k Exp $
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
module Bio #:nodoc:
|
|
12
|
+
|
|
13
|
+
autoload :REBASE, 'bio/db/rebase'
|
|
14
|
+
|
|
15
|
+
# = Description
|
|
16
|
+
#
|
|
17
|
+
# Bio::RestrictionEnzyme allows you to fragment a DNA strand using one
|
|
18
|
+
# or more restriction enzymes. Bio::RestrictionEnzyme is aware that
|
|
19
|
+
# multiple enzymes may be competing for the same recognition site and
|
|
20
|
+
# returns the various possible fragmentation patterns that result in
|
|
21
|
+
# such circumstances.
|
|
22
|
+
#
|
|
23
|
+
# When using Bio::RestrictionEnzyme you may simply use the name of common
|
|
24
|
+
# enzymes to cut your sequence or you may construct your own unique enzymes
|
|
25
|
+
# to use.
|
|
26
|
+
#
|
|
27
|
+
# Visit the documentaion for individual classes for more information.
|
|
28
|
+
#
|
|
29
|
+
# An examination of the unit tests will also reveal several interesting uses
|
|
30
|
+
# for the curious programmer.
|
|
31
|
+
#
|
|
32
|
+
# = Usage
|
|
33
|
+
#
|
|
34
|
+
# == Basic
|
|
35
|
+
#
|
|
36
|
+
# EcoRI cut pattern:
|
|
37
|
+
# G|A A T T C
|
|
38
|
+
# +-------+
|
|
39
|
+
# C T T A A|G
|
|
40
|
+
#
|
|
41
|
+
# This can also be written as:
|
|
42
|
+
# G^AATTC
|
|
43
|
+
#
|
|
44
|
+
# Note that to use the method +cut_with_enzyme+ from a Bio::Sequence object
|
|
45
|
+
# you currently must +require+ +bio/util/restriction_enzyme+ directly. If
|
|
46
|
+
# instead you're going to directly call Bio::RestrictionEnzyme::Analysis
|
|
47
|
+
# then only +bio+ needs to be +required+.
|
|
48
|
+
#
|
|
49
|
+
# require 'bio'
|
|
50
|
+
# require 'bio/util/restriction_enzyme'
|
|
51
|
+
#
|
|
52
|
+
# seq = Bio::Sequence::NA.new('gaattc')
|
|
53
|
+
# cuts = seq.cut_with_enzyme('EcoRI')
|
|
54
|
+
# cuts.primary # => ["aattc", "g"]
|
|
55
|
+
# cuts.complement # => ["cttaa", "g"]
|
|
56
|
+
# cuts.inspect # => "[#<struct Bio::RestrictionEnzyme::Fragment primary=\"g \", complement=\"cttaa\">, #<struct Bio::RestrictionEnzyme::Fragment primary=\"aattc\", complement=\" g\">]"
|
|
57
|
+
#
|
|
58
|
+
# seq = Bio::Sequence::NA.new('gaattc')
|
|
59
|
+
# cuts = seq.cut_with_enzyme('g^aattc')
|
|
60
|
+
# cuts.primary # => ["aattc", "g"]
|
|
61
|
+
# cuts.complement # => ["cttaa", "g"]
|
|
62
|
+
#
|
|
63
|
+
# seq = Bio::Sequence::NA.new('gaattc')
|
|
64
|
+
# cuts = seq.cut_with_enzyme('g^aattc', 'gaatt^c')
|
|
65
|
+
# cuts.primary # => ["aattc", "c", "g", "gaatt"]
|
|
66
|
+
# cuts.complement # => ["c", "cttaa", "g", "ttaag"]
|
|
67
|
+
#
|
|
68
|
+
# seq = Bio::Sequence::NA.new('gaattcgaattc')
|
|
69
|
+
# cuts = seq.cut_with_enzyme('EcoRI')
|
|
70
|
+
# cuts.primary # => ["aattc", "aattcg", "g"]
|
|
71
|
+
# cuts.complement # => ["cttaa", "g", "gcttaa"]
|
|
72
|
+
#
|
|
73
|
+
# seq = Bio::Sequence::NA.new('gaattcgggaattc')
|
|
74
|
+
# cuts = seq.cut_with_enzyme('EcoRI')
|
|
75
|
+
# cuts.primary # => ["aattc", "aattcggg", "g"]
|
|
76
|
+
# cuts.complement # => ["cttaa", "g", "gcccttaa"]
|
|
77
|
+
#
|
|
78
|
+
# cuts[0].inspect # => "#<struct Bio::RestrictionEnzyme::Fragment primary=\"g \", complement=\"cttaa\">"
|
|
79
|
+
#
|
|
80
|
+
# cuts[0].primary # => "g "
|
|
81
|
+
# cuts[0].complement # => "cttaa"
|
|
82
|
+
#
|
|
83
|
+
# cuts[1].primary # => "aattcggg "
|
|
84
|
+
# cuts[1].complement # => " gcccttaa"
|
|
85
|
+
#
|
|
86
|
+
# cuts[2].primary # => "aattc"
|
|
87
|
+
# cuts[2].complement # => " g"
|
|
88
|
+
#
|
|
89
|
+
# == Advanced
|
|
90
|
+
#
|
|
91
|
+
# require 'bio'
|
|
92
|
+
#
|
|
93
|
+
# enzyme_1 = Bio::RestrictionEnzyme.new('anna', [1,1], [3,3])
|
|
94
|
+
# enzyme_2 = Bio::RestrictionEnzyme.new('gg', [1,1])
|
|
95
|
+
# a = Bio::RestrictionEnzyme::Analysis.cut('agga', enzyme_1, enzyme_2)
|
|
96
|
+
# a.primary # => ["a", "ag", "g", "ga"]
|
|
97
|
+
# a.complement # => ["c", "ct", "t", "tc"]
|
|
98
|
+
#
|
|
99
|
+
# a[0].primary # => "ag"
|
|
100
|
+
# a[0].complement # => "tc"
|
|
101
|
+
#
|
|
102
|
+
# a[1].primary # => "ga"
|
|
103
|
+
# a[1].complement # => "ct"
|
|
104
|
+
#
|
|
105
|
+
# a[2].primary # => "a"
|
|
106
|
+
# a[2].complement # => "t"
|
|
107
|
+
#
|
|
108
|
+
# a[3].primary # => "g"
|
|
109
|
+
# a[3].complement # => "c"
|
|
110
|
+
#
|
|
111
|
+
# = Todo / under development
|
|
112
|
+
#
|
|
113
|
+
# * Circular DNA cutting
|
|
114
|
+
#
|
|
115
|
+
|
|
116
|
+
class RestrictionEnzyme
|
|
117
|
+
|
|
118
|
+
#require 'bio/util/restriction_enzyme/cut_symbol'
|
|
119
|
+
|
|
120
|
+
autoload :CutSymbol, 'bio/util/restriction_enzyme/cut_symbol'
|
|
121
|
+
autoload :StringFormatting, 'bio/util/restriction_enzyme/string_formatting'
|
|
122
|
+
autoload :SingleStrand, 'bio/util/restriction_enzyme/single_strand'
|
|
123
|
+
autoload :SingleStrandComplement, 'bio/util/restriction_enzyme/single_strand_complement'
|
|
124
|
+
autoload :DoubleStranded, 'bio/util/restriction_enzyme/double_stranded'
|
|
125
|
+
autoload :Analysis, 'bio/util/restriction_enzyme/analysis'
|
|
126
|
+
autoload :Range, 'bio/util/restriction_enzyme/range/sequence_range'
|
|
127
|
+
|
|
128
|
+
include CutSymbol
|
|
129
|
+
extend CutSymbol
|
|
130
|
+
|
|
131
|
+
# See Bio::RestrictionEnzyme::DoubleStranded.new for more information.
|
|
132
|
+
#
|
|
133
|
+
# ---
|
|
134
|
+
# *Arguments*
|
|
135
|
+
# * +users_enzyme_or_rebase_or_pattern+: One of three possible parameters: The name of an enzyme, a REBASE::EnzymeEntry object, or a nucleotide pattern with a cut mark.
|
|
136
|
+
# * +cut_locations+: The cut locations in enzyme index notation.
|
|
137
|
+
# *Returns*:: Bio::RestrictionEnzyme::DoubleStranded
|
|
138
|
+
#--
|
|
139
|
+
# Factory for DoubleStranded
|
|
140
|
+
#++
|
|
141
|
+
def self.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
|
|
142
|
+
DoubleStranded.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# REBASE enzyme data information
|
|
146
|
+
#
|
|
147
|
+
# Returns a Bio::REBASE object loaded with all of the enzyme data on file.
|
|
148
|
+
#
|
|
149
|
+
# ---
|
|
150
|
+
# *Arguments*
|
|
151
|
+
# * _none_
|
|
152
|
+
# *Returns*:: Bio::REBASE
|
|
153
|
+
def self.rebase
|
|
154
|
+
enzymes_yaml_file = File.join(File.dirname(File.expand_path(__FILE__)), 'restriction_enzyme', 'enzymes.yaml')
|
|
155
|
+
@@rebase_enzymes ||= Bio::REBASE.load_yaml(enzymes_yaml_file)
|
|
156
|
+
@@rebase_enzymes
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Check if supplied name is the name of an available enzyme
|
|
160
|
+
#
|
|
161
|
+
# See Bio::REBASE.enzyme_name?
|
|
162
|
+
#
|
|
163
|
+
# ---
|
|
164
|
+
# *Arguments*
|
|
165
|
+
# * +name+: Enzyme name
|
|
166
|
+
# *Returns*:: +true+ _or_ +false+
|
|
167
|
+
def self.enzyme_name?( name )
|
|
168
|
+
self.rebase.enzyme_name?(name)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# See Bio::RestrictionEnzyme::Analysis.cut
|
|
172
|
+
def self.cut( sequence, enzymes )
|
|
173
|
+
Bio::RestrictionEnzyme::Analysis.cut( sequence, enzymes )
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# A Bio::RestrictionEnzyme::Fragment is a DNA fragment composed of fused primary and
|
|
177
|
+
# complementary strands that would be found floating in solution after a full
|
|
178
|
+
# sequence is digested by one or more RestrictionEnzymes.
|
|
179
|
+
#
|
|
180
|
+
# You will notice that either the primary or complement strand will be
|
|
181
|
+
# padded with spaces to make them line up according to the original DNA
|
|
182
|
+
# configuration before they were cut.
|
|
183
|
+
#
|
|
184
|
+
# Example:
|
|
185
|
+
#
|
|
186
|
+
# Fragment 1:
|
|
187
|
+
# primary = "attaca"
|
|
188
|
+
# complement = " atga"
|
|
189
|
+
#
|
|
190
|
+
# Fragment 2:
|
|
191
|
+
# primary = "g "
|
|
192
|
+
# complement = "cta"
|
|
193
|
+
#
|
|
194
|
+
# View these with the +primary+ and +complement+ methods.
|
|
195
|
+
#
|
|
196
|
+
# Bio::RestrictionEnzyme::Fragment is a simple +Struct+ object.
|
|
197
|
+
#
|
|
198
|
+
# Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment
|
|
199
|
+
Fragment = Struct.new(:primary, :complement, :p_left, :p_right, :c_left, :c_right)
|
|
200
|
+
|
|
201
|
+
# Bio::RestrictionEnzyme::Fragments inherits from +Array+.
|
|
202
|
+
#
|
|
203
|
+
# Bio::RestrictionEnzyme::Fragments is a container for Fragment objects. It adds the
|
|
204
|
+
# methods +primary+ and +complement+ which returns an +Array+ of all
|
|
205
|
+
# respective strands from it's Fragment members in alphabetically sorted
|
|
206
|
+
# order. Note that it will
|
|
207
|
+
# not return duplicate items and does not return the spacing/padding
|
|
208
|
+
# that you would
|
|
209
|
+
# find by accessing the members directly.
|
|
210
|
+
#
|
|
211
|
+
# Example:
|
|
212
|
+
#
|
|
213
|
+
# primary = ['attaca', 'g']
|
|
214
|
+
# complement = ['atga', 'cta']
|
|
215
|
+
#
|
|
216
|
+
# Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments
|
|
217
|
+
class Fragments < Array
|
|
218
|
+
def primary; strip_and_sort(:primary); end
|
|
219
|
+
def complement; strip_and_sort(:complement); end
|
|
220
|
+
|
|
221
|
+
protected
|
|
222
|
+
|
|
223
|
+
def strip_and_sort( sym_strand )
|
|
224
|
+
self.map {|uf| uf.send( sym_strand ).tr(' ', '') }.sort
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end # RestrictionEnzyme
|
|
228
|
+
end # Bio
|