Class: Ms::InSilico::Fragment

Inherits:
Tap::Task
  • Object
show all
Defined in:
lib/ms/in_silico/fragment.rb

Overview

:startdoc::task calculates a theoretical ms/ms spectrum

Calculates the theoretical ms/ms spectrum for a peptide sequence. Configurations allow the specification of one or more fragmentation series to include, as well as charge, and intensity.

In the output the sorted fragmentation data is given first, followed by a hash of header data, including the parent ion mass.

Constant Summary collapse

MOLECULE =

A block to validate a config input is an EmpericalFormula.

empirical_formula_block

Instance Method Summary collapse

Instance Method Details

#headers(spec) ⇒ Object

Constructs a hash of header data pertinent to the spectrum.



37
38
39
40
41
42
43
44
45
# File 'lib/ms/in_silico/fragment.rb', line 37

def headers(spec)
  {
    :charge => charge,
    :parent_ion_mass => spec.parent_ion_mass(charge),
    :series => series,
    :nterm => spec.nterm.to_s,
    :cterm => spec.cterm.to_s
  }
end

#process(peptide) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ms/in_silico/fragment.rb', line 47

def process(peptide)
  log :fragment, peptide
  spec = spectrum(peptide)
  
  masses = []
  series.each {|s| masses.concat(spec.series(s)) }
  masses.delete_if {|m| m < 0 } if unmask
  masses.sort! if sort
  masses.collect! {|m| [m, intensity] } if intensity
  
  [masses, headers(spec)]
end