public class Ms2Exporter extends Object
Constructor and Description |
---|
Ms2Exporter() |
Modifier and Type | Method and Description |
---|---|
static void |
mgfToMs2(File mgfFile,
File destinationFile,
boolean resetScanNumbers)
Writes the content of the given file name into the destination file in
the ms2 format.
|
static void |
writeHeader(BufferedWriter bw)
Writes the header of the file.
|
static void |
writeSpectrum(BufferedWriter bw,
MSnSpectrum spectrum,
Integer defaultScanNumber)
Writes the given spectrum in ms2 format.
|
public static void mgfToMs2(File mgfFile, File destinationFile, boolean resetScanNumbers) throws IOException
mgfFile
- the original mgf filedestinationFile
- the destination file where to write the spectraresetScanNumbers
- If true the scan numbers are reset to simply
indicate the spectrum indexes, first spectrum is scan 1, second is scan
2, etc. Required in order to map back to the mgf.IOException
- exception thrown whenever an error occurred while reading or writing a filepublic static void writeHeader(BufferedWriter bw) throws IOException
bw
- a buffered writer where to writeIOException
- exception thrown whenever an error occurred while reading or writing a filepublic static void writeSpectrum(BufferedWriter bw, MSnSpectrum spectrum, Integer defaultScanNumber) throws IOException
bw
- a buffered writer where to write the spectrumspectrum
- the spectrum of interestdefaultScanNumber
- if not null, overrides the scan number given in
the file (needed when converting mgf to ms2)IOException
- exception thrown whenever an error occurred while reading or writing a fileCopyright © 2016. All rights reserved.