Class: Peptide

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

Overview

ActiveRecord model of MSF Peptide

Example:

Peptide.find(1)
Peptide.first.sequence
Peptide.first.internal_modifications
Peptide.first.terminal_modification

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.primary_keyObject



13
14
15
# File 'lib/msf/models/peptide.rb', line 13

def self.primary_key
  :PeptideID
end

.table_nameObject



10
11
12
# File 'lib/msf/models/peptide.rb', line 10

def self.table_name
  :Peptides
end

Instance Method Details

#annotationObject



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

def annotation
  self.Annotation
end

#confidence_levelObject



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

def confidence_level
  self.ConfidenceLevel
end

#hiddenObject



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

def hidden
  self.Hidden
end

#isobar_sequenceObject



81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/msf/models/peptide.rb', line 81

def isobar_sequence
  nterm = ''
  unless self.terminal_modification.nil?
    nterm = "#{self.terminal_modification.modification_name}:"
  end
  sequence_amino_acids = self.sequence.split(//)
  isobar_amino_acids = []
  sequence_amino_acids.count.times { isobar_amino_acids << ":"}
  self.peptides_amino_acid_modifications.each do |modification|
    isobar_amino_acids[modification.position] = "#{modification.internal_modification.modification_name}_#{sequence_amino_acids[modification.position]}:"
  end
  nterm + isobar_amino_acids.join("")
end

#matched_ions_countObject



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

def matched_ions_count
  self.MatchedIonsCount
end

#missed_cleavagesObject



49
50
51
# File 'lib/msf/models/peptide.rb', line 49

def missed_cleavages
  self.MissedCleavages
end

#modified_sequenceObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/msf/models/peptide.rb', line 67

def modified_sequence
  nterm = ''
  cterm = '-COOH'
  if self.terminal_modification.nil?
    nterm = "NH2-"
  else
    nterm = "#{self.terminal_modification.modification_name}-"
  end
  sequence_amino_acids = self.sequence.split(//)
  self.peptides_amino_acid_modifications.each do |modification|
    sequence_amino_acids[modification.position] = "#{sequence_amino_acids[modification.position]}<#{modification.internal_modification.modification_name}>"
  end
  nterm + sequence_amino_acids.join("") + cterm
end

#peptide_idObject



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

def peptide_id
  self.PeptideID
end

#processing_node_numberObject



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

def processing_node_number
  self.ProcessingNodeNumber
end

#search_engine_rankObject



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

def search_engine_rank
  self.SearchEngineRank
end

#sequenceObject



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

def sequence
  self.Sequence
end

#spectrum_idObject



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

def spectrum_id
  self.SpectrumID
end

#theoretical_massObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/msf/models/peptide.rb', line 52

def theoretical_mass
  mass = 0
  charge = self.spectrum.spectrum_header.charge
  self.sequence.split(//).each do |aa|
    mass += AminoAcid.mass_for_one_letter_code(aa)
  end
  self.peptides_amino_acid_modifications.each do |modification|
    mass += modification.internal_modification.delta_mass
  end
  unless self.terminal_modification.nil?
    mass += self.terminal_modification.delta_mass
  end
  mass += 1.007825 + 15.994910 + 1.007825
  mass = (mass  + (charge * 1.007825)) / charge
end

#total_ions_countObject



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

def total_ions_count
  self.TotalIonsCount
end

#unique_peptide_sequence_idObject



46
47
48
# File 'lib/msf/models/peptide.rb', line 46

def unique_peptide_sequence_id
  self.UniquePeptideSequenceID
end