Class CmsFileReader
java.lang.Object
com.compomics.util.experiment.io.mass_spectrometry.cms.CmsFileReader
- All Implemented Interfaces:
SpectrumProvider,AutoCloseable
Reader for Compomics Mass Spectrometry (cms) files.
- Author:
- Marc Vaudel, Harald Barsnes
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCmsFileReader(File file, WaitingHandler waitingHandler) Constructor allocating for single thread usage. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the absolute path to the cms file indexed by ms file name without file extension.Returns the absolute path to the original mass spec file containing the spectra in a map indexed by file name without file extension.doubleReturns the maximum precursor intensity among all files.doublegetMaxPrecInt(String fileName) Returns the maximum precursor intensity in a given file.doubleReturns the maximum precursor m/z among all files.doublegetMaxPrecMz(String fileName) Returns the maximum precursor m/z in a given file.doubleReturns the maximum precursor RT among all files.doublegetMaxPrecRT(String fileName) Returns the maximum precursor RT in a given file.doubleReturns the minimum precursor m/z among all files.doublegetMinPrecMz(String fileName) Returns the minimum precursor m/z in a given file.String[]Returns the spectrum file names without file extensions.double[][]Returns the peaks of the spectrum with the given title.double[][]Returns the spectrum peaks.getPostcursorSpectrumTitles(String fileNameWithoutExtension, String spectrumTitle) Returns the postcursor spectrum titles.getPrecursor(String spectrumTitle) Returns the precursor of the spectrum with the given title.getPrecursor(String fileName, String spectrumTitle) Returns the precursor.doublegetPrecursorMz(String spectrumTitle) Returns the m/z of the precursor of the spectrum with the given title.doublegetPrecursorMz(String fileName, String spectrumTitle) Returns the measured precursor m/z.doublegetPrecursorRt(String spectrumTitle) Returns the RT of the precursor of the spectrum with the given title.doublegetPrecursorRt(String fileName, String spectrumTitle) Returns the precursor RT window.getSpectrum(String spectrumTitle) Returns the spectrum with the given title.getSpectrum(String fileName, String spectrumTitle) Returns the spectrum with the given title in the given file.intgetSpectrumLevel(String spectrumTitle) Returns the spectrum level of the spectrum with the given title.intgetSpectrumLevel(String fileName, String spectrumTitle) Returns the spectrum level.String[]getSpectrumTitles(String fileName) Returns the spectrum titles for the given mass spectrometry file name.static byte[]uncompress(byte[] compressedByteArray, int uncompressedLength) Uncompresses the given byte array.
-
Field Details
-
titles
The titles of the spectra.
-
-
Constructor Details
-
CmsFileReader
public CmsFileReader(File file, WaitingHandler waitingHandler) throws FileNotFoundException, IOException Constructor allocating for single thread usage.- Parameters:
file- the file to readwaitingHandler- the waiting handler- Throws:
FileNotFoundException- thrown if the file was not foundIOException- thrown if an error occurred while attempting to read the file
-
-
Method Details
-
getSpectrum
Returns the spectrum with the given title.- Parameters:
spectrumTitle- title of the spectrum- Returns:
- the spectrum
-
getPrecursor
Returns the precursor of the spectrum with the given title.- Parameters:
spectrumTitle- title of the spectrum- Returns:
- the precursor of the spectrum
-
getPrecursorMz
Returns the m/z of the precursor of the spectrum with the given title.- Parameters:
spectrumTitle- the title of the spectrum- Returns:
- the precursor m/z of the spectrum
-
getPrecursorRt
Returns the RT of the precursor of the spectrum with the given title.- Parameters:
spectrumTitle- the title of the spectrum- Returns:
- the precursor RT of the spectrum
-
getSpectrumLevel
Returns the spectrum level of the spectrum with the given title.- Parameters:
spectrumTitle- the title of the spectrum- Returns:
- the spectrum level of the spectrum
-
getPeaks
Returns the peaks of the spectrum with the given title.- Parameters:
spectrumTitle- the title of the spectrum- Returns:
- the peaks of the spectrum
-
uncompress
public static byte[] uncompress(byte[] compressedByteArray, int uncompressedLength) Uncompresses the given byte array.- Parameters:
compressedByteArray- the compressed byte arrayuncompressedLength- the uncompressed length- Returns:
- the uncompressed array
-
getSpectrum
Description copied from interface:SpectrumProviderReturns the spectrum with the given title in the given file.- Specified by:
getSpectrumin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The spectrum with the given title in the given file.
-
getPrecursor
Description copied from interface:SpectrumProviderReturns the precursor. Null if none.- Specified by:
getPrecursorin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The precursor.
-
getPrecursorMz
Description copied from interface:SpectrumProviderReturns the measured precursor m/z. NaN if none.- Specified by:
getPrecursorMzin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The measured precursor m/z.
-
getPrecursorRt
Description copied from interface:SpectrumProviderReturns the precursor RT window. NaN if none.- Specified by:
getPrecursorRtin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The precursor RT.
-
getSpectrumLevel
Description copied from interface:SpectrumProviderReturns the spectrum level.- Specified by:
getSpectrumLevelin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The spectrum level.
-
getPeaks
Description copied from interface:SpectrumProviderReturns the spectrum peaks.- Specified by:
getPeaksin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The peaks.
-
getMinPrecMz
Description copied from interface:SpectrumProviderReturns the minimum precursor m/z in a given file.- Specified by:
getMinPrecMzin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.- Returns:
- The minimum precursor m/z in a given file.
-
getMaxPrecMz
Description copied from interface:SpectrumProviderReturns the maximum precursor m/z in a given file.- Specified by:
getMaxPrecMzin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.- Returns:
- The maximum precursor m/z in a given file.
-
getMaxPrecInt
Description copied from interface:SpectrumProviderReturns the maximum precursor intensity in a given file.- Specified by:
getMaxPrecIntin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.- Returns:
- The maximum precursor intensity in a given file.
-
getMaxPrecRT
Description copied from interface:SpectrumProviderReturns the maximum precursor RT in a given file.- Specified by:
getMaxPrecRTin interfaceSpectrumProvider- Parameters:
fileName- The name of the spectrum file without file extension.- Returns:
- The maximum precursor RT in a given file.
-
getMinPrecMz
public double getMinPrecMz()Description copied from interface:SpectrumProviderReturns the minimum precursor m/z among all files.- Specified by:
getMinPrecMzin interfaceSpectrumProvider- Returns:
- The minimum precursor m/z among all files.
-
getMaxPrecMz
public double getMaxPrecMz()Description copied from interface:SpectrumProviderReturns the maximum precursor m/z among all files.- Specified by:
getMaxPrecMzin interfaceSpectrumProvider- Returns:
- The maximum precursor m/z among all files.
-
getMaxPrecInt
public double getMaxPrecInt()Description copied from interface:SpectrumProviderReturns the maximum precursor intensity among all files.- Specified by:
getMaxPrecIntin interfaceSpectrumProvider- Returns:
- The maximum precursor intensity among all files.
-
getMaxPrecRT
public double getMaxPrecRT()Description copied from interface:SpectrumProviderReturns the maximum precursor RT among all files.- Specified by:
getMaxPrecRTin interfaceSpectrumProvider- Returns:
- The maximum precursor RT among all files.
-
getOrderedFileNamesWithoutExtensions
Description copied from interface:SpectrumProviderReturns the spectrum file names without file extensions.- Specified by:
getOrderedFileNamesWithoutExtensionsin interfaceSpectrumProvider- Returns:
- The spectrum file names without file extensions.
-
getFilePaths
Description copied from interface:SpectrumProviderReturns the absolute path to the original mass spec file containing the spectra in a map indexed by file name without file extension.- Specified by:
getFilePathsin interfaceSpectrumProvider- Returns:
- The absolute path to the original mass spec file containing the spectra in a map indexed by file name.
-
getCmsFilePaths
Description copied from interface:SpectrumProviderReturns the absolute path to the cms file indexed by ms file name without file extension. Null if none.- Specified by:
getCmsFilePathsin interfaceSpectrumProvider- Returns:
- The absolute path to the cms file indexed by ms file name.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSpectrumProvider
-
getSpectrumTitles
Description copied from interface:SpectrumProviderReturns the spectrum titles for the given mass spectrometry file name.- Specified by:
getSpectrumTitlesin interfaceSpectrumProvider- Parameters:
fileName- The mass spectrometry file name without file extension.- Returns:
- The spectrum titles as array.
-
getPostcursorSpectrumTitles
public ArrayList<String> getPostcursorSpectrumTitles(String fileNameWithoutExtension, String spectrumTitle) Description copied from interface:SpectrumProviderReturns the postcursor spectrum titles. Null if none.- Specified by:
getPostcursorSpectrumTitlesin interfaceSpectrumProvider- Parameters:
fileNameWithoutExtension- The name of the spectrum file without file extension.spectrumTitle- The title of the spectrum.- Returns:
- The postcursor spectrum titles. Null if none.
-