|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.experiment.massspectrometry.SpectrumFactory
public class SpectrumFactory
This factory will provide the spectra when needed
Method Summary | |
---|---|
void |
addSpectra(java.io.File spectrumFile)
Add spectra to the factory |
void |
closeFiles()
Closes all opened files |
int |
getCacheSize()
returns the cache size |
MgfIndex |
getIndex(java.io.File mgfIndex)
Deserializes the index of an mgf file |
static SpectrumFactory |
getInstance()
static method returning the instance of the factory |
static SpectrumFactory |
getInstance(int nCache)
Static method returning the instance of the factory with a new cache size |
java.util.ArrayList<java.lang.String> |
getMgfFileNames()
Returns a list of loaded mgf files |
java.util.ArrayList<java.lang.String> |
getMzMLFileNames()
Returns a list of loaded mzML files |
Precursor |
getPrecursor(java.lang.String spectrumKey)
Returns the precursor of the desired spectrum |
Precursor |
getPrecursor(java.lang.String fileName,
java.lang.String spectrumTitle)
Returns the precursor of the desired spectrum |
Spectrum |
getSpectrum(java.lang.String spectrumKey)
Returns the spectrum desired |
Spectrum |
getSpectrum(java.lang.String SpectrumFile,
java.lang.String SpectrumTitle)
Returns the spectrum desired |
java.util.ArrayList<java.lang.String> |
getSpectrumTitles(java.lang.String mgfFile)
Returns a list of titles from indexed spectra in the given file |
void |
setCacheSize(int nCache)
Sets the cache size |
void |
writeIndex(MgfIndex mgfIndex,
java.io.File directory)
Writes the given mgf file index in the given directory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static SpectrumFactory getInstance()
public static SpectrumFactory getInstance(int nCache)
nCache
-
public void setCacheSize(int nCache)
nCache
- the new cache sizepublic int getCacheSize()
public void addSpectra(java.io.File spectrumFile) throws java.io.FileNotFoundException, java.io.IOException, java.lang.ClassNotFoundException, java.lang.Exception
spectrumFile
- The spectrum file, can be mgf or mzML
java.io.FileNotFoundException
- Exception thrown whenever the file was not found
java.io.IOException
- Exception thrown whenever an error occurred while reading the file
java.lang.ClassNotFoundException
- Exception thrown whenever an error occurred while deserializing the index .cui file.
java.lang.Exception
- Exception thrown whenever the mgf file was not correctly parsedpublic Precursor getPrecursor(java.lang.String fileName, java.lang.String spectrumTitle) throws java.lang.Exception
fileName
- the name of the spectrum filespectrumTitle
- the title of the spectrum
java.lang.Exception
- exception thrown whenever the file was not parsed correctlypublic Precursor getPrecursor(java.lang.String spectrumKey) throws java.lang.Exception
spectrumKey
- the key of the spectrum
java.lang.Exception
- exception thrown whenever the file was not parsed correctlypublic Spectrum getSpectrum(java.lang.String SpectrumFile, java.lang.String SpectrumTitle) throws java.io.IOException, java.lang.Exception
fileName
- name of the spectrum filespectrumTitle
- title of the spectrum
java.io.IOException
- exception thrown whenever an error occurred while reading the file
java.lang.Exception
- exception thrown whenever an error occurred while parsing the filepublic Spectrum getSpectrum(java.lang.String spectrumKey) throws java.io.IOException, java.lang.Exception
spectrumKey
- key of the spectrum
java.io.IOException
- exception thrown whenever an error occurred while reading the file
java.lang.Exception
- exception thrown whenever an error occurred while parsing the filepublic void writeIndex(MgfIndex mgfIndex, java.io.File directory) throws java.io.IOException
mgfIndex
- the mgf file indexdirectory
- the destination directory
java.io.IOException
- exception thrown whenever an error is encountered while writing the filepublic MgfIndex getIndex(java.io.File mgfIndex) throws java.io.FileNotFoundException, java.io.IOException, java.lang.ClassNotFoundException
mgfIndex
- the mgf index cuifile
java.io.FileNotFoundException
- exception thrown whenever the file was not found
java.io.IOException
- exception thrown whenever an error was encountered while reading the file
java.lang.ClassNotFoundException
- exception thrown whenever an error occurred while deserializing the objectpublic void closeFiles() throws java.io.IOException
java.io.IOException
- exception thrown whenever an error occurred while closing the filespublic java.util.ArrayList<java.lang.String> getMgfFileNames()
public java.util.ArrayList<java.lang.String> getMzMLFileNames()
public java.util.ArrayList<java.lang.String> getSpectrumTitles(java.lang.String mgfFile)
mgfFile
- the name of the mgf file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |