SIB

Recipe 1.3 - Creating Spectrum

Problem

You want to make instance of Spectrum.

Solution

Spectrum is a PeakList. It is an abstract class that wraps a PeakList. Actually, 3 implementations are provided.

  1. MsnSpectrum represents spectrum scan
  2. PeptideSpectrum represents peptide spectrum match (PSM)
  3. LibrarySpectrum represents spectrum spectrum match (SSM) for building spectral library
A Spectrum is a PeakList with experimental spectrum information


MsnSpectrum spectrum = new MsnSpectrum(PeakList.Precision.DOUBLE);
spectrum.setSpectrumSource(URI.create("file:/spectra.mgf"));
spectrum.setComment("my first spectrum");
spectrum.addRetentionTimes(new RetentionTimeList(new RetentionTimeDiscrete(0.57, TimeUnit.SECOND)));

Discussion

See also

Recipe 1.1 describes how to add and access peaks.

Recipe 2.1 show you how to use our MS readers.

Recipe 3.2 explains how to generate theoretical peptide spectrum.