[BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme analysis.rb, 1.12, 1.13 analysis_basic.rb, 1.5, 1.6 double_stranded.rb, 1.5, 1.6

Trevor Wennblom trevor at dev.open-bio.org
Fri Jan 5 06:03:24 UTC 2007


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

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


Index: analysis_basic.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis_basic.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** analysis_basic.rb	5 Jan 2007 05:33:29 -0000	1.5
--- analysis_basic.rb	5 Jan 2007 06:03:22 -0000	1.6
***************
*** 90,94 ****
    # * +sequence+: +String+ kind of object that will be used as a nucleic acid sequence.
    # * +args+: Series of enzyme names, enzymes sequences with cut marks, or RestrictionEnzyme objects.
!   # *Returns*:: Fragments object populated with Fragment objects.
    def cut_without_permutations( sequence, *args )
      return fragments_for_display( {} ) if !sequence.kind_of?(String) or sequence.empty?
--- 90,94 ----
    # * +sequence+: +String+ kind of object that will be used as a nucleic acid sequence.
    # * +args+: Series of enzyme names, enzymes sequences with cut marks, or RestrictionEnzyme objects.
!   # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects. (Note: unrelated to SequenceRange::Fragments)
    def cut_without_permutations( sequence, *args )
      return fragments_for_display( {} ) if !sequence.kind_of?(String) or sequence.empty?
***************
*** 134,138 ****
    # View these with the 'primary' and 'complement' methods.
    # 
!   # Fragment is a simple +Struct+ object.
    Fragment = Struct.new(:primary, :complement)
    
--- 134,140 ----
    # View these with the 'primary' and 'complement' methods.
    # 
!   # Bio::RestrictionEnzyme::Analysis::Fragment is a simple +Struct+ object.
!   # 
!   # *Note: unrelated to SequenceRange::Fragment*
    Fragment = Struct.new(:primary, :complement)
    
***************
*** 144,147 ****
--- 146,151 ----
    # not return duplicate items and does not return the spacing that you would
    # find by accessing the members directly.
+   #
+   # *Note: unrelated to SequenceRange::Fragments*
    class Fragments < Array
      def primary; strip_and_sort(:primary); end
***************
*** 161,170 ****
  
    # Take the fragments from SequenceRange objects generated from add_cut_range
!   # and return unique results as a Fragment object.
    # 
    # ---
    # *Arguments*
    # * +hsh+: +Hash+  Keys are a permutation ID, if any.  Values are SequenceRange objects that have cuts applied.
!   # *Returns*:: Fragments object populated with Fragment objects.
    def fragments_for_display( hsh )
      ary = Fragments.new
--- 165,174 ----
  
    # Take the fragments from SequenceRange objects generated from add_cut_range
!   # and return unique results as a Bio::RestrictionEnzyme::Analysis::Fragment object.
    # 
    # ---
    # *Arguments*
    # * +hsh+: +Hash+  Keys are a permutation ID, if any.  Values are SequenceRange objects that have cuts applied.
!   # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects.
    def fragments_for_display( hsh )
      ary = Fragments.new
***************
*** 182,187 ****
    # Creates an array of EnzymeActions based on the DNA sequence and supplied enzymes.
    #
!   # +sequence+:: The string of DNA to match the enzyme recognition sites against
!   # +args+:: The enzymes to use.
    def create_enzyme_actions( sequence, *args )
      all_enzyme_actions = []
--- 186,194 ----
    # Creates an array of EnzymeActions based on the DNA sequence and supplied enzymes.
    #
!   # ---
!   # *Arguments*
!   # * +sequence+: The string of DNA to match the enzyme recognition sites against
!   # * +args+:: The enzymes to use.
!   # *Returns*:: +Array+ with the first element being an array of EnzymeAction objects that +sometimes_cut+, and are subject to competition.  The second is an array of EnzymeAction objects that +always_cut+ and are not subject to competition.
    def create_enzyme_actions( sequence, *args )
      all_enzyme_actions = []

Index: analysis.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis.rb,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** analysis.rb	5 Jan 2007 05:33:29 -0000	1.12
--- analysis.rb	5 Jan 2007 06:03:22 -0000	1.13
***************
*** 51,55 ****
    # * +sequence+: +String+ kind of object that will be used as a nucleic acid sequence.
    # * +args+: Series of enzyme names, enzymes sequences with cut marks, or RestrictionEnzyme objects.
!   # *Returns*:: Fragments object populated with Fragment objects.
    def cut( sequence, *args )
      return fragments_for_display( {} ) if !sequence.kind_of?(String) or sequence.empty?
--- 51,55 ----
    # * +sequence+: +String+ kind of object that will be used as a nucleic acid sequence.
    # * +args+: Series of enzyme names, enzymes sequences with cut marks, or RestrictionEnzyme objects.
!   # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects.   (Note: unrelated to SequenceRange::Fragments)
    def cut( sequence, *args )
      return fragments_for_display( {} ) if !sequence.kind_of?(String) or sequence.empty?
***************
*** 116,119 ****
--- 116,120 ----
              # * The enzyme action location is located at the base of the index.
              #   ex: atgc -- 0 => 'a', 1 => 't', 2 => 'g', 3 => 'c'
+             # method create_enzyme_actions has similar commentary if interested
              if (enzyme_action.right <= previous_cut_left) or
                 (enzyme_action.left > previous_cut_right) or
***************
*** 128,132 ****
            enzyme_action.cut_ranges.each { |cut_range| sequence_range.add_cut_range(cut_range) }
            previous_cut_ranges += enzyme_action.cut_ranges        
!         end
  
          # Fill in the source sequence for sequence_range so it knows what bases
--- 129,133 ----
            enzyme_action.cut_ranges.each { |cut_range| sequence_range.add_cut_range(cut_range) }
            previous_cut_ranges += enzyme_action.cut_ranges        
!         end # permutation.each
  
          # Fill in the source sequence for sequence_range so it knows what bases
***************
*** 135,141 ****
          sequence_range.fragments.complement = sequence.forward_complement
          my_hash[permutation] = sequence_range
!       end
        
!     else # !if enzyme_actions.size > 1
        sequence_range = Bio::RestrictionEnzyme::Range::SequenceRange.new( 0, 0, sequence.size-1, sequence.size-1 )
        initial_cuts.each { |enzyme_action| enzyme_action.cut_ranges.each { |cut_range| sequence_range.add_cut_range(cut_range) } }
--- 136,143 ----
          sequence_range.fragments.complement = sequence.forward_complement
          my_hash[permutation] = sequence_range
!       end # permutations.each
        
!     else # if enzyme_actions.size == 1
!       # no permutations, just do it
        sequence_range = Bio::RestrictionEnzyme::Range::SequenceRange.new( 0, 0, sequence.size-1, sequence.size-1 )
        initial_cuts.each { |enzyme_action| enzyme_action.cut_ranges.each { |cut_range| sequence_range.add_cut_range(cut_range) } }
***************
*** 148,151 ****
--- 150,191 ----
    end
  
+ 
+   # Returns permutation orders for a given number of elements.
+   #
+   # Examples:
+   #   permute(0) # => [[0]]
+   #   permute(1) # => [[0]]
+   #   permute(2) # => [[1, 0], [0, 1]]
+   #   permute(3) # => [[2, 1, 0], [2, 0, 1], [1, 2, 0], [0, 2, 1], [1, 0, 2], [0, 1, 2]]
+   #   permute(4) # => [[3, 2, 1, 0],
+   #                    [3, 2, 0, 1],
+   #                    [3, 1, 2, 0],
+   #                    [3, 0, 2, 1],
+   #                    [3, 1, 0, 2],
+   #                    [3, 0, 1, 2],
+   #                    [2, 3, 1, 0],
+   #                    [2, 3, 0, 1],
+   #                    [1, 3, 2, 0],
+   #                    [0, 3, 2, 1],
+   #                    [1, 3, 0, 2],
+   #                    [0, 3, 1, 2],
+   #                    [2, 1, 3, 0],
+   #                    [2, 0, 3, 1],
+   #                    [1, 2, 3, 0],
+   #                    [0, 2, 3, 1],
+   #                    [1, 0, 3, 2],
+   #                    [0, 1, 3, 2],
+   #                    [2, 1, 0, 3],
+   #                    [2, 0, 1, 3],
+   #                    [1, 2, 0, 3],
+   #                    [0, 2, 1, 3],
+   #                    [1, 0, 2, 3],
+   #                    [0, 1, 2, 3]]
+   #   
+   # ---
+   # *Arguments*
+   # * +count+: +Number+ of different elements to be permuted
+   # * +permutations+: ignore - for the recursive algorithm
+   # *Returns*:: +Array+ of +Array+ objects with different possible permutation orders.  See examples.
    def permute(count, permutations = [[0]])
      return permutations if count <= 1

Index: double_stranded.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/double_stranded.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** double_stranded.rb	2 Jan 2007 00:13:07 -0000	1.5
--- double_stranded.rb	5 Jan 2007 06:03:22 -0000	1.6
***************
*** 41,44 ****
--- 41,46 ----
  # * SingleStrand methods may be used on DoubleStranded and they will be passed to +primary+.
  # 
+ # 
+ # FIXME needs better docs
  class DoubleStranded
    include CutSymbol




More information about the bioruby-cvs mailing list