Class SpectrumExporter

java.lang.Object
eu.isas.peptideshaker.followup.SpectrumExporter

public class SpectrumExporter
extends Object
This class can be used to export spectra.
Author:
Marc Vaudel
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  SpectrumExporter.ExportType
    Enum of the different types of export implemented.
  • Constructor Summary

    Constructors 
    Constructor Description
    SpectrumExporter​(com.compomics.util.experiment.identification.Identification identification, com.compomics.util.experiment.mass_spectrometry.SpectrumProvider spectrumProvider)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    ArrayList<File> exportSpectra​(File destinationFolder, com.compomics.util.waiting.WaitingHandler waitingHandler, SpectrumExporter.ExportType exportType, com.compomics.util.parameters.identification.advanced.SequenceMatchingParameters sequenceMatchingPreferences)
    Exports the spectra from different categories of PSMs according to the export type.
    static File getDestinationFile​(File destinationFolder, String originalFileName, SpectrumExporter.ExportType exportType)
    Returns the destination file for the given export.
    static String getSuffix​(SpectrumExporter.ExportType exportType)
    Returns the suffix for a spectrum file name.
    static boolean include​(String spectrumFile, String spectrumTitle, com.compomics.util.experiment.identification.Identification identification, com.compomics.util.parameters.identification.advanced.SequenceMatchingParameters sequenceMatchingParameters, SpectrumExporter.ExportType exportType)
    Indicates whether a spectrum should be exported.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpectrumExporter

      public SpectrumExporter​(com.compomics.util.experiment.identification.Identification identification, com.compomics.util.experiment.mass_spectrometry.SpectrumProvider spectrumProvider)
      Constructor.
      Parameters:
      identification - The identification object.
      spectrumProvider - The spectrum provider.
  • Method Details

    • exportSpectra

      public ArrayList<File> exportSpectra​(File destinationFolder, com.compomics.util.waiting.WaitingHandler waitingHandler, SpectrumExporter.ExportType exportType, com.compomics.util.parameters.identification.advanced.SequenceMatchingParameters sequenceMatchingPreferences) throws IOException
      Exports the spectra from different categories of PSMs according to the export type. Export format is mgf.
      Parameters:
      destinationFolder - the folder where to write the spectra
      waitingHandler - waiting handler used to display progress and cancel the process. Can be null.
      exportType - the type of PSM to export
      sequenceMatchingPreferences - the sequence matching preferences
      Returns:
      ArrayList files containing exported spectra
      Throws:
      IOException - thrown if an error occurred while writing the file
    • getDestinationFile

      public static File getDestinationFile​(File destinationFolder, String originalFileName, SpectrumExporter.ExportType exportType)
      Returns the destination file for the given export.
      Parameters:
      destinationFolder - the destination folder
      originalFileName - the original file name
      exportType - the export type
      Returns:
      the destination file
    • include

      public static boolean include​(String spectrumFile, String spectrumTitle, com.compomics.util.experiment.identification.Identification identification, com.compomics.util.parameters.identification.advanced.SequenceMatchingParameters sequenceMatchingParameters, SpectrumExporter.ExportType exportType)
      Indicates whether a spectrum should be exported.
      Parameters:
      spectrumFile - the name of the file of the spectrum
      spectrumTitle - the spectrum title
      identification - the identification object
      sequenceMatchingParameters - the sequence matching preferences
      exportType - the export type
      Returns:
      a boolean indicating whether a spectrum should be exported
    • getSuffix

      public static String getSuffix​(SpectrumExporter.ExportType exportType)
      Returns the suffix for a spectrum file name.
      Parameters:
      exportType - the type of PSM to be exported
      Returns:
      the suffix for a spectrum file name