[BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme analysis_basic.rb, 1.8, 1.9 double_stranded.rb, 1.7, 1.8

Trevor Wennblom trevor at dev.open-bio.org
Wed Mar 28 19:45:29 UTC 2007


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

Modified Files:
	analysis_basic.rb double_stranded.rb 
Log Message:
Bugfix

Index: analysis_basic.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis_basic.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** analysis_basic.rb	5 Jan 2007 06:33:01 -0000	1.8
--- analysis_basic.rb	28 Mar 2007 19:45:27 -0000	1.9
***************
*** 151,155 ****
        enzyme = Bio::RestrictionEnzyme.new(enzyme) unless enzyme.class == Bio::RestrictionEnzyme::DoubleStranded
  
!       find_match_locations( sequence, enzyme.primary.to_re ).each do |offset|
          all_enzyme_actions << enzyme.create_action_at( offset )
        end
--- 151,164 ----
        enzyme = Bio::RestrictionEnzyme.new(enzyme) unless enzyme.class == Bio::RestrictionEnzyme::DoubleStranded
  
!       # make sure pattern is the proper size
!       # for more info see the internal documentation of 
!       # Bio::RestrictionEnzyme::DoubleStranded.create_action_at
!       pattern = Bio::Sequence::NA.new(
!         Bio::RestrictionEnzyme::DoubleStranded::AlignedStrands.align(
!           enzyme.primary, enzyme.complement
!         ).primary
!       ).to_re
!       
!       find_match_locations( sequence, pattern ).each do |offset|
          all_enzyme_actions << enzyme.create_action_at( offset )
        end
***************
*** 185,193 ****
      all_enzyme_actions[0..-2].each_with_index do |current_enzyme_action, i|
        next if competition_indexes.include? i
        
        all_enzyme_actions[i+1..-1].each_with_index do |comparison_enzyme_action, j|
          j += (i + 1)
          next if competition_indexes.include? j
! 
          if (current_enzyme_action.right <= comparison_enzyme_action.cut_ranges.min_vertical) or
             (current_enzyme_action.left > comparison_enzyme_action.cut_ranges.max_vertical)
--- 194,204 ----
      all_enzyme_actions[0..-2].each_with_index do |current_enzyme_action, i|
        next if competition_indexes.include? i
+       next if current_enzyme_action.cut_ranges.empty?  # no cuts, some enzymes are like this (ex. CjuI)
        
        all_enzyme_actions[i+1..-1].each_with_index do |comparison_enzyme_action, j|
          j += (i + 1)
          next if competition_indexes.include? j
!         next if comparison_enzyme_action.cut_ranges.empty?  # no cuts
!         
          if (current_enzyme_action.right <= comparison_enzyme_action.cut_ranges.min_vertical) or
             (current_enzyme_action.left > comparison_enzyme_action.cut_ranges.max_vertical)

Index: double_stranded.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/double_stranded.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** double_stranded.rb	5 Jan 2007 06:33:01 -0000	1.7
--- double_stranded.rb	28 Mar 2007 19:45:27 -0000	1.8
***************
*** 171,179 ****
    # +offset+:: Numerical offset of where the enzyme action occurs on the seqeunce
    def create_action_at( offset )
!   #def enzyme_to_enzyme_action( restriction_enzyme, offset )
!     enzyme_action = EnzymeAction.new( offset, 
!                                       offset + @primary.size-1, 
!                                       offset, 
!                                       offset + @complement.size-1)
  
      @cut_locations.each do |cut_location_pair|
--- 171,205 ----
    # +offset+:: Numerical offset of where the enzyme action occurs on the seqeunce
    def create_action_at( offset )
!     # x is the size of the fully aligned sequence with maximum padding needed
!     # to make a match on the primary and complement strand.
!     #
!     # For example -
!     # Note how EcoRII needs extra padding on the beginning and ending of the
!     # sequence 'ccagg' to make the match since the cut must occur between 
!     # two nucleotides and can not occur on the very end of the sequence.
!     #   
!     #   EcoRII:
!     #     :blunt: "0"
!     #     :c2: "5"
!     #     :c4: "0"
!     #     :c1: "-1"
!     #     :pattern: CCWGG
!     #     :len: "5"
!     #     :name: EcoRII
!     #     :c3: "0"
!     #     :ncuts: "2"
!     #   
!     #        -1 1 2 3 4 5
!     #   5' - n^c c w g g n - 3'
!     #   3' - n g g w c c^n - 5'
!     #   
!     #   (w == [at])
!     
!     x = aligned_strands.primary.size
!     
!     enzyme_action = EnzymeAction.new( offset,
!                                       offset + x-1,
!                                       offset,
!                                       offset + x-1)
  
      @cut_locations.each do |cut_location_pair|




More information about the bioruby-cvs mailing list