public class MspReader extends MgfReader
Constructor and Description |
---|
MspReader()
General Constructor for .msp file format reader.
|
Modifier and Type | Method and Description |
---|---|
static void |
addMissingSpectrumTitles(File mspFile,
WaitingHandler waitingHandler)
Adds missing spectrum titles.
|
static MgfIndex |
getIndexMap(File mspFile,
WaitingHandler waitingHandler)
Returns the index of all spectra in the given MSP file.
|
static Precursor |
getPrecursor(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile,
Long index,
String fileName)
Returns the next precursor starting from the given index.
|
ArrayList<MSnSpectrum> |
getSpectra(File aFile)
Reads an MSP file and retrieves a list of spectra.
|
static MSnSpectrum |
getSpectrum(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile,
long index,
String fileName)
Returns the next spectrum starting from the given index.
|
static MSnSpectrum |
getSpectrum(BufferedReader br,
String fileName)
The function returns the next spectrum found in the msp file.
|
static void |
removeZeroes(File File,
WaitingHandler waitingHandler)
Removes zero intensity peaks.
|
static void |
renameDuplicateSpectrumTitles(File mspFile,
WaitingHandler waitingHandler)
Renames duplicate spectrum titles.
|
ArrayList<MgfIndex> |
splitFile(File mspFile,
int nSpectra,
WaitingHandler waitingHandler)
Splits an msp file into smaller ones and returns the indexes of the
generated files.
|
addMissingPrecursorCharges, getIndexMap, removeDuplicateSpectrumTitles, writeAplFile
public static MSnSpectrum getSpectrum(BufferedReader br, String fileName) throws IOException
br
- a buffered readerfileName
- name of the msp fileIOException
- if an IOException occurspublic ArrayList<MSnSpectrum> getSpectra(File aFile) throws FileNotFoundException, IOException, IllegalArgumentException
getSpectra
in class MgfReader
aFile
- the msp fileFileNotFoundException
- Exception thrown if a problem is
encountered reading the fileIOException
- Exception thrown if a problem is encountered reading
the fileIllegalArgumentException
- thrown when a parameter in the file
cannot be parsed correctlypublic static MgfIndex getIndexMap(File mspFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
mspFile
- the given MSP filewaitingHandler
- a waitingHandler showing the progressFileNotFoundException
- Exception thrown whenever the file is not
foundIOException
- Exception thrown whenever an error occurs while
reading the filepublic static void addMissingSpectrumTitles(File mspFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mspFile
- the MSP file to fixwaitingHandler
- a waitingHandler showing the progress, can be nullFileNotFoundException
- Exception thrown whenever the file is not
foundIOException
- Exception thrown whenever an error occurs while
reading the fileUnsupportedEncodingException
- if the decoding of a spectrum title
failspublic static void removeZeroes(File File, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
File
- the MSP file to fixwaitingHandler
- a waitingHandler showing the progress, can be nullFileNotFoundException
- Exception thrown whenever the file is not
foundIOException
- Exception thrown whenever an error occurs while
reading the fileUnsupportedEncodingException
- if the decoding of a spectrum title
failspublic static void renameDuplicateSpectrumTitles(File mspFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mspFile
- the MSP file to validatewaitingHandler
- a waitingHandler showing the progressFileNotFoundException
- Exception thrown whenever the file is not
foundIOException
- Exception thrown whenever an error occurs while
reading the fileUnsupportedEncodingException
- if the decoding of a spectrum title
failspublic ArrayList<MgfIndex> splitFile(File mspFile, int nSpectra, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
splitFile
in class MgfReader
mspFile
- the msp file to splitnSpectra
- the number of spectra allowed in the smaller fileswaitingHandler
- the waitingHandler showing the progressFileNotFoundException
- exception thrown whenever a file was not
foundIOException
- exception thrown whenever a problem occurred while
reading/writing a filepublic static MSnSpectrum getSpectrum(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, long index, String fileName) throws IOException, IllegalArgumentException
bufferedRandomAccessFile
- The random access file of the inspected
msp fileindex
- The index where to start looking for the spectrumfileName
- The name of the MSP fileIOException
- Exception thrown whenever an error is encountered
while reading the spectrumIllegalArgumentException
- Exception thrown whenever the file is
not of a compatible formatpublic static Precursor getPrecursor(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, Long index, String fileName) throws IOException, IllegalArgumentException
bufferedRandomAccessFile
- The random access file of the inspected
msp fileindex
- The index where to start looking for the spectrumfileName
- The name of the msp fileIOException
- Exception thrown whenever an error is encountered
while reading the spectrumIllegalArgumentException
- Exception thrown whenever the file is
not of a compatible formatCopyright © 2018. All rights reserved.