[BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme/range cut_ranges.rb, 1.1, 1.2 horizontal_cut_range.rb, 1.1, 1.2

Trevor Wennblom trevor at dev.open-bio.org
Tue Jan 2 06:18:40 UTC 2007


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

Modified Files:
	cut_ranges.rb horizontal_cut_range.rb 
Log Message:


Index: horizontal_cut_range.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** horizontal_cut_range.rb	2 Jan 2007 00:13:07 -0000	1.1
--- horizontal_cut_range.rb	2 Jan 2007 06:18:38 -0000	1.2
***************
*** 54,60 ****
      @c_cut_left = nil
      @c_cut_right = nil
!     @min = nil
!     @max = nil
!     @range = nil
  
      @hcuts = (left..right)
--- 54,61 ----
      @c_cut_left = nil
      @c_cut_right = nil
!     @min = left  # NOTE this used to be 'nil', make sure all tests work
!     @max = right # NOTE this used to be 'nil', make sure all tests work
!     @range = (@min.. at max) unless @min == nil or @max == nil # NOTE this used to be 'nil', make sure all tests work
!     
  
      @hcuts = (left..right)

Index: cut_ranges.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/cut_ranges.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** cut_ranges.rb	2 Jan 2007 00:13:07 -0000	1.1
--- cut_ranges.rb	2 Jan 2007 06:18:38 -0000	1.2
***************
*** 29,32 ****
--- 29,53 ----
    def max; self.collect{|a| a.max}.flatten.sort.last; end
    def include?(i); self.collect{|a| a.include?(i)}.include?(true); end
+   
+   def min_vertical
+     vertical_min_max_helper( :min )
+   end
+   
+   def max_vertical
+     vertical_min_max_helper( :max )
+   end
+   
+   protected
+   
+   def vertical_min_max_helper( sym_which )
+     tmp = []
+     self.each do |a|
+       next unless a.class == Bio::RestrictionEnzyme::Range::VerticalCutRange
+       tmp << a.send( sym_which )
+     end
+     z = (sym_which == :max) ? :last : :first
+     tmp.flatten.sort.send(z)
+   end
+     
  end # CutRanges
  end # Range




More information about the bioruby-cvs mailing list