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

Algorithm class behind the SiriusExport tool: writes a SIRIUS .ms input file from MS data and (optionally) a featureXML. More...

#include <OpenMS/ANALYSIS/ID/SiriusExportAlgorithm.h>

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

Public Member Functions

 SiriusExportAlgorithm ()
 Default constructor; installs the export parameters (see class docs)
 
bool isFeatureOnly () const
 true if only feature-mapped MS2 spectra should be written (parameter feature_only)
 
UInt getFilterByNumMassTraces () const
 Minimum number of mass traces a feature must have to be retained (parameter filter_by_num_masstraces)
 
double getPrecursorMzTolerance () const
 Half-width of the precursor m/z window used during MS2-to-feature mapping (unit per precursorMzToleranceUnitIsPPM)
 
double getPrecursorRtTolerance () const
 Half-width of the precursor RT window (seconds) used during MS2-to-feature mapping.
 
bool precursorMzToleranceUnitIsPPM () const
 true if getPrecursorMzTolerance is interpreted as ppm; otherwise as Th
 
bool isNoMasstraceInfoIsotopePattern () const
 true to suppress mass-trace-derived isotope-pattern hints in the .ms output (parameter no_masstrace_info_isotope_pattern)
 
int getIsotopePatternIterations () const
 Number of SIRIUS isotope-pattern iterations to record in the .ms output (parameter isotope_pattern_iterations)
 
void preprocessing (const std::string &featureinfo, const MSExperiment &spectra, FeatureMapping::FeatureMappingInfo &feature_mapping_info, FeatureMapping::FeatureToMs2Indices &feature_ms2_indices) const
 Build the feature/MS2 mapping consumed by run() from a featureXML.
 
void logFeatureSpectraNumber (const std::string &featureinfo, const FeatureMapping::FeatureToMs2Indices &feature_ms2_indices, const MSExperiment &spectra) const
 Emit OPENMS_LOG_INFO messages summarising how many features / MS2 spectra will be processed.
 
void run (const StringList &mzML_files, const StringList &featureXML_files, const std::string &out_ms, const std::string &out_compoundinfo) const
 Export the SIRIUS .ms input file (and optional compound-info TSV).
 
- 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.
 

Additional Inherited Members

- 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;.
 

Detailed Description

Algorithm class behind the SiriusExport tool: writes a SIRIUS .ms input file from MS data and (optionally) a featureXML.

Drives the export pipeline that feeds SIRIUS / CSI:FingerID / AssayGeneratorMetabo:

  1. preprocessing() — optional: load a featureXML, filter features by number of mass traces, build a KDTreeFeatureMaps over them, and assign every MS2 spectrum to its closest feature by precursor (RT, m/z).
  2. logFeatureSpectraNumber() — log how many features / additional MS2 spectra are going to be processed.
  3. run() — write the SIRIUS .ms file and the optional compound-info TSV.

Configurable behaviour is exposed through DefaultParamHandler defaults (see the constructor). The accessors below resolve those parameters by name for callers that prefer typed getters over Param lookups.

Constructor & Destructor Documentation

◆ SiriusExportAlgorithm()

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

Member Function Documentation

◆ getFilterByNumMassTraces()

UInt getFilterByNumMassTraces ( ) const
inline

Minimum number of mass traces a feature must have to be retained (parameter filter_by_num_masstraces)

◆ getIsotopePatternIterations()

int getIsotopePatternIterations ( ) const
inline

Number of SIRIUS isotope-pattern iterations to record in the .ms output (parameter isotope_pattern_iterations)

◆ getPrecursorMzTolerance()

double getPrecursorMzTolerance ( ) const
inline

Half-width of the precursor m/z window used during MS2-to-feature mapping (unit per precursorMzToleranceUnitIsPPM)

◆ getPrecursorRtTolerance()

double getPrecursorRtTolerance ( ) const
inline

Half-width of the precursor RT window (seconds) used during MS2-to-feature mapping.

◆ isFeatureOnly()

bool isFeatureOnly ( ) const
inline

true if only feature-mapped MS2 spectra should be written (parameter feature_only)

◆ isNoMasstraceInfoIsotopePattern()

bool isNoMasstraceInfoIsotopePattern ( ) const
inline

true to suppress mass-trace-derived isotope-pattern hints in the .ms output (parameter no_masstrace_info_isotope_pattern)

◆ logFeatureSpectraNumber()

void logFeatureSpectraNumber ( const std::string &  featureinfo,
const FeatureMapping::FeatureToMs2Indices feature_ms2_indices,
const MSExperiment spectra 
) const

Emit OPENMS_LOG_INFO messages summarising how many features / MS2 spectra will be processed.

Three modes depending on whether a featureXML is in play:

  • isFeatureOnly() and featureinfo non-empty: logs assigned-feature count only.
  • featureinfo non-empty (but not feature-only): logs both assigned-feature count and the number of additional unassigned MS2 spectra.
  • featureinfo empty: logs the raw MS2 spectrum count in spectra.
Parameters
[in]featureinfoPath to featureXML (controls which log branch is taken).
[in]feature_ms2_indicesOutput of preprocessing — feature/MS2 mapping.
[in]spectraSpectra container used when no featureXML is given.

◆ precursorMzToleranceUnitIsPPM()

bool precursorMzToleranceUnitIsPPM ( ) const
inline

true if getPrecursorMzTolerance is interpreted as ppm; otherwise as Th

◆ preprocessing()

void preprocessing ( const std::string &  featureinfo,
const MSExperiment spectra,
FeatureMapping::FeatureMappingInfo feature_mapping_info,
FeatureMapping::FeatureToMs2Indices feature_ms2_indices 
) const

Build the feature/MS2 mapping consumed by run() from a featureXML.

If featureinfo is empty the call is a no-op (both output arguments stay untouched) — in that case run() will treat every MS2 spectrum as unassigned.

If featureinfo is given but isFeatureOnly() is false, the mass-trace filter is silently clamped to 1 (with a warning) so that the adduct annotation on multi-trace features is preserved for MS2 spectra. Features with fewer than getFilterByNumMassTraces() mass traces are then dropped, the survivors are wrapped in a KDTreeFeatureMaps, and MS2 spectra are matched to features via FeatureMapping::assignMS2IndexToFeature using the configured precursor tolerances.

Parameters
[in]featureinfoPath to featureXML; if empty, the function is a no-op.
[in]spectraSpectra container (MS1 + MS2); only MS2 are mapped.
[out]feature_mapping_infoReceives the loaded feature maps and the kd-tree built from them.
[out]feature_ms2_indicesReceives the MS2-to-feature assignment / unassigned-MS2 list.
Exceptions
Exception::FileEmptyIf featureinfo is non-empty but the file does not exist or is empty.

◆ run()

void run ( const StringList mzML_files,
const StringList featureXML_files,
const std::string &  out_ms,
const std::string &  out_compoundinfo 
) const

Export the SIRIUS .ms input file (and optional compound-info TSV).

Iterates over mzML_files (and, if non-empty, the same-index entry of featureXML_files for feature-level annotation), runs preprocessing internally, and writes one SIRIUS .ms file at out_ms. If out_compoundinfo is non-empty, also writes a per-compound TSV with provenance/metadata.

Parameters
[in]mzML_filesInput mzML paths to export.
[in]featureXML_filesOptional per-mzML featureXML paths (parallel to mzML_files, or empty).
[in]out_msDestination SIRIUS .ms file (overwritten).
[in]out_compoundinfoDestination compound-info TSV (overwritten); skipped if empty.
Exceptions
Exception::UnableToCreateFileIf out_ms cannot be opened for writing.