OpenMS
Loading...
Searching...
No Matches
GNPSMGFFile Class Reference

Writer for the consensus-spectrum MGF file consumed by GNPS Feature-Based / Ion-Identity Molecular Networking. More...

#include <OpenMS/FORMAT/GNPSMGFFile.h>

Inheritance diagram for GNPSMGFFile:
[legend]
Collaboration diagram for GNPSMGFFile:
[legend]

Public Member Functions

 GNPSMGFFile ()
 Default constructor; installs the export parameters (see class docs)
 
void store (const std::string &consensus_file_path, const StringList &mzml_file_paths, const std::string &out) const
 Write the consensus-spectrum MGF for GNPS molecular networking.
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const std::string &name)
 Constructor with name that is displayed in error messages.
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor.
 
virtual ~DefaultParamHandler ()
 Destructor.
 
DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator.
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator.
 
void setParameters (const Param &param)
 Sets the parameters.
 
const ParamgetParameters () const
 Non-mutable access to the parameters.
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters.
 
const std::string & getName () const
 Non-mutable access to the name.
 
void setName (const std::string &name)
 Mutable access to the name.
 
const std::vector< std::string > & getSubsections () const
 Non-mutable access to the registered subsections.
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor.
 
virtual ~ProgressLogger ()
 Destructor.
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor.
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator.
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE!
 
LogType getLogType () const
 Returns the type of progress log being used.
 
void setLogger (ProgressLoggerImpl *logger)
 Sets the logger to be used for progress logging.
 
void startProgress (SignedSize begin, SignedSize end, const std::string &label) const
 Initializes the progress display.
 
void setProgress (SignedSize value) const
 Sets the current progress.
 
void endProgress (UInt64 bytes_processed=0) const
 
void nextProgress () const
 increment progress by 1 (according to range begin-end)
 

Static Private Attributes

static constexpr double DEF_COSINE_SIMILARITY = 0.9
 Default cosine-similarity threshold used when merging multiple MS2 scans into one representative spectrum.
 
static constexpr double DEF_MERGE_BIN_SIZE = static_cast<double>(BinnedSpectrum::DEFAULT_BIN_WIDTH_HIRES)
 Default m/z bin width for the binned-spectrum representation used during merging (high-res default)
 
static constexpr int DEF_PEPT_CUTOFF = 5
 Default value of the peptide_cutoff parameter — how many top-intensity peptides per consensus element to consider when output_type is merged_spectra (-1 = all)
 
static constexpr int DEF_MSMAP_CACHE = 50
 Declared default but currently not wired to any parameter — kept for source compatibility with earlier versions of the writer.
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const std::string &key_prefix="")
 Writes all parameters to meta values.
 
- Protected Member Functions inherited from DefaultParamHandler
virtual void updateMembers_ ()
 This method is used to update extra member variables at the end of the setParameters() method.
 
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor.
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters.
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes!
 
std::vector< std::string > subsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes!
 
std::string error_name_
 Name that is displayed in error messages during the parameter checking.
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;.
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;.
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Writer for the consensus-spectrum MGF file consumed by GNPS Feature-Based / Ion-Identity Molecular Networking.

For each consensus feature in a ConsensusMap, the GNPS workflow expects one representative MS2 spectrum. This class reads the spectrum references stored on each consensus element, resolves them to the original mzML files, optionally merges multiple MS2 scans per feature into a single binned consensus spectrum, and writes the result as an MGF file ready to be uploaded to GNPS.

Configurable behaviour is exposed through DefaultParamHandler — see the defaults installed by the constructor for the supported keys (output_type"most_intense" or "merged_spectra"; peptide_cutoff — how many top-intensity peptides to consider per consensus element; ms2_bin_size — bin width when merging fragment ions; merged_spectra:cos_similarity — cosine threshold for merging).

Used by the GNPSExport tool. See its page for the recommended OpenMS metabolomics workflow producing the consensusXML input.

Constructor & Destructor Documentation

◆ GNPSMGFFile()

Default constructor; installs the export parameters (see class docs)

Member Function Documentation

◆ store()

void store ( const std::string &  consensus_file_path,
const StringList mzml_file_paths,
const std::string &  out 
) const

Write the consensus-spectrum MGF for GNPS molecular networking.

The consensusXML at consensus_file_path must reference MS2 spectra in mzml_file_paths (typically the same mzMLs that fed the feature finder). Per consensus feature, the referenced MS2 scans are optionally merged into a single representative spectrum (per the cosine-similarity / bin-width / peak-cutoff parameters) and appended to the output MGF.

Parameters
[in]consensus_file_pathPath to a consensusXML file with spectrum references on each consensus element.
[in]mzml_file_pathsPaths to the mzML files referenced by the consensusXML.
[in]outOutput MGF path; one spectrum block per consensus feature.

Referenced by TOPPGNPSExport::main_().

Member Data Documentation

◆ DEF_COSINE_SIMILARITY

constexpr double DEF_COSINE_SIMILARITY = 0.9
staticconstexprprivate

Default cosine-similarity threshold used when merging multiple MS2 scans into one representative spectrum.

◆ DEF_MERGE_BIN_SIZE

constexpr double DEF_MERGE_BIN_SIZE = static_cast<double>(BinnedSpectrum::DEFAULT_BIN_WIDTH_HIRES)
staticconstexprprivate

Default m/z bin width for the binned-spectrum representation used during merging (high-res default)

◆ DEF_MSMAP_CACHE

constexpr int DEF_MSMAP_CACHE = 50
staticconstexprprivate

Declared default but currently not wired to any parameter — kept for source compatibility with earlier versions of the writer.

◆ DEF_PEPT_CUTOFF

constexpr int DEF_PEPT_CUTOFF = 5
staticconstexprprivate

Default value of the peptide_cutoff parameter — how many top-intensity peptides per consensus element to consider when output_type is merged_spectra (-1 = all)