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 Details

    • MgfFileWriter

      public MgfFileWriter()
      Empty default constructor
    • MgfFileWriter

      public MgfFileWriter​(File destinationFile)
      Constructor.
      Parameters:
      destinationFile - The file where to write.
  • Method Details

    • writeSpectrum

      public void writeSpectrum​(String spectrumTitle, Spectrum spectrum)
      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 interface AutoCloseable
    • asMgf

      public static String asMgf​(String spectrumTitle, Spectrum spectrum)
      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