|
||||||||||
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 |
addIdNameMapping(java.lang.String idName,
java.io.File spectrumFile)
Adds an id to spectrum name in the mapping |
void |
addSpectra(java.io.File spectrumFile)
Add spectra to the factory. |
void |
addSpectra(java.io.File spectrumFile,
javax.swing.JProgressBar progressBar)
Add spectra to the factory. |
void |
closeFiles()
Closes all opened files. |
int |
getCacheSize()
Returns the spectrum 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.lang.Double |
getMaxMz()
Returns the maximum m/z for the whole project. |
java.lang.Double |
getMaxMz(java.lang.String fileName)
Returns the maximum m/z for the desired file. |
java.lang.Double |
getMaxRT()
Returns the maximum RT for the whole project. |
java.lang.Double |
getMaxRT(java.lang.String fileName)
Returns the maximum RT for the desired file. |
java.util.ArrayList<java.lang.String> |
getMgfFileNames()
Returns a list of loaded mgf files. |
java.lang.Double |
getMinRT()
Returns the minimum RT for the whole project. |
java.lang.Double |
getMinRT(java.lang.String fileName)
Returns the minimum RT for the desired file. |
java.util.ArrayList<java.lang.String> |
getMzMLFileNames()
Returns a list of loaded mzML files. |
int |
getNSpectra(java.lang.String fileName)
Returns the number of spectra in the desired file. |
Precursor |
getPrecursor(java.lang.String spectrumKey)
Returns the precursor of the desired spectrum. |
Precursor |
getPrecursor(java.lang.String spectrumKey,
boolean save)
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 desired spectrum. |
Spectrum |
getSpectrum(java.lang.String spectrumFile,
java.lang.String spectrumTitle)
Returns the desired spectrum. |
java.io.File |
getSpectrumFileFromIdName(java.lang.String idName)
Returns the spectrum file corresponding to the name of the file used for identification |
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 spectrum 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
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.public void addSpectra(java.io.File spectrumFile, javax.swing.JProgressBar progressBar) throws java.io.FileNotFoundException, java.io.IOException, java.lang.IllegalArgumentException
spectrumFile
- The spectrum file, can be mgf or mzMLprogressBar
- a progress bar showing the progress
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.IllegalArgumentException
- Exception thrown if an unknown format
was detected.public Precursor getPrecursor(java.lang.String fileName, java.lang.String spectrumTitle) throws java.io.IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
fileName
- the name of the spectrum filespectrumTitle
- the title of the spectrum
java.io.IOException
- exception thrown whenever the file was not parsed
correctly
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
- exception thrown whenever the file was
not parsed correctlypublic Precursor getPrecursor(java.lang.String spectrumKey) throws java.io.IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException, java.lang.IllegalArgumentException
spectrumKey
- the key of the spectrum
java.io.IOException
- exception thrown whenever the file was not parsed
correctly
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
- exception thrown whenever the file was
not parsed correctly
java.lang.IllegalArgumentException
- exception thrown whenever the file was
not parsed correctlypublic java.lang.Double getMaxMz(java.lang.String fileName)
fileName
- the file of interest
public java.lang.Double getMaxMz()
public java.lang.Double getMaxRT(java.lang.String fileName)
fileName
- the file of interest
public java.lang.Double getMinRT(java.lang.String fileName)
fileName
- the file of interest
public java.lang.Double getMaxRT()
public java.lang.Double getMinRT()
public int getNSpectra(java.lang.String fileName)
fileName
- the file of interest
public Precursor getPrecursor(java.lang.String spectrumKey, boolean save) throws java.io.IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException, java.lang.IllegalArgumentException
spectrumKey
- the key of the spectrumsave
- boolean indicating whether the loaded precursor should be
stored in the factory
java.io.IOException
- exception thrown whenever the file was not parsed
correctly
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
- exception thrown whenever the file was
not parsed correctly
java.lang.IllegalArgumentException
- exception thrown whenever the file was
not parsed correctlypublic Spectrum getSpectrum(java.lang.String spectrumFile, java.lang.String spectrumTitle) throws java.io.IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
spectrumFile
- name of the spectrum filespectrumTitle
- title of the spectrum
java.io.IOException
- exception thrown whenever an error occurred while
reading the file
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
- exception thrown whenever an error
occurred while parsing the mzML filepublic Spectrum getSpectrum(java.lang.String spectrumKey) throws java.io.IOException, java.lang.IllegalArgumentException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
spectrumKey
- key of the spectrum
java.io.IOException
- exception thrown whenever an error occurred while
reading the file
java.lang.IllegalArgumentException
- exception thrown whenever an error
occurred while parsing the file
uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
- 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
public void addIdNameMapping(java.lang.String idName, java.io.File spectrumFile)
idName
- name according to the id filespectrumFile
- the spectrum filepublic java.io.File getSpectrumFileFromIdName(java.lang.String idName)
idName
- the name of the spectrum file according to the
identification file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |