public class MgfFileUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
EXTENSIONS
The file extension for mgf files.
|
Constructor and Description |
---|
MgfFileUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addMissingPrecursorCharges(File mgfFile,
WaitingHandler waitingHandler)
Add missing precursor charges.
|
static void |
addMissingSpectrumTitles(File mgfFile,
WaitingHandler waitingHandler)
Adds missing spectrum titles.
|
static void |
removeDuplicateSpectrumTitles(File mgfFile,
WaitingHandler waitingHandler)
Removes duplicate spectrum titles (the first occurrence is kept).
|
static void |
removeZeroes(File mgfFile,
WaitingHandler waitingHandler)
Removes zero intensity peaks.
|
static void |
renameDuplicateSpectrumTitles(File mgfFile,
WaitingHandler waitingHandler)
Renames duplicate spectrum titles.
|
static ArrayList<MgfIndex> |
splitFile(File mgfFile,
int nSpectra,
WaitingHandler waitingHandler)
Splits an mgf file into smaller ones and returns the indexes of the
generated files.
|
public static final String[] EXTENSIONS
public static void removeDuplicateSpectrumTitles(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mgfFile
- the MGF file to validatewaitingHandler
- 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 addMissingSpectrumTitles(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mgfFile
- the MGF 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 addMissingPrecursorCharges(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mgfFile
- the MGF 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 mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mgfFile
- the MGF 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 mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mgfFile
- the MGF 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 static ArrayList<MgfIndex> splitFile(File mgfFile, int nSpectra, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
mgfFile
- the mgf 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 fileCopyright © 2021. All rights reserved.