Class: Molecules::Libraries::Residue

Inherits:
EmpiricalFormula show all
Includes:
Constants::Library
Defined in:
lib/molecules/libraries/residue.rb

Overview

A library of amino acid residues.

r = Residue::A
r.name               # => "Alanine"
r.abbr               # => "Ala"
r.letter             # => "A"
r.side_chain.to_s    # => "CH(3)"

Constant Summary collapse

BACKBONE =

An EmpiricalFormula for the residue backbone

EmpiricalFormula.parse_simple('C(2)H(2)NO')
DELTA_IMMONIUM =

Add to a Residue to achieve an immonium ion

EmpiricalFormula.parse('-CO+H')
A =
Residue.new('A', "Ala", "Alanine", "CH(3)", :common)
C =
Residue.new('C', "Cys", "Cysteine", "CH(3)S", :common)
D =
Residue.new('D', "Asp", "Aspartic Acid", "C(2)H(3)O(2)", :common)
E =
Residue.new('E', "Glu", "Glutamic Acid", "C(3)H(5)O(2)", :common)
F =
Residue.new('F', "Phe", "Phenylalanine", "C(7)H(7)", :common)
G =
Residue.new('G', "Gly", "Glycine", "H", :common)
H =
Residue.new('H', "His", "Histidine", "C(4)H(5)N(2)", :common)
I =
Residue.new('I', "Ile", "Isoleucine", "C(4)H(9)", :common)
K =
Residue.new('K', "Lys", "Lysine", "C(4)H(10)N", :common)
L =
Residue.new('L', "Leu", "Leucine", "C(4)H(9)", :common)
M =
Residue.new('M', "Met", "Methionine", "C(3)H(7)S", :common)
N =
Residue.new('N', "Asn", "Asparagine", "C(2)H(4)NO", :common)
O =
Residue.new('O', "Pyl", "Pyrrolysine", "C(9)H(17)NO", :standard)
P =
Residue.new('P', "Pro", "Proline", "C(3)H(5)", :common)
Q =
Residue.new('Q', "Gln", "Glutamine", "C(3)H(6)NO", :common)
R =
Residue.new('R', "Arg", "Arginine", "C(4)H(10)N(3)", :common)
S =
Residue.new('S', "Ser", "Serine", "CH(3)O", :common)
T =
Residue.new('T', "Thr", "Threonine", "C(2)H(5)O", :common)
U =
Residue.new('U', "Sec", "Selenocysteine", "CH(3)Se", :standard)
V =
Residue.new('V', "Val", "Valine", "C(3)H(7)", :common)
W =
Residue.new('W', "Trp", "Tryptophan", "C(9)H(8)N", :common)
Y =
Residue.new('Y', "Tyr", "Tyrosine", "C(7)H(7)O", :common)
ORN =
Residue.new(nil,   "Orn",  "Ornithine", "C(3)H(8)N", :uncommon)
ABA =
Residue.new(nil,   'Aba',  'Aminobutyric Acid', 'C(2)H(5)', :uncommon)
AECYS =
Residue.new(nil, 'AECys','Aminoethylcysteine', 'C(3)H(8)NS', :uncommon)
AIB =
Residue.new(nil,   'Aib',  'alpha-Aminoisobutyric Acid', 'C(2)H(5)', :uncommon)
CMCYS =
Residue.new(nil, 'CMCys','Carboxymethylcysteine', 'C(3)H(5)O(2)S', :uncommon)
DHA =
Residue.new(nil,   'Dha',  'Dehydroalanine', 'CH', :uncommon)
DHB =
Residue.new(nil,   'Dhb',  'Dehydroamino-alpha-butyric Acid', 'C(2)H(3)', :uncommon)
HYL =
Residue.new(nil,   'Hyl',  'Hydroxylysine', 'C(4)H(10)NO', :uncommon)
HYP =
Residue.new(nil,   'Hyp',  'Hydroxyproline', 'C(3)H(5)O', :uncommon)
IVA =
Residue.new(nil,   'Iva',  'Isovaline', 'C(3)H(7)', :uncommon)
NLEU =
Residue.new(nil,  'nLeu', 'Norleucine', 'C(4)H(9)', :uncommon)
PIP =
Residue.new(nil,   'Pip',  '2-Piperidinecarboxylic Acid', 'C(4)H(7)', :uncommon)
PGLU =
Residue.new(nil,  'pGlu', 'Pyroglutamic Acid', 'C(3)H(3)O', :uncommon)
SAR =
Residue.new(nil,   'Sar',  'Sarcosine', 'CH(3)', :uncommon)

Constants inherited from EmpiricalFormula

EmpiricalFormula::ELEMENT_INDEX, EmpiricalFormula::ELEMENT_INDEX_ORDER

Instance Attribute Summary collapse

Attributes inherited from EmpiricalFormula

#formula

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from EmpiricalFormula

#*, #+, #-, #==, #each, mass, #mass, parse, parse_simple, #to_s

Methods included from Utils

add, count, multiply, round

Constructor Details

#initialize(letter, abbr, name, side_chain_formula, classification = nil) ⇒ Residue

Returns a new instance of Residue.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/molecules/libraries/residue.rb', line 65

def initialize(letter, abbr, name, side_chain_formula, classification=nil)
  @side_chain = EmpiricalFormula.parse_simple(side_chain_formula)
  super( Utils.add(side_chain.formula.dup, BACKBONE.formula), false)

  @letter = letter
  @abbr = abbr
  @name = name
  @classification = classification

  @side_chain_mass = side_chain.mass
  @residue_mass = mass
  @immonium_ion_mass = @residue_mass + DELTA_IMMONIUM.mass
  
  @byte = nil
  @letter.each_byte do |byte|
    @byte = byte
    break
  end unless @letter == nil
end

Instance Attribute Details

#abbrObject (readonly)

The (typically) 3-letter abbreviation of self



40
41
42
# File 'lib/molecules/libraries/residue.rb', line 40

def abbr
  @abbr
end

#byteObject (readonly)

The byte corresponding to letter



46
47
48
# File 'lib/molecules/libraries/residue.rb', line 46

def byte
  @byte
end

#immonium_ion_massObject (readonly)

The unrounded mass of the immonium ion of self (residue_mass + DELTA_IMMONIUM.mass)



63
64
65
# File 'lib/molecules/libraries/residue.rb', line 63

def immonium_ion_mass
  @immonium_ion_mass
end

#letterObject (readonly)

The letter code for self



43
44
45
# File 'lib/molecules/libraries/residue.rb', line 43

def letter
  @letter
end

#nameObject (readonly)

The full name of self



37
38
39
# File 'lib/molecules/libraries/residue.rb', line 37

def name
  @name
end

#residue_massObject (readonly)

The uncharged, unrounded, monoisotopic residue mass of self (the backbone plus side chain mass, with no N- or C-terminus)



59
60
61
# File 'lib/molecules/libraries/residue.rb', line 59

def residue_mass
  @residue_mass
end

#side_chainObject (readonly)

An EmpiricalFormula representing the side chain of self



49
50
51
# File 'lib/molecules/libraries/residue.rb', line 49

def side_chain
  @side_chain
end

#side_chain_massObject (readonly)

The unrounded monoisotopic side chain mass of self



55
56
57
# File 'lib/molecules/libraries/residue.rb', line 55

def side_chain_mass
  @side_chain_mass
end

#typeObject (readonly)

A symbol classification of self



52
53
54
# File 'lib/molecules/libraries/residue.rb', line 52

def type
  @type
end

Class Method Details

.commonObject

The 20 common amino acids.



19
20
21
# File 'lib/molecules/libraries/residue.rb', line 19

def common
  collection(:common)
end

.residue_indexObject

An array of the residues indexed by the byte corresponding to the residue letter.



25
26
27
# File 'lib/molecules/libraries/residue.rb', line 25

def residue_index
  collection(:residue_index)
end

.residue_mass_indexObject

An array of the residue masses indexed by the byte corresponding to the residue letter.



31
32
33
# File 'lib/molecules/libraries/residue.rb', line 31

def residue_mass_index
  collection(:residue_mass_index)
end

Instance Method Details

#common?Boolean

True if the residue of type :common

Returns:

  • (Boolean)


86
87
88
# File 'lib/molecules/libraries/residue.rb', line 86

def common?
  @classification == :common
end

#composite?Boolean

True if the residue is a composite representing a set of isobaric residues

Returns:

  • (Boolean)


96
97
98
# File 'lib/molecules/libraries/residue.rb', line 96

def composite?
  @type == :composite
end

#standard?Boolean

True if the residue is type :common or :standard.

Returns:

  • (Boolean)


91
92
93
# File 'lib/molecules/libraries/residue.rb', line 91

def standard?
  @classification == :common || @classification == :standard
end