Class MgfFileWriter
java.lang.Object
com.compomics.util.experiment.io.mass_spectrometry.mgf.MgfFileWriter
- All Implemented Interfaces:
AutoCloseable
public class MgfFileWriter extends Object implements AutoCloseable
This class writes spectrum files in Mascot Generic File (mgf) format.
- Author:
- Marc Vaudel, Harald Barsnes
-
Constructor Summary
Constructors Constructor Description MgfFileWriter()
Empty default constructorMgfFileWriter(File destinationFile)
Constructor. -
Method Summary
Modifier and Type Method Description static String
asMgf(String spectrumTitle, Spectrum spectrum)
Returns the spectrum as an mgf bloc.static String
asMgf(String spectrumTitle, Spectrum spectrum, TreeMap<String,String> additionalTags)
Returns the spectrum as an mgf bloc.void
close()
void
writeSpectrum(String spectrumTitle, Spectrum spectrum)
Writes the given spectrum to the file.
-
Constructor Details
-
MgfFileWriter
public MgfFileWriter()Empty default constructor -
MgfFileWriter
Constructor.- Parameters:
destinationFile
- The file where to write.
-
-
Method Details
-
writeSpectrum
Writes the given spectrum to the file.- Parameters:
spectrumTitle
- The title of the spectrum to write.spectrum
- The spectrum to write.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
asMgf
Returns the spectrum as an mgf bloc.- Parameters:
spectrumTitle
- The title of the spectrum.spectrum
- The spectrum.- Returns:
- the spectrum as an mgf bloc
-
asMgf
public static String asMgf(String spectrumTitle, Spectrum spectrum, TreeMap<String,String> additionalTags)Returns the spectrum as an mgf bloc.- Parameters:
spectrumTitle
- The title of the spectrum.spectrum
- The spectrum.additionalTags
- additional tags which will be added after the BEGIN IONS tag in alphabetic order- Returns:
- the peak list as an mgf bloc
-