Class/Module Index [+]

Quicksearch

Bio::AminoAcid::Data

Constants

NAMES

IUPAC code

WEIGHT

AAindex FASG760101 - Molecular weight (Fasman, 1976)

Fasman, G.D., ed.
Handbook of Biochemistry and Molecular Biology", 3rd ed.,
Proteins - Volume 1, CRC Press, Cleveland (1976)

Public Instance Methods

[](x) click to toggle source
# File lib/bio/data/aa.rb, line 131
def [](x)
  NAMES[x]
end
aa() click to toggle source
Alias for: names
name(x) click to toggle source
# File lib/bio/data/aa.rb, line 141
def name(x)
  str = NAMES[x]
  if str and str.length == 3
    NAMES[str]
  else
    str
  end
end
name2one(x) click to toggle source
# File lib/bio/data/aa.rb, line 198
def name2one(x)
  str = reverse[x.to_s.downcase]
  if str and str.length == 3
    three2one(str)
  else
    str
  end
end
name2three(x) click to toggle source
# File lib/bio/data/aa.rb, line 215
def name2three(x)
  reverse[x.downcase]
end
names() click to toggle source

backward compatibility

# File lib/bio/data/aa.rb, line 136
def names
  NAMES
end
Also aliased as: aa
one(x) click to toggle source
Alias for: to_1
one2name(x) click to toggle source
# File lib/bio/data/aa.rb, line 190
def one2name(x)
  if x and x.length != 1
    raise ArgumentError
  else
    three2name(NAMES[x])
  end
end
one2three(x) click to toggle source
# File lib/bio/data/aa.rb, line 174
def one2three(x)
  if x and x.length != 1
    raise ArgumentError
  else
    NAMES[x]
  end
end
three(x) click to toggle source
Alias for: to_3
three2name(x) click to toggle source
# File lib/bio/data/aa.rb, line 207
def three2name(x)
  if x and x.length != 3
    raise ArgumentError
  else
    NAMES[x]
  end
end
three2one(x) click to toggle source
# File lib/bio/data/aa.rb, line 182
def three2one(x)
  if x and x.length != 3
    raise ArgumentError
  else
    reverse[x]
  end
end
to_1(x) click to toggle source
# File lib/bio/data/aa.rb, line 150
def to_1(x)
  case x.to_s.length
  when 1
    x
  when 3
    three2one(x)
  else
    name2one(x)
  end
end
Also aliased as: one
to_3(x) click to toggle source
# File lib/bio/data/aa.rb, line 162
def to_3(x)
  case x.to_s.length
  when 1
    one2three(x)
  when 3
    x
  else
    name2three(x)
  end
end
Also aliased as: three
to_re(seq) click to toggle source
# File lib/bio/data/aa.rb, line 219
def to_re(seq)
  replace = {
    'B' => '[DNB]',
    'Z' => '[EQZ]',
    'J' => '[ILJ]',
    'X' => '[ACDEFGHIKLMNPQRSTVWYUOX]',
  }
  replace.default = '.'

  str = seq.to_s.upcase
  str.gsub!(/[^ACDEFGHIKLMNPQRSTVWYUO]/) { |aa|
    replace[aa]
  }
  Regexp.new(str)
end
weight(x = nil) click to toggle source
# File lib/bio/data/aa.rb, line 110
def weight(x = nil)
  if x
    if x.length > 1
      total = 0.0
      x.each_byte do |byte|
        aa = byte.chr.upcase
        if WEIGHT[aa]
          total += WEIGHT[aa]
        else
          raise "Error: invalid amino acid '#{aa}'"
        end
      end
      total -= NucleicAcid.weight[:water] * (x.length - 1)
    else
      WEIGHT[x]
    end
  else
    WEIGHT
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.