From 8b67ce6de89caceac3cb7d1c520c14f8966bf827 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Thu, 16 Dec 2010 12:24:36 +0000 Subject: [PATCH] speedup fix of max_homopol again git-svn-id: http://biopieces.googlecode.com/svn/trunk@1191 74ccb610-7750-0410-82ae-013aeee3265d --- code_ruby/Maasha/lib/seq.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code_ruby/Maasha/lib/seq.rb b/code_ruby/Maasha/lib/seq.rb index 23e6965..696e070 100644 --- a/code_ruby/Maasha/lib/seq.rb +++ b/code_ruby/Maasha/lib/seq.rb @@ -164,13 +164,11 @@ class Seq # Method that returns the length of the longest homopolymeric stretch # found in a sequence. - def homopol_max - max = 1 - + def homopol_max(max = 1) return 0 if self.seq.nil? or self.seq.empty? self.seq.upcase.scan(/A{#{max},}|T{#{max},}|G{#{max},}|C{#{max},}|N{#{max},}/) do |match| - max = [match.size, max].max + max = match.size > max ? match.size : max end max -- 2.39.5