[BioRuby-cvs] bioruby/lib/bio/data aa.rb, 0.20, 0.21 na.rb, 0.22, 0.23

Katayama Toshiaki k at dev.open-bio.org
Fri Apr 6 04:41:30 UTC 2007


Update of /home/repository/bioruby/bioruby/lib/bio/data
In directory dev.open-bio.org:/tmp/cvs-serv21020

Modified Files:
	aa.rb na.rb 
Log Message:
* AA#to_re is rewrited symmetrically to NA#to_re
* default value '.' is assigned for to_re replacement


Index: aa.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v
retrieving revision 0.20
retrieving revision 0.21
diff -C2 -d -r0.20 -r0.21
*** aa.rb	5 Apr 2007 23:35:40 -0000	0.20
--- aa.rb	6 Apr 2007 04:41:28 -0000	0.21
***************
*** 218,225 ****
  
      def to_re(seq)
        str = seq.to_s.upcase
!       str.gsub!(/[^BZACDEFGHIKLMNPQRSTVWYU]/, ".")
!       str.gsub!("B", "[DN]")
!       str.gsub!("Z", "[EQ]")
        Regexp.new(str)
      end
--- 218,233 ----
  
      def to_re(seq)
+       replace = {
+         'B' => '[DNB]',
+         'Z' => '[EQZ]',
+         'J' => '[ILJ]',
+         'X' => '[ACDEFGHIKLMNPQRSTVWYUO]',
+       }
+       replace.default = '.'
+ 
        str = seq.to_s.upcase
!       str.gsub!(/[^ACDEFGHIKLMNPQRSTVWYUO]/) { |aa|
!         replace[aa]
!       }
        Regexp.new(str)
      end

Index: na.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v
retrieving revision 0.22
retrieving revision 0.23
diff -C2 -d -r0.22 -r0.23
*** na.rb	5 Apr 2007 23:35:40 -0000	0.22
--- na.rb	6 Apr 2007 04:41:28 -0000	0.23
***************
*** 172,179 ****
          'n' => '[atgcyrwskmbdhvn]'
        }
  
        str = seq.to_s.downcase
!       str.gsub!(/[^atgcu]/) { |base|
!         replace[base] || base
        }
        if rna
--- 172,180 ----
          'n' => '[atgcyrwskmbdhvn]'
        }
+       replace.default = '.'
  
        str = seq.to_s.downcase
!       str.gsub!(/[^atgcu]/) { |na|
!         replace[na]
        }
        if rna




More information about the bioruby-cvs mailing list