[BioRuby-cvs] bioruby/lib/bio alignment.rb,1.23,1.24
Naohisa Goto
ngoto at dev.open-bio.org
Wed Dec 26 14:08:04 UTC 2007
Update of /home/repository/bioruby/bioruby/lib/bio
In directory dev.open-bio.org:/tmp/cvs-serv17518/lib/bio
Modified Files:
alignment.rb
Log Message:
* Ruby 1.9 compliant: in EnumerableExtension#each_window and
OriginalAlignment#index methods, local variable names outside the
iterator loops are changed not to be shadowed by iterator variables.
* Warning messages for uninitialized instance variables of
@gap_regexp, @gap_char, @missing_char, and @seqclass are suppressed.
Index: alignment.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** alignment.rb 16 Jul 2007 12:21:39 -0000 1.23
--- alignment.rb 26 Dec 2007 14:08:02 -0000 1.24
***************
*** 94,98 ****
# Returns regular expression for checking gap.
def gap_regexp
! @gap_regexp or GAP_REGEXP
end
# regular expression for checking gap
--- 94,98 ----
# Returns regular expression for checking gap.
def gap_regexp
! ((defined? @gap_regexp) ? @gap_regexp : nil) or GAP_REGEXP
end
# regular expression for checking gap
***************
*** 101,105 ****
# Gap character.
def gap_char
! @gap_char or GAP_CHAR
end
# gap character
--- 101,105 ----
# Gap character.
def gap_char
! ((defined? @gap_char) ? @gap_char : nil) or GAP_CHAR
end
# gap character
***************
*** 108,112 ****
# Character if the site is missing or unknown.
def missing_char
! @missing_char or MISSING_CHAR
end
# Character if the site is missing or unknown.
--- 108,112 ----
# Character if the site is missing or unknown.
def missing_char
! ((defined? @missing_char) ? @missing_char : nil) or MISSING_CHAR
end
# Character if the site is missing or unknown.
***************
*** 119,123 ****
# If no sequences are found, returns nil.
def seqclass
! @seqclass or String
end
--- 119,123 ----
# If no sequences are found, returns nil.
def seqclass
! ((defined? @seqclass) ? @seqclass : nil) or String
end
***************
*** 348,352 ****
# If no sequences are found, returns nil.
def seqclass
! if @seqclass then
@seqclass
else
--- 348,352 ----
# If no sequences are found, returns nil.
def seqclass
! if (defined? @seqclass) and @seqclass then
@seqclass
else
***************
*** 482,490 ****
return nil if window_size < 0
if step_size >= 0 then
! i = nil
0.step(alignment_length - window_size, step_size) do |i|
yield alignment_window(i, window_size)
end
! alignment_window((i+window_size)..-1)
else
i = alignment_length - window_size
--- 482,491 ----
return nil if window_size < 0
if step_size >= 0 then
! last_step = nil
0.step(alignment_length - window_size, step_size) do |i|
yield alignment_window(i, window_size)
+ last_step = i
end
! alignment_window((last_step + window_size)..-1)
else
i = alignment_length - window_size
***************
*** 1821,1826 ****
def index(seq)
#(Hash-like)
! k = nil
self.each_pair do |k, s|
if s.class == seq.class then
r = (s == seq)
--- 1822,1828 ----
def index(seq)
#(Hash-like)
! last_key = nil
self.each_pair do |k, s|
+ last_key = k
if s.class == seq.class then
r = (s == seq)
***************
*** 1830,1834 ****
break if r
end
! k
end
--- 1832,1836 ----
break if r
end
! last_key
end
More information about the bioruby-cvs
mailing list