[BioRuby-cvs] bioruby/lib/bio/data na.rb,0.20,0.21
Trevor Wennblom
trevor at dev.open-bio.org
Thu Apr 5 23:10:11 UTC 2007
Update of /home/repository/bioruby/bioruby/lib/bio/data
In directory dev.open-bio.org:/tmp/cvs-serv19921/lib/bio/data
Modified Files:
na.rb
Log Message:
Integrate Toshiaki's improvements of to_re in Bio::Sequence::NA
Index: na.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v
retrieving revision 0.20
retrieving revision 0.21
diff -C2 -d -r0.20 -r0.21
*** na.rb 8 Feb 2006 12:15:42 -0000 0.20
--- na.rb 5 Apr 2007 23:10:09 -0000 0.21
***************
*** 159,165 ****
def to_re(seq, rna = false)
str = seq.to_s.downcase
str.gsub!(/[^atgcu]/) { |base|
! NAMES[base] || '.'
}
if rna
--- 159,179 ----
def to_re(seq, rna = false)
+ replace = {
+ 'y' => '[tcy]',
+ 'r' => '[agr]',
+ 'w' => '[atw]',
+ 's' => '[gcw]',
+ 'k' => '[tgk]',
+ 'm' => '[acm]',
+ 'b' => '[tgcyskb]',
+ 'd' => '[atgrwkd]',
+ 'h' => '[atcwmyh]',
+ 'v' => '[agcmrsv]',
+ 'n' => '[atgcyrwskmbdhvn]'
+ }
+
str = seq.to_s.downcase
str.gsub!(/[^atgcu]/) { |base|
! replace[base] || base
}
if rna
More information about the bioruby-cvs
mailing list