|
||||||||||
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(File spectrumFile)
Add spectra to the factory. |
void |
addSpectra(File spectrumFile,
JProgressBar progressBar)
Add spectra to the factory. |
void |
closeFiles()
Closes all opened files. |
int |
getCacheSize()
Returns the cache size. |
MgfIndex |
getIndex(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. |
Double |
getMaxRT()
Returns the maximum RT for the whole project. |
Double |
getMaxRT(String fileName)
Returns the maximum RT for the desired file. |
ArrayList<String> |
getMgfFileNames()
Returns a list of loaded mgf files. |
Double |
getMinRT()
Returns the minimum RT for the whole project. |
Double |
getMinRT(String fileName)
Returns the minimum RT for the desired file. |
ArrayList<String> |
getMzMLFileNames()
Returns a list of loaded mzML files. |
int |
getNSpectra(String fileName)
Returns the number of spectra in the desired file. |
Precursor |
getPrecursor(String spectrumKey)
Returns the precursor of the desired spectrum. |
Precursor |
getPrecursor(String spectrumKey,
boolean save)
Returns the precursor of the desired spectrum. |
Precursor |
getPrecursor(String fileName,
String spectrumTitle)
Returns the precursor of the desired spectrum. |
Spectrum |
getSpectrum(String spectrumKey)
Returns the desired spectrum. |
Spectrum |
getSpectrum(String spectrumFile,
String spectrumTitle)
Returns the desired spectrum. |
ArrayList<String> |
getSpectrumTitles(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,
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(File spectrumFile) throws FileNotFoundException, IOException, ClassNotFoundException
spectrumFile
- The spectrum file, can be mgf or mzML
FileNotFoundException
- Exception thrown whenever the file was not found
IOException
- Exception thrown whenever an error occurred while reading the file
ClassNotFoundException
- Exception thrown whenever an error occurred while deserializing the index .cui file.public void addSpectra(File spectrumFile, JProgressBar progressBar) throws FileNotFoundException, IOException, IllegalArgumentException
spectrumFile
- The spectrum file, can be mgf or mzMLprogressBar
- a progress bar showing the progress
FileNotFoundException
- Exception thrown whenever the file was not found
IOException
- Exception thrown whenever an error occurred while reading the file
IllegalArgumentException
- Exception thrown if an unknown format was detected.public Precursor getPrecursor(String fileName, String spectrumTitle) throws IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
fileName
- the name of the spectrum filespectrumTitle
- the title of the spectrum
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(String spectrumKey) throws IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException, IllegalArgumentException
spectrumKey
- the key of the spectrum
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
IllegalArgumentException
- exception thrown whenever the file was not parsed correctlypublic Double getMaxRT(String fileName)
fileName
- the file of interest
public Double getMinRT(String fileName)
fileName
- the file of interest
public Double getMaxRT()
public Double getMinRT()
public int getNSpectra(String fileName)
fileName
- the file of interest
public Precursor getPrecursor(String spectrumKey, boolean save) throws IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException, IllegalArgumentException
spectrumKey
- the key of the spectrumsave
- boolean indicating whether the loaded precursor should be stored in the factory
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
IllegalArgumentException
- exception thrown whenever the file was not parsed correctlypublic Spectrum getSpectrum(String spectrumFile, String spectrumTitle) throws IOException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
spectrumFile
- name of the spectrum filespectrumTitle
- title of the spectrum
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(String spectrumKey) throws IOException, IllegalArgumentException, uk.ac.ebi.jmzml.xml.io.MzMLUnmarshallerException
spectrumKey
- key of the spectrum
IOException
- exception thrown whenever an error occurred while reading the file
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, File directory) throws IOException
mgfIndex
- the mgf file indexdirectory
- the destination directory
IOException
- exception thrown whenever an error is encountered while writing the filepublic MgfIndex getIndex(File mgfIndex) throws FileNotFoundException, IOException, ClassNotFoundException
mgfIndex
- the mgf index cuifile
FileNotFoundException
- exception thrown whenever the file was not found
IOException
- exception thrown whenever an error was encountered while reading the file
ClassNotFoundException
- exception thrown whenever an error occurred while deserializing the objectpublic void closeFiles() throws IOException
IOException
- exception thrown whenever an error occurred while closing the filespublic ArrayList<String> getMgfFileNames()
public ArrayList<String> getMzMLFileNames()
public ArrayList<String> getSpectrumTitles(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 |