Class: Ms::Mascot::Spectrum

Inherits:
InSilico::Spectrum
  • Object
show all
Defined in:
lib/ms/mascot/spectrum.rb

Overview

Generates a Mascot-style theoretical spectrum. When the masses are set correctly, the theoretical spectrum will have zero error and full coverage (for whatever series are generated) when identified using Mascot.

Peptide Mass Error

The peptide mass calculated by Spectrum is inexact wrt to Mascot. Mascot uses some unknown algorithm to speed up it’s calculation and introduces some rounding/truncation error somewhere along the line. For instance, if you calculate the mass of a peptide by directly using the Unimod masses, it will NOT be the mass used by Mascot. For example:

def molecule_mass(c, h, n, o, s)
 c * 12 + h * 1.007825035 + n * 14.003074 + o * 15.99491463 + s * 31.9720707
end  

# Formula for MFSFVDLR: C(47)H(69)N(11)O(11)S(0)
# Formula for water:    C(0) H(2) N(0) O(1) S(0)

molecule_mass(47, 69, 11, 11, 1) + molecule_mass(0, 2, 0, 1, 0) 
# => 1013.500437745

Now by comparision:

mascot: 1013.500443
unimod: 1013.500437745
delta:     0.000005255

Similar or worse errors are typical and cannot be elimited by any known permutation (calculating from the residue masses, rounding etc). See gist.github.com/31241 for tasks that perform the calculation using various permutations.

One helpful note if you try to break the code, you can set the number of sig figs to 6 in mascot.dat (MassDecimalPlaces) and read the exact peptide mass numbers directly from a result page.

Spectrum calculates peptide mass using the masses in mass_map, ie the rounded residue masses.

Mascot-Specific Series Notation

Mascot::Spectrum adds support for a few mascot-specific notations.

Notation     Translation    Example
series+<n>   series + Hn    a++, y0++
series*      series - NH3   y*
series0      series - H2O   a0
Immon.       immonium       Immon.

It should be noted that Mascot applies unknown masks to these values; when using these types of series, Spectrum will often predict peaks that do not appear in a Mascot search result.

Constant Summary collapse

Element =
Constants::Libraries::Element
DEFAULT_MASS_MAP =

A map of the default [monoisotopic, average] masses for a variety of constants used by Mascot. The element masses can be traced back to Unimod and the residues calculated by using the Unimod masses, then rounding.

– Taken from the configuration pages on the Hansen Lab server:

{}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sequence, nterm = HYDROGEN, cterm = HYDROXIDE) ⇒ Spectrum

Returns a new instance of Spectrum.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/ms/mascot/spectrum.rb', line 154

def initialize(sequence, nterm=HYDROGEN, cterm=HYDROXIDE)
  @mass_map = {}
  DEFAULT_MASS_MAP.each_pair do |const, (mono, avg)|
    @mass_map[const] = mono  
  end
  
  super do |element|
    @mass_map[element]
  end

  [:a, :b, :c, :cladder].each {|key| mask_locations key, [-1] }
  [:x, :y, :Y, :z, :nladder].each {|key| mask_locations key, [0] }

  # # mask prolines
  # mask_locations :c, residue_locations['P'].collect {|i| i-1}
  # mask_locations :z, residue_locations['P']
end

Instance Attribute Details

#mass_mapObject (readonly)

A hash of masses to use in place of the Element/Molecule masses normally used in calculating a spectrum. By default mass map contains the monoisotopic masses specified in DEFAULT_MASS_MAP.

Note: to generate a zero-error spectrum for Mascot, it is important that mass_map contains the exact masses used by the server. If your server uses non-default masses, override the values in DEFAULT_MASS_MAP to affect all instances, or just mass_map to affect a single instance. See:

http://your.mascot.server/x-cgi/ms-config.exe

To check the mass values for your server.



152
153
154
# File 'lib/ms/mascot/spectrum.rb', line 152

def mass_map
  @mass_map
end