[BioRuby-cvs] bioruby/lib/bio/data aa.rb, 0.14, 0.15 codontable.rb,
0.15, 0.16 na.rb, 0.16, 0.17
Katayama Toshiaki
k at pub.open-bio.org
Tue Nov 15 07:43:39 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio/data
In directory pub.open-bio.org:/tmp/cvs-serv31273/lib/bio/data
Modified Files:
aa.rb codontable.rb na.rb
Log Message:
* Constans are renamed to UPPERCASE (incompatible change)
Index: aa.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v
retrieving revision 0.14
retrieving revision 0.15
diff -C2 -d -r0.14 -r0.15
*** aa.rb 14 Nov 2005 02:01:54 -0000 0.14
--- aa.rb 15 Nov 2005 12:43:37 -0000 0.15
***************
*** 37,41 ****
# * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html
! Names= {
'A' => 'Ala',
--- 37,41 ----
# * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html
! NAMES= {
'A' => 'Ala',
***************
*** 96,100 ****
# Proteins - Volume 1, CRC Press, Cleveland (1976)
! Weight = {
'A' => 89.09,
--- 96,100 ----
# Proteins - Volume 1, CRC Press, Cleveland (1976)
! WEIGHT = {
'A' => 89.09,
***************
*** 127,132 ****
x.each_byte do |byte|
aa = byte.chr.upcase
! if Weight[aa]
! total += Weight[aa]
else
raise "Error: invalid amino acid '#{aa}'"
--- 127,132 ----
x.each_byte do |byte|
aa = byte.chr.upcase
! if WEIGHT[aa]
! total += WEIGHT[aa]
else
raise "Error: invalid amino acid '#{aa}'"
***************
*** 135,159 ****
total -= NucleicAcid.weight[:water] * (x.length - 1)
else
! Weight[x]
end
else
! Weight
end
end
def [](x)
! Names[x]
end
# backward compatibility
def names
! Names
end
alias aa names
def name(x)
! str = Names[x]
if str and str.length == 3
! Names[str]
else
str
--- 135,159 ----
total -= NucleicAcid.weight[:water] * (x.length - 1)
else
! WEIGHT[x]
end
else
! WEIGHT
end
end
def [](x)
! NAMES[x]
end
# backward compatibility
def names
! NAMES
end
alias aa names
def name(x)
! str = NAMES[x]
if str and str.length == 3
! NAMES[str]
else
str
***************
*** 189,193 ****
raise ArgumentError
else
! Names[x]
end
end
--- 189,193 ----
raise ArgumentError
else
! NAMES[x]
end
end
***************
*** 205,209 ****
raise ArgumentError
else
! three2name(Names[x])
end
end
--- 205,209 ----
raise ArgumentError
else
! three2name(NAMES[x])
end
end
***************
*** 222,226 ****
raise ArgumentError
else
! Names[x]
end
end
--- 222,226 ----
raise ArgumentError
else
! NAMES[x]
end
end
***************
*** 244,248 ****
def reverse
hash = Hash.new
! Names.each do |k, v|
hash[v] = k
end
--- 244,248 ----
def reverse
hash = Hash.new
! NAMES.each do |k, v|
hash[v] = k
end
***************
*** 258,266 ****
# as class methods
extend Data
-
-
- # backward compatibility
- Names = Data::Names
- Weight = Data::Weight
--- 258,261 ----
Index: na.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v
retrieving revision 0.16
retrieving revision 0.17
diff -C2 -d -r0.16 -r0.17
*** na.rb 14 Nov 2005 01:52:19 -0000 0.16
--- na.rb 15 Nov 2005 12:43:37 -0000 0.17
***************
*** 68,72 ****
# * http://www.ncbi.nlm.nih.gov/collab/FT/
! Names = {
'y' => '[tc]', # pYrimidine
--- 68,72 ----
# * http://www.ncbi.nlm.nih.gov/collab/FT/
! NAMES = {
'y' => '[tc]', # pYrimidine
***************
*** 98,102 ****
}
! Weight = {
# Calculated by BioPerl's Bio::Tools::SeqStats.pm :-)
--- 98,102 ----
}
! WEIGHT = {
# Calculated by BioPerl's Bio::Tools::SeqStats.pm :-)
***************
*** 126,141 ****
if x.length > 1
if rna
! phosphate = Weight[:ribose_phosphate]
else
! phosphate = Weight[:deoxyribose_phosphate]
end
! hydrogen = Weight[:hydrogen]
! water = Weight[:water]
total = 0.0
x.each_byte do |byte|
base = byte.chr.downcase
! if Weight[base]
! total += Weight[base] + phosphate - hydrogen * 2
else
raise "Error: invalid nucleic acid '#{base}'"
--- 126,141 ----
if x.length > 1
if rna
! phosphate = WEIGHT[:ribose_phosphate]
else
! phosphate = WEIGHT[:deoxyribose_phosphate]
end
! hydrogen = WEIGHT[:hydrogen]
! water = WEIGHT[:water]
total = 0.0
x.each_byte do |byte|
base = byte.chr.downcase
! if WEIGHT[base]
! total += WEIGHT[base] + phosphate - hydrogen * 2
else
raise "Error: invalid nucleic acid '#{base}'"
***************
*** 144,166 ****
total -= water * (x.length - 1)
else
! Weight[x.to_s.downcase]
end
else
! Weight
end
end
def [](x)
! Names[x]
end
# backward compatibility
def names
! Names
end
alias na names
def name(x)
! Names[x.to_s.upcase]
end
--- 144,166 ----
total -= water * (x.length - 1)
else
! WEIGHT[x.to_s.downcase]
end
else
! WEIGHT
end
end
def [](x)
! NAMES[x]
end
# backward compatibility
def names
! NAMES
end
alias na names
def name(x)
! NAMES[x.to_s.upcase]
end
***************
*** 168,172 ****
str = ""
seq.to_s.downcase.each_byte do |base|
! if re = Names[base.chr]
str += re
else
--- 168,172 ----
str = ""
seq.to_s.downcase.each_byte do |base|
! if re = NAMES[base.chr]
str += re
else
***************
*** 188,195 ****
# as class methods
extend Data
-
- # backward compatibility
- Names = Data::Names
- Weight = Data::Weight
end
--- 188,191 ----
Index: codontable.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/data/codontable.rb,v
retrieving revision 0.15
retrieving revision 0.16
diff -C2 -d -r0.15 -r0.16
*** codontable.rb 14 Nov 2005 02:01:54 -0000 0.15
--- codontable.rb 15 Nov 2005 12:43:37 -0000 0.16
***************
*** 69,77 ****
# hard coded codon tables in this class as a Bio::CodonTable object.
def self.[](i)
! hash = Tables[i]
raise "ERROR: Unknown codon table No.#{i}" unless hash
! definition = Definitions[i]
! start = Starts[i]
! stop = Stops[i]
self.new(hash, definition, start, stop)
end
--- 69,77 ----
# hard coded codon tables in this class as a Bio::CodonTable object.
def self.[](i)
! hash = TABLES[i]
raise "ERROR: Unknown codon table No.#{i}" unless hash
! definition = DEFINITIONS[i]
! start = STARTS[i]
! stop = STOPS[i]
self.new(hash, definition, start, stop)
end
***************
*** 179,183 ****
private :generate_stop
! Definitions = {
1 => "Standard (Eukaryote)",
--- 179,183 ----
private :generate_stop
! DEFINITIONS = {
1 => "Standard (Eukaryote)",
***************
*** 202,206 ****
! Starts = {
1 => %w(ttg ctg atg gtg), # gtg added (cf. NCBI #SG1 document)
2 => %w(att atc ata atg gtg),
--- 202,206 ----
! STARTS = {
1 => %w(ttg ctg atg gtg), # gtg added (cf. NCBI #SG1 document)
2 => %w(att atc ata atg gtg),
***************
*** 223,227 ****
! Stops = {
1 => %w(taa tag tga),
2 => %w(taa tag aga agg),
--- 223,227 ----
! STOPS = {
1 => %w(taa tag tga),
2 => %w(taa tag aga agg),
***************
*** 244,248 ****
! Tables = {
# codon table 1
--- 244,248 ----
! TABLES = {
# codon table 1
More information about the bioruby-cvs
mailing list