Class: AminoAcid

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/msf/models/amino_acid.rb

Overview

ActiveRecord model of MSF AminoAcid

Example:

AminoAcid.find(1)

AminoAcid.first.monoisotopic_mass

AminoAcid.first.amino_acid_modifications.first.modification_name

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.mass_for_one_letter_code(aa) ⇒ Object



16
17
18
# File 'lib/msf/models/amino_acid.rb', line 16

def self.mass_for_one_letter_code(aa)
  self.masses[aa]
end

.massesObject



9
10
11
12
13
14
15
# File 'lib/msf/models/amino_acid.rb', line 9

def self.masses
  if @masses.nil?
    @masses = {}
    AminoAcid.select("OneLetterCode,MonoisotopicMass").where("OneLetterCode != ' '").map {|aa| @masses[aa.one_letter_code] =  aa.monoisotopic_mass}
  end
  @masses
end

.primary_keyObject



22
23
24
# File 'lib/msf/models/amino_acid.rb', line 22

def self.primary_key
  :AminoAcidID
end

.table_nameObject



19
20
21
# File 'lib/msf/models/amino_acid.rb', line 19

def self.table_name
  :AminoAcids
end

Instance Method Details

#amino_acid_idObject



25
26
27
# File 'lib/msf/models/amino_acid.rb', line 25

def amino_acid_id
  self.AminoAcidID
end

#amino_acid_nameObject



28
29
30
# File 'lib/msf/models/amino_acid.rb', line 28

def amino_acid_name
  self.AminoAcidName
end

#average_massObject



40
41
42
# File 'lib/msf/models/amino_acid.rb', line 40

def average_mass
  self.AverageMass
end

#monoisotopic_massObject



37
38
39
# File 'lib/msf/models/amino_acid.rb', line 37

def monoisotopic_mass
  self.MonoisotopicMass
end

#one_letter_codeObject



31
32
33
# File 'lib/msf/models/amino_acid.rb', line 31

def one_letter_code
  self.OneLetterCode
end

#sum_formulaObject



43
44
45
# File 'lib/msf/models/amino_acid.rb', line 43

def sum_formula
  self.SumFormula
end

#three_letter_codeObject



34
35
36
# File 'lib/msf/models/amino_acid.rb', line 34

def three_letter_code
  self.ThreeLetterCode
end