[BioRuby-cvs] bioruby/lib/bio/data na.rb,0.18,0.19
Katayama Toshiaki
k at pub.open-bio.org
Sat Dec 10 13:14:24 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio/data
In directory pub.open-bio.org:/tmp/cvs-serv14128/lib/bio/data
Modified Files:
na.rb
Log Message:
* to_re method is improved for the efficiency especially for longer sequence
Index: na.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v
retrieving revision 0.18
retrieving revision 0.19
diff -C2 -d -r0.18 -r0.19
*** na.rb 25 Nov 2005 15:59:29 -0000 0.18
--- na.rb 10 Dec 2005 18:14:22 -0000 0.19
***************
*** 177,188 ****
def to_re(seq, rna = false)
! str = ""
! seq.to_s.downcase.each_byte do |base|
! if re = NAMES[base.chr]
! str += re
! else
! str += "."
! end
! end
if rna
str.tr!("t", "u")
--- 177,184 ----
def to_re(seq, rna = false)
! str = seq.to_s
! str.gsub!(/[^atgcu]/) { |base|
! NAMES[base] || '.'
! }
if rna
str.tr!("t", "u")
More information about the bioruby-cvs
mailing list