bio-restriction_enzyme 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/COPYING.txt +121 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +7 -0
- data/README.rdoc +22 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bio-restriction_enzyme.gemspec +99 -0
- data/lib/bio-restriction_enzyme.rb +1 -0
- data/lib/bio/util/restriction_enzyme.rb +218 -0
- data/lib/bio/util/restriction_enzyme/analysis.rb +241 -0
- data/lib/bio/util/restriction_enzyme/analysis_basic.rb +209 -0
- data/lib/bio/util/restriction_enzyme/cut_symbol.rb +99 -0
- data/lib/bio/util/restriction_enzyme/double_stranded.rb +313 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +127 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +95 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +30 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +68 -0
- data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +99 -0
- data/lib/bio/util/restriction_enzyme/range/cut_range.rb +16 -0
- data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +39 -0
- data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +59 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +249 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +236 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +43 -0
- data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +33 -0
- data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +69 -0
- data/lib/bio/util/restriction_enzyme/single_strand.rb +193 -0
- data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +127 -0
- data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +15 -0
- data/lib/bio/util/restriction_enzyme/string_formatting.rb +103 -0
- data/test/bio-restriction_enzyme/analysis/test_calculated_cuts.rb +281 -0
- data/test/bio-restriction_enzyme/analysis/test_cut_ranges.rb +87 -0
- data/test/bio-restriction_enzyme/analysis/test_sequence_range.rb +223 -0
- data/test/bio-restriction_enzyme/double_stranded/test_aligned_strands.rb +84 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_location_pair.rb +58 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +56 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_locations.rb +35 -0
- data/test/bio-restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +87 -0
- data/test/bio-restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +66 -0
- data/test/bio-restriction_enzyme/test_analysis.rb +228 -0
- data/test/bio-restriction_enzyme/test_cut_symbol.rb +27 -0
- data/test/bio-restriction_enzyme/test_double_stranded.rb +98 -0
- data/test/bio-restriction_enzyme/test_single_strand.rb +131 -0
- data/test/bio-restriction_enzyme/test_single_strand_complement.rb +131 -0
- data/test/bio-restriction_enzyme/test_string_formatting.rb +43 -0
- data/test/helper.rb +17 -0
- data/test/test_bio-restriction_enzyme.rb +21 -0
- metadata +153 -0
data/.document
ADDED
data/COPYING.txt
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
Creative Commons Legal Code
|
2
|
+
|
3
|
+
CC0 1.0 Universal
|
4
|
+
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
12
|
+
HEREUNDER.
|
13
|
+
|
14
|
+
Statement of Purpose
|
15
|
+
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
19
|
+
authorship and/or a database (each, a "Work").
|
20
|
+
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
28
|
+
culture and the further production of creative, cultural and scientific
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
30
|
+
part through the use and efforts of others.
|
31
|
+
|
32
|
+
For these and/or other purposes and motivations, and without any
|
33
|
+
expectation of additional consideration or compensation, the person
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
39
|
+
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
43
|
+
limited to, the following:
|
44
|
+
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
46
|
+
communicate, and translate a Work;
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
49
|
+
likeness depicted in a Work;
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
53
|
+
in a Work;
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
56
|
+
protection of databases, and under any national implementation
|
57
|
+
thereof, including any amended or successor version of such
|
58
|
+
directive); and
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
60
|
+
world based on applicable law or treaty, and any national
|
61
|
+
implementations thereof.
|
62
|
+
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
72
|
+
including without limitation commercial, advertising or promotional
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
79
|
+
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
100
|
+
express Statement of Purpose.
|
101
|
+
|
102
|
+
4. Limitations and Disclaimers.
|
103
|
+
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
112
|
+
the greatest extent permissible under applicable law.
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
114
|
+
that may apply to the Work or any use thereof, including without
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
117
|
+
consents, permissions or other rights required for any use of the
|
118
|
+
Work.
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
120
|
+
party to this document and has no duty or obligation with respect to
|
121
|
+
this CC0 or use of the Work.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Bio::RestrictionEnzyme
|
2
|
+
|
3
|
+
Written in 2005-2011 by Trevor Wennblom <trevor@well.com>
|
4
|
+
|
5
|
+
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
|
6
|
+
|
7
|
+
You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= bio-restriction_enzyme
|
2
|
+
|
3
|
+
Bio::RestrictionEnzyme
|
4
|
+
|
5
|
+
Digests DNA based on restriction enzyme cut patterns
|
6
|
+
|
7
|
+
|
8
|
+
== notes
|
9
|
+
|
10
|
+
Re-implementation of Bio::RestrictionEnzyme as a BioGem.
|
11
|
+
|
12
|
+
This BioGem does not include changes found in BioRuby 1.4.2. These will be added if resubmitted under a compatible license.
|
13
|
+
|
14
|
+
|
15
|
+
== contribution
|
16
|
+
|
17
|
+
Improvements encouraged, send pull requests.
|
18
|
+
|
19
|
+
|
20
|
+
== license
|
21
|
+
|
22
|
+
CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = 'bio-restriction_enzyme'
|
18
|
+
gem.homepage = 'http://github.com/trevor/bioruby-restriction_enzyme'
|
19
|
+
gem.license = 'CC0'
|
20
|
+
gem.summary = %Q{Digests DNA based on restriction enzyme cut patterns}
|
21
|
+
gem.description = %Q{Digests DNA based on restriction enzyme cut patterns}
|
22
|
+
gem.email = 'trevor@well.com'
|
23
|
+
gem.authors = ['Trevor Wennblom']
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "bio-restriction_enzyme #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "bio-restriction_enzyme"
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Trevor Wennblom"]
|
12
|
+
s.date = "2011-09-10"
|
13
|
+
s.description = "Digests DNA based on restriction enzyme cut patterns"
|
14
|
+
s.email = "trevor@well.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"COPYING.txt",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bio-restriction_enzyme.gemspec",
|
28
|
+
"lib/bio-restriction_enzyme.rb",
|
29
|
+
"lib/bio/util/restriction_enzyme.rb",
|
30
|
+
"lib/bio/util/restriction_enzyme/analysis.rb",
|
31
|
+
"lib/bio/util/restriction_enzyme/analysis_basic.rb",
|
32
|
+
"lib/bio/util/restriction_enzyme/cut_symbol.rb",
|
33
|
+
"lib/bio/util/restriction_enzyme/double_stranded.rb",
|
34
|
+
"lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb",
|
35
|
+
"lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb",
|
36
|
+
"lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb",
|
37
|
+
"lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb",
|
38
|
+
"lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb",
|
39
|
+
"lib/bio/util/restriction_enzyme/range/cut_range.rb",
|
40
|
+
"lib/bio/util/restriction_enzyme/range/cut_ranges.rb",
|
41
|
+
"lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb",
|
42
|
+
"lib/bio/util/restriction_enzyme/range/sequence_range.rb",
|
43
|
+
"lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb",
|
44
|
+
"lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb",
|
45
|
+
"lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb",
|
46
|
+
"lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb",
|
47
|
+
"lib/bio/util/restriction_enzyme/single_strand.rb",
|
48
|
+
"lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb",
|
49
|
+
"lib/bio/util/restriction_enzyme/single_strand_complement.rb",
|
50
|
+
"lib/bio/util/restriction_enzyme/string_formatting.rb",
|
51
|
+
"test/bio-restriction_enzyme/analysis/test_calculated_cuts.rb",
|
52
|
+
"test/bio-restriction_enzyme/analysis/test_cut_ranges.rb",
|
53
|
+
"test/bio-restriction_enzyme/analysis/test_sequence_range.rb",
|
54
|
+
"test/bio-restriction_enzyme/double_stranded/test_aligned_strands.rb",
|
55
|
+
"test/bio-restriction_enzyme/double_stranded/test_cut_location_pair.rb",
|
56
|
+
"test/bio-restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb",
|
57
|
+
"test/bio-restriction_enzyme/double_stranded/test_cut_locations.rb",
|
58
|
+
"test/bio-restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb",
|
59
|
+
"test/bio-restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb",
|
60
|
+
"test/bio-restriction_enzyme/test_analysis.rb",
|
61
|
+
"test/bio-restriction_enzyme/test_cut_symbol.rb",
|
62
|
+
"test/bio-restriction_enzyme/test_double_stranded.rb",
|
63
|
+
"test/bio-restriction_enzyme/test_single_strand.rb",
|
64
|
+
"test/bio-restriction_enzyme/test_single_strand_complement.rb",
|
65
|
+
"test/bio-restriction_enzyme/test_string_formatting.rb",
|
66
|
+
"test/helper.rb",
|
67
|
+
"test/test_bio-restriction_enzyme.rb"
|
68
|
+
]
|
69
|
+
s.homepage = "http://github.com/trevor/bioruby-restriction_enzyme"
|
70
|
+
s.licenses = ["CC0"]
|
71
|
+
s.require_paths = ["lib"]
|
72
|
+
s.rubygems_version = "1.8.10"
|
73
|
+
s.summary = "Digests DNA based on restriction enzyme cut patterns"
|
74
|
+
|
75
|
+
if s.respond_to? :specification_version then
|
76
|
+
s.specification_version = 3
|
77
|
+
|
78
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
79
|
+
s.add_runtime_dependency(%q<bio-data-restriction_enzyme>, [">= 0"])
|
80
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
81
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
82
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
83
|
+
s.add_development_dependency(%q<bio>, [">= 1.4.1"])
|
84
|
+
else
|
85
|
+
s.add_dependency(%q<bio-data-restriction_enzyme>, [">= 0"])
|
86
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
87
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
88
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
89
|
+
s.add_dependency(%q<bio>, [">= 1.4.1"])
|
90
|
+
end
|
91
|
+
else
|
92
|
+
s.add_dependency(%q<bio-data-restriction_enzyme>, [">= 0"])
|
93
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
94
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
95
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
96
|
+
s.add_dependency(%q<bio>, [">= 1.4.1"])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'bio/util/restriction_enzyme'
|
@@ -0,0 +1,218 @@
|
|
1
|
+
module Bio
|
2
|
+
|
3
|
+
autoload :REBASE, 'bio/db/rebase'
|
4
|
+
|
5
|
+
# = Description
|
6
|
+
#
|
7
|
+
# Bio::RestrictionEnzyme allows you to fragment a DNA strand using one
|
8
|
+
# or more restriction enzymes. Bio::RestrictionEnzyme is aware that
|
9
|
+
# multiple enzymes may be competing for the same recognition site and
|
10
|
+
# returns the various possible fragmentation patterns that result in
|
11
|
+
# such circumstances.
|
12
|
+
#
|
13
|
+
# When using Bio::RestrictionEnzyme you may simply use the name of common
|
14
|
+
# enzymes to cut your sequence or you may construct your own unique enzymes
|
15
|
+
# to use.
|
16
|
+
#
|
17
|
+
# Visit the documentaion for individual classes for more information.
|
18
|
+
#
|
19
|
+
# An examination of the unit tests will also reveal several interesting uses
|
20
|
+
# for the curious programmer.
|
21
|
+
#
|
22
|
+
# = Usage
|
23
|
+
#
|
24
|
+
# == Basic
|
25
|
+
#
|
26
|
+
# EcoRI cut pattern:
|
27
|
+
# G|A A T T C
|
28
|
+
# +-------+
|
29
|
+
# C T T A A|G
|
30
|
+
#
|
31
|
+
# This can also be written as:
|
32
|
+
# G^AATTC
|
33
|
+
#
|
34
|
+
# Note that to use the method +cut_with_enzyme+ from a Bio::Sequence object
|
35
|
+
# you currently must +require+ +bio/util/restriction_enzyme+ directly. If
|
36
|
+
# instead you're going to directly call Bio::RestrictionEnzyme::Analysis
|
37
|
+
# then only +bio+ needs to be +required+.
|
38
|
+
#
|
39
|
+
# require 'bio'
|
40
|
+
# require 'bio/util/restriction_enzyme'
|
41
|
+
#
|
42
|
+
# seq = Bio::Sequence::NA.new('gaattc')
|
43
|
+
# cuts = seq.cut_with_enzyme('EcoRI')
|
44
|
+
# cuts.primary # => ["aattc", "g"]
|
45
|
+
# cuts.complement # => ["cttaa", "g"]
|
46
|
+
# cuts.inspect # => "[#<struct Bio::RestrictionEnzyme::Fragment primary=\"g \", complement=\"cttaa\">, #<struct Bio::RestrictionEnzyme::Fragment primary=\"aattc\", complement=\" g\">]"
|
47
|
+
#
|
48
|
+
# seq = Bio::Sequence::NA.new('gaattc')
|
49
|
+
# cuts = seq.cut_with_enzyme('g^aattc')
|
50
|
+
# cuts.primary # => ["aattc", "g"]
|
51
|
+
# cuts.complement # => ["cttaa", "g"]
|
52
|
+
#
|
53
|
+
# seq = Bio::Sequence::NA.new('gaattc')
|
54
|
+
# cuts = seq.cut_with_enzyme('g^aattc', 'gaatt^c')
|
55
|
+
# cuts.primary # => ["aattc", "c", "g", "gaatt"]
|
56
|
+
# cuts.complement # => ["c", "cttaa", "g", "ttaag"]
|
57
|
+
#
|
58
|
+
# seq = Bio::Sequence::NA.new('gaattcgaattc')
|
59
|
+
# cuts = seq.cut_with_enzyme('EcoRI')
|
60
|
+
# cuts.primary # => ["aattc", "aattcg", "g"]
|
61
|
+
# cuts.complement # => ["cttaa", "g", "gcttaa"]
|
62
|
+
#
|
63
|
+
# seq = Bio::Sequence::NA.new('gaattcgggaattc')
|
64
|
+
# cuts = seq.cut_with_enzyme('EcoRI')
|
65
|
+
# cuts.primary # => ["aattc", "aattcggg", "g"]
|
66
|
+
# cuts.complement # => ["cttaa", "g", "gcccttaa"]
|
67
|
+
#
|
68
|
+
# cuts[0].inspect # => "#<struct Bio::RestrictionEnzyme::Fragment primary=\"g \", complement=\"cttaa\">"
|
69
|
+
#
|
70
|
+
# cuts[0].primary # => "g "
|
71
|
+
# cuts[0].complement # => "cttaa"
|
72
|
+
#
|
73
|
+
# cuts[1].primary # => "aattcggg "
|
74
|
+
# cuts[1].complement # => " gcccttaa"
|
75
|
+
#
|
76
|
+
# cuts[2].primary # => "aattc"
|
77
|
+
# cuts[2].complement # => " g"
|
78
|
+
#
|
79
|
+
# == Advanced
|
80
|
+
#
|
81
|
+
# require 'bio'
|
82
|
+
#
|
83
|
+
# enzyme_1 = Bio::RestrictionEnzyme.new('anna', [1,1], [3,3])
|
84
|
+
# enzyme_2 = Bio::RestrictionEnzyme.new('gg', [1,1])
|
85
|
+
# a = Bio::RestrictionEnzyme::Analysis.cut('agga', enzyme_1, enzyme_2)
|
86
|
+
# a.primary # => ["a", "ag", "g", "ga"]
|
87
|
+
# a.complement # => ["c", "ct", "t", "tc"]
|
88
|
+
#
|
89
|
+
# a[0].primary # => "ag"
|
90
|
+
# a[0].complement # => "tc"
|
91
|
+
#
|
92
|
+
# a[1].primary # => "ga"
|
93
|
+
# a[1].complement # => "ct"
|
94
|
+
#
|
95
|
+
# a[2].primary # => "a"
|
96
|
+
# a[2].complement # => "t"
|
97
|
+
#
|
98
|
+
# a[3].primary # => "g"
|
99
|
+
# a[3].complement # => "c"
|
100
|
+
#
|
101
|
+
# = Todo / under development
|
102
|
+
#
|
103
|
+
# * Circular DNA cutting
|
104
|
+
#
|
105
|
+
|
106
|
+
class RestrictionEnzyme
|
107
|
+
|
108
|
+
#require 'bio/util/restriction_enzyme/cut_symbol'
|
109
|
+
|
110
|
+
autoload :CutSymbol, 'bio/util/restriction_enzyme/cut_symbol'
|
111
|
+
autoload :StringFormatting, 'bio/util/restriction_enzyme/string_formatting'
|
112
|
+
autoload :SingleStrand, 'bio/util/restriction_enzyme/single_strand'
|
113
|
+
autoload :SingleStrandComplement, 'bio/util/restriction_enzyme/single_strand_complement'
|
114
|
+
autoload :DoubleStranded, 'bio/util/restriction_enzyme/double_stranded'
|
115
|
+
autoload :Analysis, 'bio/util/restriction_enzyme/analysis'
|
116
|
+
autoload :Range, 'bio/util/restriction_enzyme/range/sequence_range'
|
117
|
+
|
118
|
+
include CutSymbol
|
119
|
+
extend CutSymbol
|
120
|
+
|
121
|
+
# See Bio::RestrictionEnzyme::DoubleStranded.new for more information.
|
122
|
+
#
|
123
|
+
# ---
|
124
|
+
# *Arguments*
|
125
|
+
# * +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.
|
126
|
+
# * +cut_locations+: The cut locations in enzyme index notation.
|
127
|
+
# *Returns*:: Bio::RestrictionEnzyme::DoubleStranded
|
128
|
+
#--
|
129
|
+
# Factory for DoubleStranded
|
130
|
+
#++
|
131
|
+
def self.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
|
132
|
+
DoubleStranded.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
|
133
|
+
end
|
134
|
+
|
135
|
+
# REBASE enzyme data information
|
136
|
+
#
|
137
|
+
# Returns a Bio::REBASE object loaded with all of the enzyme data on file.
|
138
|
+
#
|
139
|
+
# ---
|
140
|
+
# *Arguments*
|
141
|
+
# * _none_
|
142
|
+
# *Returns*:: Bio::REBASE
|
143
|
+
def self.rebase
|
144
|
+
enzymes_yaml_file = File.join(File.dirname(File.expand_path(__FILE__)), '..', 'data', 'enzymes.yaml')
|
145
|
+
@@rebase_enzymes ||= Bio::REBASE.load_yaml(enzymes_yaml_file)
|
146
|
+
@@rebase_enzymes
|
147
|
+
end
|
148
|
+
|
149
|
+
# Check if supplied name is the name of an available enzyme
|
150
|
+
#
|
151
|
+
# See Bio::REBASE.enzyme_name?
|
152
|
+
#
|
153
|
+
# ---
|
154
|
+
# *Arguments*
|
155
|
+
# * +name+: Enzyme name
|
156
|
+
# *Returns*:: +true+ _or_ +false+
|
157
|
+
def self.enzyme_name?( name )
|
158
|
+
self.rebase.enzyme_name?(name)
|
159
|
+
end
|
160
|
+
|
161
|
+
# See Bio::RestrictionEnzyme::Analysis.cut
|
162
|
+
def self.cut( sequence, enzymes )
|
163
|
+
Bio::RestrictionEnzyme::Analysis.cut( sequence, enzymes )
|
164
|
+
end
|
165
|
+
|
166
|
+
# A Bio::RestrictionEnzyme::Fragment is a DNA fragment composed of fused primary and
|
167
|
+
# complementary strands that would be found floating in solution after a full
|
168
|
+
# sequence is digested by one or more RestrictionEnzymes.
|
169
|
+
#
|
170
|
+
# You will notice that either the primary or complement strand will be
|
171
|
+
# padded with spaces to make them line up according to the original DNA
|
172
|
+
# configuration before they were cut.
|
173
|
+
#
|
174
|
+
# Example:
|
175
|
+
#
|
176
|
+
# Fragment 1:
|
177
|
+
# primary = "attaca"
|
178
|
+
# complement = " atga"
|
179
|
+
#
|
180
|
+
# Fragment 2:
|
181
|
+
# primary = "g "
|
182
|
+
# complement = "cta"
|
183
|
+
#
|
184
|
+
# View these with the +primary+ and +complement+ methods.
|
185
|
+
#
|
186
|
+
# Bio::RestrictionEnzyme::Fragment is a simple +Struct+ object.
|
187
|
+
#
|
188
|
+
# Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment
|
189
|
+
Fragment = Struct.new(:primary, :complement, :p_left, :p_right, :c_left, :c_right)
|
190
|
+
|
191
|
+
# Bio::RestrictionEnzyme::Fragments inherits from +Array+.
|
192
|
+
#
|
193
|
+
# Bio::RestrictionEnzyme::Fragments is a container for Fragment objects. It adds the
|
194
|
+
# methods +primary+ and +complement+ which returns an +Array+ of all
|
195
|
+
# respective strands from it's Fragment members in alphabetically sorted
|
196
|
+
# order. Note that it will
|
197
|
+
# not return duplicate items and does not return the spacing/padding
|
198
|
+
# that you would
|
199
|
+
# find by accessing the members directly.
|
200
|
+
#
|
201
|
+
# Example:
|
202
|
+
#
|
203
|
+
# primary = ['attaca', 'g']
|
204
|
+
# complement = ['atga', 'cta']
|
205
|
+
#
|
206
|
+
# Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments
|
207
|
+
class Fragments < Array
|
208
|
+
def primary; strip_and_sort(:primary); end
|
209
|
+
def complement; strip_and_sort(:complement); end
|
210
|
+
|
211
|
+
protected
|
212
|
+
|
213
|
+
def strip_and_sort( sym_strand )
|
214
|
+
self.map {|uf| uf.send( sym_strand ).tr(' ', '') }.sort
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end # RestrictionEnzyme
|
218
|
+
end # Bio
|