com.compomics.util.experiment.massspectrometry
Class SpectrumCollection

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.massspectrometry.SpectrumCollection
All Implemented Interfaces:
Serializable, Cloneable

public class SpectrumCollection
extends ExperimentObject

This class represents a collection of spectra acquired during a proteomicAnalysis

Author:
Marc
See Also:
Serialized Form

Field Summary
static int MGF
          static index for an mgf collection
static int MZML
          static index for an mzML collection
 
Constructor Summary
SpectrumCollection()
          constructor for an empty collection (The import source must be specified afterwards!)
SpectrumCollection(int sourceType)
          Constructor
 
Method Summary
 void addIdentifiedSpectra(File file, Ms2Identification identification)
          Adds all spectra identified in the specified identification
 void addSpectra(File file)
          Adds all spectra from a file
 void addSpectrum(MSnSpectrum spectrum)
          Adds a spectrum to the collection
 boolean contains(String spectrumKey)
          Returns wheter a spectrum is contained in the collection
 ArrayList<String> getAllKeys()
          Returns the keys of all loaded spectra
 ArrayList<String> getAllKeys(int level)
          Returns all keys of the spectra loaded at the specified level
 int getSourceType()
          Returns the source type as indexed by the static fields
 Spectrum getSpectrum(int level, String spectrumKey)
          Getter for a spectrum
 Spectrum getSpectrum(String spectrumKey)
          Getter for a spectrum
 void removePeaks()
          Removes all peaklists from the loaded spectra in order to save memory (useless with mzML data)
 void setSourceType(int sourceType)
          Sets the source type as defined by the static fields
 
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, getUrParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MGF

public static final int MGF
static index for an mgf collection

See Also:
Constant Field Values

MZML

public static final int MZML
static index for an mzML collection

See Also:
Constant Field Values
Constructor Detail

SpectrumCollection

public SpectrumCollection()
constructor for an empty collection (The import source must be specified afterwards!)


SpectrumCollection

public SpectrumCollection(int sourceType)
Constructor

Method Detail

addSpectrum

public void addSpectrum(MSnSpectrum spectrum)
Adds a spectrum to the collection

Parameters:
spectrum - the selected spectrum

getSpectrum

public Spectrum getSpectrum(int level,
                            String spectrumKey)
                     throws uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
Getter for a spectrum

Parameters:
level - Level at which the spectrum was recorded (2 for MS2 spectra)
spectrumKey - Key of the spectrum
Returns:
the desired spectrum
Throws:
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException - Exception thrown by the mzML unmarshaller

getSpectrum

public Spectrum getSpectrum(String spectrumKey)
                     throws uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
Getter for a spectrum

Parameters:
spectrumKey - Key of the spectrum
Returns:
the desired spectrum
Throws:
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException - Exception thrown by the mzML unmarshaller

getAllKeys

public ArrayList<String> getAllKeys(int level)
Returns all keys of the spectra loaded at the specified level

Parameters:
level - the specified level
Returns:
all keys of the spectra loaded

getAllKeys

public ArrayList<String> getAllKeys()
Returns the keys of all loaded spectra

Returns:
the keys of all loaded spectra

getSourceType

public int getSourceType()
Returns the source type as indexed by the static fields

Returns:
the source type as indexed by the static fields

setSourceType

public void setSourceType(int sourceType)
Sets the source type as defined by the static fields

Parameters:
sourceType - the source type

addSpectra

public void addSpectra(File file)
                throws Exception
Adds all spectra from a file

Parameters:
file - The file to load spectra from
Throws:
Exception - Exception thrown whenever an error is encountered while loading the file

addIdentifiedSpectra

public void addIdentifiedSpectra(File file,
                                 Ms2Identification identification)
                          throws Exception
Adds all spectra identified in the specified identification

Parameters:
file - The file containing all identifications
identification - The identification of the proteomic analysis
Throws:
Exception - Exception thrown whenever an error is encountered why loading the file

contains

public boolean contains(String spectrumKey)
Returns wheter a spectrum is contained in the collection

Parameters:
spectrumKey - The spectrum Key
Returns:
a boolean indicating whether the spectrum is contained in the collection

removePeaks

public void removePeaks()
Removes all peaklists from the loaded spectra in order to save memory (useless with mzML data)



Copyright © 2011. All Rights Reserved.