[BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb, 1.11, 1.12

Trevor Wennblom trevor at dev.open-bio.org
Fri Feb 2 06:42:16 UTC 2007


Update of /home/repository/bioruby/bioruby/lib/bio/util
In directory dev.open-bio.org:/tmp/cvs-serv12877/lib/bio/util

Modified Files:
	restriction_enzyme.rb 
Log Message:


Index: restriction_enzyme.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme.rb,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** restriction_enzyme.rb	5 Jan 2007 06:33:01 -0000	1.11
--- restriction_enzyme.rb	2 Feb 2007 06:42:14 -0000	1.12
***************
*** 24,33 ****
  # License::   Distributes under the same terms as Ruby
  #
- # NOTE: This documentation and the module are still very much under
- # development.  It has been released as it is relatively stable and
- # comments would be appreciated.
- # 
- # FIXME needs better docs
- #
  # = Description
  # 
--- 24,27 ----
***************
*** 41,45 ****
  # enzymes to cut your sequence or you may construct your own unique enzymes 
  # to use.
! # 
  # 
  # = Usage
--- 35,43 ----
  # enzymes to cut your sequence or you may construct your own unique enzymes 
  # to use.
! #
! # Visit the documentaion for individual classes for more information.
! #
! # An examination of the unit tests will also reveal several interesting uses
! # for the curious programmer.
  # 
  # = Usage
***************
*** 47,183 ****
  # == Basic
  #
! #   # EcoRI cut pattern:
! #   #   G|A A T T C
! #   #    +-------+
! #   #   C T T A A|G
! #   #
! #   # This can also be written as:
! #   #   G^AATTC
  # 
! #   require 'bio'
! #   require 'pp'
  # 
  #   seq = Bio::Sequence::NA.new('gaattc')
  #   cuts = seq.cut_with_enzyme('EcoRI')
! #   p cuts.primary                        # ["aattc", "g"]
! #   p cuts.complement                     # ["g", "cttaa"]
! #   pp cuts                               # ==>
! #     # [#<struct Bio::RestrictionEnzyme::Analysis::UniqueFragment primary="g    ", complement="cttaa">,
! #     #  #<struct Bio::RestrictionEnzyme::Analysis::UniqueFragment primary="aattc", complement="    g">]
! # 
  #   seq = Bio::Sequence::NA.new('gaattc')
  #   cuts = seq.cut_with_enzyme('g^aattc')
! #   p cuts.primary                        # ["aattc", "g"]
! #   p cuts.complement                     # ["g", "cttaa"]
! # 
  #   seq = Bio::Sequence::NA.new('gaattc')
  #   cuts = seq.cut_with_enzyme('g^aattc', 'gaatt^c')
! #   p cuts.primary                        # ["c", "aattc", "g", "gaatt"]
! #   p cuts.complement                     # ["g", "c", "cttaa", "ttaag"]
! # 
  #   seq = Bio::Sequence::NA.new('gaattcgaattc')
  #   cuts = seq.cut_with_enzyme('EcoRI')
! #   p cuts.primary                        # ["aattc", "aattcg", "g"]
! #   p cuts.complement                     # ["g", "gcttaa", "cttaa"]
! # 
  #   seq = Bio::Sequence::NA.new('gaattcgggaattc')
  #   cuts = seq.cut_with_enzyme('EcoRI')
! #   p cuts.primary                        # ["aattc", "aattcggg", "g"]
! #   p cuts.complement                     # ["g", "gcccttaa", "cttaa"]
! # 
  # == Advanced
! # 
  #   require 'bio'
! #   require 'pp'
  #   enzyme_1 = Bio::RestrictionEnzyme.new('anna', [1,1], [3,3])
  #   enzyme_2 = Bio::RestrictionEnzyme.new('gg', [1,1])
  #   a = Bio::RestrictionEnzyme::Analysis.cut('agga', enzyme_1, enzyme_2)
! #   p a.primary # ["a", "ag", "g", "ga"]
! # 
! #   b = Bio::RestrictionEnzyme::Analysis.cut_and_return_by_permutations('agga', enzyme_1, enzyme_2)
! #   pp b
  #   
  # 
! # Output (NOTE: to be cleaned):
! # 
! #   {[1, 0]=>
! #     #<Bio::RestrictionEnzyme::Analysis::SequenceRange:0x2971d0
! #      @__fragments=
! #       [#<Bio::RestrictionEnzyme::Analysis::Fragment:0x296750
! #         @complement_bin=[0, 1],
! #         @primary_bin=[0, 1]>,
! #        #<Bio::RestrictionEnzyme::Analysis::Fragment:0x296738
! #         @complement_bin=[2, 3],
! #         @primary_bin=[2, 3]>],
! #      @__fragments_current=true,
! #      @c_left=3,
! #      @c_right=3,
! #      @cut_ranges=
! #       [#<Bio::RestrictionEnzyme::Analysis::VerticalCutRange:0x2973e0
! #         @c_cut_left=nil,
! #         @c_cut_right=1,
! #         @max=1,
! #         @min=1,
! #         @p_cut_left=1,
! #         @p_cut_right=nil,
! #         @range=1..1>],
! #      @left=0,
! #      @p_left=0,
! #      @p_right=0,
! #      @right=3,
! #      @size=4,
! #      @tags={}>,
! #    [0, 1]=>
! #     #<Bio::RestrictionEnzyme::Analysis::SequenceRange:0x2973f8
! #      @__fragments=
! #       [#<Bio::RestrictionEnzyme::Analysis::Fragment:0x2958e0
! #         @complement_bin=[0],
! #         @primary_bin=[0]>,
! #        #<Bio::RestrictionEnzyme::Analysis::Fragment:0x2958c8
! #         @complement_bin=[1],
! #         @primary_bin=[1]>,
! #        #<Bio::RestrictionEnzyme::Analysis::Fragment:0x2958b0
! #         @complement_bin=[2],
! #         @primary_bin=[2]>,
! #        #<Bio::RestrictionEnzyme::Analysis::Fragment:0x295898
! #         @complement_bin=[3],
! #         @primary_bin=[3]>],
! #      @__fragments_current=true,
! #      @c_left=3,
! #      @c_right=3,
! #      @cut_ranges=
! #       [#<Bio::RestrictionEnzyme::Analysis::VerticalCutRange:0x297638
! #         @c_cut_left=nil,
! #         @c_cut_right=0,
! #         @max=0,
! #         @min=0,
! #         @p_cut_left=0,
! #         @p_cut_right=nil,
! #         @range=0..0>,
! #        #<Bio::RestrictionEnzyme::Analysis::VerticalCutRange:0x297620
! #         @c_cut_left=nil,
! #         @c_cut_right=2,
! #         @max=2,
! #         @min=2,
! #         @p_cut_left=2,
! #         @p_cut_right=nil,
! #         @range=2..2>,
! #        #<Bio::RestrictionEnzyme::Analysis::VerticalCutRange:0x2973e0
! #         @c_cut_left=nil,
! #         @c_cut_right=1,
! #         @max=1,
! #         @min=1,
! #         @p_cut_left=1,
! #         @p_cut_right=nil,
! #         @range=1..1>],
! #      @left=0,
! #      @p_left=0,
! #      @p_right=0,
! #      @right=3,
! #      @size=4,
! #      @tags={}>}
! # 
! # 
! # = Currently under development
  # 
  # * Circular DNA cutting
--- 45,124 ----
  # == Basic
  #
! # EcoRI cut pattern:
! #   G|A A T T C
! #    +-------+
! #   C T T A A|G
  # 
! # This can also be written as:
! #   G^AATTC
! #
! # Note that to use the method +cut_with_enzyme+ from a Bio::Sequence object 
! # you currently must +require+ +bio/util/restriction_enzyme+ directly.  If
! # instead you're going to directly call Bio::RestrictionEnzyme::Analysis
! # then only +bio+ needs to be +required+.
  # 
+ #   require 'bio'
+ #   require 'bio/util/restriction_enzyme'
+ #   
  #   seq = Bio::Sequence::NA.new('gaattc')
  #   cuts = seq.cut_with_enzyme('EcoRI')
! #   cuts.primary                        # => ["aattc", "g"]
! #   cuts.complement                     # => ["cttaa", "g"]
! #   cuts.inspect                        # => "[#<struct Bio::RestrictionEnzyme::Fragment primary=\"g    \", complement=\"cttaa\">, #<struct Bio::RestrictionEnzyme::Fragment primary=\"aattc\", complement=\"    g\">]"
! #   
  #   seq = Bio::Sequence::NA.new('gaattc')
  #   cuts = seq.cut_with_enzyme('g^aattc')
! #   cuts.primary                        # => ["aattc", "g"]
! #   cuts.complement                     # => ["cttaa", "g"]
! #   
  #   seq = Bio::Sequence::NA.new('gaattc')
  #   cuts = seq.cut_with_enzyme('g^aattc', 'gaatt^c')
! #   cuts.primary                        # => ["aattc", "c", "g", "gaatt"]
! #   cuts.complement                     # => ["c", "cttaa", "g", "ttaag"]
! #   
  #   seq = Bio::Sequence::NA.new('gaattcgaattc')
  #   cuts = seq.cut_with_enzyme('EcoRI')
! #   cuts.primary                        # => ["aattc", "aattcg", "g"]
! #   cuts.complement                     # => ["cttaa", "g", "gcttaa"]
! #   
  #   seq = Bio::Sequence::NA.new('gaattcgggaattc')
  #   cuts = seq.cut_with_enzyme('EcoRI')
! #   cuts.primary                        # => ["aattc", "aattcggg", "g"]
! #   cuts.complement                     # => ["cttaa", "g", "gcccttaa"]
! #   
! #   cuts[0].inspect                     # => "#<struct Bio::RestrictionEnzyme::Fragment primary=\"g    \", complement=\"cttaa\">"
! #   
! #   cuts[0].primary                     # => "g    "
! #   cuts[0].complement                  # => "cttaa"
! #   
! #   cuts[1].primary                     # => "aattcggg    "
! #   cuts[1].complement                  # => "    gcccttaa"
! #   
! #   cuts[2].primary                     # => "aattc"
! #   cuts[2].complement                  # => "    g"
! #   
  # == Advanced
! #
  #   require 'bio'
! #   
  #   enzyme_1 = Bio::RestrictionEnzyme.new('anna', [1,1], [3,3])
  #   enzyme_2 = Bio::RestrictionEnzyme.new('gg', [1,1])
  #   a = Bio::RestrictionEnzyme::Analysis.cut('agga', enzyme_1, enzyme_2)
! #   a.primary                           # => ["a", "ag", "g", "ga"]
! #   a.complement                        # => ["c", "ct", "t", "tc"]
  #   
+ #   a[0].primary                        # => "ag"
+ #   a[0].complement                     # => "tc"
+ #   
+ #   a[1].primary                        # => "ga"
+ #   a[1].complement                     # => "ct"
+ #   
+ #   a[2].primary                        # => "a"
+ #   a[2].complement                     # => "t"
+ #   
+ #   a[3].primary                        # => "g"
+ #   a[3].complement                     # => "c"
  # 
! # = Todo / under development
  # 
  # * Circular DNA cutting




More information about the bioruby-cvs mailing list