[BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.9,0.10 na.rb,0.10,0.11
Katayama Toshiaki
k at pub.open-bio.org
Sun Aug 7 19:28:16 EDT 2005
Update of /home/repository/bioruby/bioruby/lib/bio/data
In directory pub.open-bio.org:/tmp/cvs-serv28702/lib/bio/data
Modified Files:
aa.rb na.rb
Log Message:
* AminoAcid#to_re method is added
* clean up
Index: aa.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v
retrieving revision 0.9
retrieving revision 0.10
diff -C2 -d -r0.9 -r0.10
*** aa.rb 7 Aug 2005 09:58:21 -0000 0.9
--- aa.rb 7 Aug 2005 23:28:14 -0000 0.10
***************
*** 136,139 ****
--- 136,145 ----
end
+ # backward compatibility
+ def names
+ Names
+ end
+ alias :aa :names
+
def name(x)
str = Names[x]
***************
*** 212,217 ****
--- 218,233 ----
end
+ def to_re(seq)
+ str = seq.to_s.upcase
+ str.gsub!(/[^BZACDEFGHIKLMNPQRSTVWYU]/, ".")
+ str.gsub!("B", "[DN]")
+ str.gsub!("Z", "[EQ]")
+ Regexp.new(str)
+ end
+
+
private
+
def reverse
hash = Hash.new
***************
*** 236,249 ****
Weight = Data::Weight
- def aa
- Names
- end
-
- def self.names
- Names
- end
private
alias :orig_reverse :reverse
def reverse
--- 252,260 ----
Weight = Data::Weight
private
+
+ # override when used as an instance method to improve performance
alias :orig_reverse :reverse
def reverse
***************
*** 300,304 ****
p aa.to_3('A')
-
puts "# Bio::AminoAcid.one2three('A')"
p Bio::AminoAcid.one2three('A')
--- 311,314 ----
***************
*** 330,333 ****
--- 340,346 ----
puts "# aa.name2three('alanine')"
p aa.name2three('alanine')
+
+ puts "# Bio::AminoAcid.to_re('BZACDEFGHIKLMNPQRSTVWYU')"
+ p Bio::AminoAcid.to_re('BZACDEFGHIKLMNPQRSTVWYU')
end
Index: na.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v
retrieving revision 0.10
retrieving revision 0.11
diff -C2 -d -r0.10 -r0.11
*** na.rb 7 Aug 2005 09:58:21 -0000 0.10
--- na.rb 7 Aug 2005 23:28:14 -0000 0.11
***************
*** 114,117 ****
--- 114,123 ----
end
+ # backward compatibility
+ def names
+ Names
+ end
+ alias :na :names
+
def name(x)
Names[x.to_s.upcase]
***************
*** 144,154 ****
Weight = Data::Weight
- def na
- Names
- end
-
- def self.names
- Names
- end
end
--- 150,153 ----
More information about the bioruby-cvs
mailing list