OpenMS  2.7.0
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Attributes | List of all members
TOPPGNPSExport Class Reference
Inheritance diagram for TOPPGNPSExport:
[legend]
Collaboration diagram for TOPPGNPSExport:
[legend]

Public Member Functions

 TOPPGNPSExport ()
 
- Public Member Functions inherited from TOPPBase
 TOPPBase ()=delete
 No default constructor. More...
 
 TOPPBase (const TOPPBase &)=delete
 No default copy constructor. More...
 
 TOPPBase (const String &name, const String &description, bool official=true, const std::vector< Citation > &citations={}, bool toolhandler_test=true)
 Constructor. More...
 
virtual ~TOPPBase ()
 Destructor. More...
 
ExitCodes main (int argc, const char **argv)
 Main routine of all TOPP applications. More...
 
String getToolPrefix () const
 Returns the prefix used to identify the tool. More...
 

Protected Member Functions

void registerOptionsAndFlags_ () override
 Sets the valid command line options (with argument) and flags (without argument). More...
 
ExitCodes main_ (int, const char **) override
 The actual "main" method. main_() is invoked by main(). More...
 
- Protected Member Functions inherited from TOPPBase
String getParamArgument_ (const Param::ParamEntry &entry) const
 Utility function that determines a suitable argument value for the given Param::ParamEntry. More...
 
std::vector< ParameterInformationparamToParameterInformation_ (const Param &param) const
 Translates the given parameter object into a vector of ParameterInformation, that can be utilized for cl parsing. More...
 
ParameterInformation paramEntryToParameterInformation_ (const Param::ParamEntry &entry, const String &argument="", const String &full_name="") const
 Transforms a ParamEntry object to command line parameter (ParameterInformation). More...
 
void registerParamSubsectionsAsTOPPSubsections_ (const Param &param)
 
void registerFullParam_ (const Param &param)
 Register command line parameters for all entries in a Param object. More...
 
void registerStringOption_ (const String &name, const String &argument, const String &default_value, const String &description, bool required=true, bool advanced=false)
 Registers a string option. More...
 
void setValidStrings_ (const String &name, const std::vector< String > &strings)
 Sets the valid strings for a string option or a whole string list. More...
 
void setValidStrings_ (const String &name, const std::string vstrings[], int count)
 Sets the valid strings for a string option or a whole string list. More...
 
void registerInputFile_ (const String &name, const String &argument, const String &default_value, const String &description, bool required=true, bool advanced=false, const StringList &tags=StringList())
 Registers an input file option. More...
 
void registerOutputFile_ (const String &name, const String &argument, const String &default_value, const String &description, bool required=true, bool advanced=false)
 Registers an output file option. More...
 
void setValidFormats_ (const String &name, const std::vector< String > &formats, const bool force_OpenMS_format=true)
 Sets the formats for a input/output file option or for all members of an input/output file lists. More...
 
void registerDoubleOption_ (const String &name, const String &argument, double default_value, const String &description, bool required=true, bool advanced=false)
 Registers a double option. More...
 
void setMinInt_ (const String &name, Int min)
 Sets the minimum value for the integer parameter(can be a list of integers,too) name. More...
 
void setMaxInt_ (const String &name, Int max)
 Sets the maximum value for the integer parameter(can be a list of integers,too) name. More...
 
void setMinFloat_ (const String &name, double min)
 Sets the minimum value for the floating point parameter(can be a list of floating points,too) name. More...
 
void setMaxFloat_ (const String &name, double max)
 Sets the maximum value for the floating point parameter(can be a list of floating points,too) name. More...
 
void registerIntOption_ (const String &name, const String &argument, Int default_value, const String &description, bool required=true, bool advanced=false)
 Registers an integer option. More...
 
void registerIntList_ (const String &name, const String &argument, IntList default_value, const String &description, bool required=true, bool advanced=false)
 Registers a list of integers option. More...
 
void registerDoubleList_ (const String &name, const String &argument, DoubleList default_value, const String &description, bool required=true, bool advanced=false)
 Registers a list of doubles option. More...
 
void registerStringList_ (const String &name, const String &argument, StringList default_value, const String &description, bool required=true, bool advanced=false)
 Registers a list of strings option. More...
 
void registerInputFileList_ (const String &name, const String &argument, StringList default_value, const String &description, bool required=true, bool advanced=false, const StringList &tags=StringList())
 Registers a list of input files option. More...
 
void registerOutputFileList_ (const String &name, const String &argument, StringList default_value, const String &description, bool required=true, bool advanced=false)
 Registers a list of output files option. More...
 
void registerFlag_ (const String &name, const String &description, bool advanced=false)
 Registers a flag. More...
 
void registerSubsection_ (const String &name, const String &description)
 Registers an allowed subsection in the INI file (usually from OpenMS algorithms). More...
 
void registerTOPPSubsection_ (const String &name, const String &description)
 Registers an allowed subsection in the INI file originating from the TOPP tool itself. More...
 
void addEmptyLine_ ()
 Adds an empty line between registered variables in the documentation. More...
 
String getStringOption_ (const String &name) const
 Returns the value of a previously registered string option. More...
 
double getDoubleOption_ (const String &name) const
 Returns the value of a previously registered double option. More...
 
Int getIntOption_ (const String &name) const
 Returns the value of a previously registered integer option. More...
 
StringList getStringList_ (const String &name) const
 Returns the value of a previously registered StringList. More...
 
IntList getIntList_ (const String &name) const
 Returns the value of a previously registered IntList. More...
 
DoubleList getDoubleList_ (const String &name) const
 Returns the value of a previously registered DoubleList. More...
 
bool getFlag_ (const String &name) const
 Returns the value of a previously registered flag. More...
 
const ParameterInformationfindEntry_ (const String &name) const
 Finds the entry in the parameters_ array that has the name name. More...
 
Param const & getParam_ () const
 Return all parameters relevant to this TOPP tool. More...
 
void checkParam_ (const Param &param, const String &filename, const String &location) const
 Checks top-level entries of param according to the information during registration. More...
 
void fileParamValidityCheck_ (const StringList &param_value, const String &param_name, const ParameterInformation &p) const
 checks if files of an input file list exist More...
 
void fileParamValidityCheck_ (String &param_value, const String &param_name, const ParameterInformation &p) const
 checks if an input file exists (respecting the flags) More...
 
void checkIfIniParametersAreApplicable_ (const Param &ini_params)
 Checks if the parameters of the provided ini file are applicable to this tool. More...
 
void printUsage_ ()
 Prints the tool-specific command line options and appends the common options. More...
 
void writeLog_ (const String &text) const
 Writes a string to the log file and to std::cout. More...
 
void writeDebug_ (const String &text, UInt min_level) const
 Writes a text to the log file and to std::cout if the debug level is at least min_level. More...
 
void writeDebug_ (const String &text, const Param &param, UInt min_level) const
 Writes a String followed by a Param to the log file and to std::cout if the debug level is at least min_level. More...
 
ExitCodes runExternalProcess_ (const QString &executable, const QStringList &arguments, const QString &workdir="") const
 Runs an external process via ExternalProcess and prints its stderr output on failure or if debug_level > 4. More...
 
ExitCodes runExternalProcess_ (const QString &executable, const QStringList &arguments, String &proc_stdout, String &proc_stderr, const QString &workdir="") const
 
const StringgetIniLocation_ () const
 Returns the location of the ini file where parameters are taken from. E.g. if the command line was TOPPTool -instance 17, then this will be "TOPPTool:17:". Note the ':' at the end. More...
 
const StringtoolName_ () const
 Returns the tool name. More...
 
void inputFileReadable_ (const String &filename, const String &param_name) const
 Checks if an input file exists, is readable and is not empty. More...
 
void outputFileWritable_ (const String &filename, const String &param_name) const
 Checks if an output file is writable. More...
 
bool parseRange_ (const String &text, double &low, double &high) const
 Parses a range string ([a]:[b]) into two variables (doubles) More...
 
bool parseRange_ (const String &text, Int &low, Int &high) const
 Parses a range string ([a]:[b]) into two variables (integers) More...
 
void addDataProcessing_ (ConsensusMap &map, const DataProcessing &dp) const
 Data processing setter for consensus maps. More...
 
void addDataProcessing_ (FeatureMap &map, const DataProcessing &dp) const
 Data processing setter for feature maps. More...
 
void addDataProcessing_ (PeakMap &map, const DataProcessing &dp) const
 Data processing setter for peak maps. More...
 
DataProcessing getProcessingInfo_ (DataProcessing::ProcessingAction action) const
 Returns the data processing information. More...
 
DataProcessing getProcessingInfo_ (const std::set< DataProcessing::ProcessingAction > &actions) const
 Returns the data processing information. More...
 
bool writeCTD_ ()
 Write common tool description (CTD) file. More...
 

Private Member Functions

void binPeaks_ (const vector< Peak1D > &peaks, const double bin_width, vector< Peak1D > &binned_peaks)
 Bin peaks by similar m/z position and averaged intensities. More...
 
void flattenAndBinSpectra_ (MSExperiment &exp, const double bin_width, vector< Peak1D > &merged_peaks)
 Flatten spectra from MSExperiment into a single vector of Peak1D peaks. More...
 
void writeMSMSBlockHeader_ (ofstream &output_file, const String &output_type, const int &scan_index, const String &feature_id, const int &feature_charge, const String &feature_mz, const String &spec_index, const String &feature_rt)
 Private function that outputs MS/MS Block Header. More...
 
void writeMSMSBlock_ (ofstream &output_file, const vector< Peak1D > &peaks)
 Private function to write peak mass and intensity to output file. More...
 
void sortElementMapsByIntensity_ (const ConsensusFeature &feature, vector< pair< int, double >> &element_maps)
 Private method used to sort PeptideIdentification map indices in order of annotation's intensity. More...
 
void getElementPeptideIdentificationsByElementIntensity_ (const ConsensusFeature &feature, vector< pair< int, double >> &sorted_element_maps, vector< pair< int, int >> &pepts)
 Retrieve list of PeptideIdentification parameters from ConsensusFeature metadata, sorted by map intensity. More...
 

Static Private Attributes

static constexpr double DEF_COSINE_SIMILARITY = 0.9
 
static constexpr double DEF_MERGE_BIN_SIZE = static_cast<double>(BinnedSpectrum::DEFAULT_BIN_WIDTH_HIRES)
 
static constexpr double DEF_PREC_MASS_TOL = 0.5
 
static constexpr bool DEF_PREC_MASS_TOL_ISPPM = false
 
static constexpr double DEF_PEPT_CUTOFF = 5
 
static constexpr double DEF_MSMAP_CACHE = 50
 

Additional Inherited Members

- Public Types inherited from TOPPBase
enum  ExitCodes {
  EXECUTION_OK , INPUT_FILE_NOT_FOUND , INPUT_FILE_NOT_READABLE , INPUT_FILE_CORRUPT ,
  INPUT_FILE_EMPTY , CANNOT_WRITE_OUTPUT_FILE , ILLEGAL_PARAMETERS , MISSING_PARAMETERS ,
  UNKNOWN_ERROR , EXTERNAL_PROGRAM_ERROR , PARSE_ERROR , INCOMPATIBLE_INPUT_DATA ,
  INTERNAL_ERROR , UNEXPECTED_RESULT
}
 Exit codes. More...
 
- Static Public Member Functions inherited from TOPPBase
static void setMaxNumberOfThreads (int num_threads)
 Sets the maximal number of usable threads. More...
 
- Protected Attributes inherited from TOPPBase
String version_
 Version string (if empty, the OpenMS/TOPP version is printed) More...
 
String verboseVersion_
 Version string including additional revision/date time information. Note: This differs from version_ only if not provided by the user. More...
 
bool official_
 Flag indicating if this an official TOPP tool. More...
 
std::vector< Citationcitations_
 Papers, specific for this tool (will be shown in '–help') More...
 
bool toolhandler_test_
 Enable the ToolHandler tests. More...
 
ProgressLogger::LogType log_type_
 Type of progress logging. More...
 
bool test_mode_
 Test mode. More...
 
Int debug_level_
 Debug level set by -debug. More...
 
- Static Protected Attributes inherited from TOPPBase
static String topp_ini_file_
 .TOPP.ini file for storing system default parameters More...
 
static const Citation cite_openms_
 The OpenMS citation. More...
 

Constructor & Destructor Documentation

◆ TOPPGNPSExport()

TOPPGNPSExport ( )
inline

Member Function Documentation

◆ binPeaks_()

void binPeaks_ ( const vector< Peak1D > &  peaks,
const double  bin_width,
vector< Peak1D > &  binned_peaks 
)
inlineprivate

Bin peaks by similar m/z position and averaged intensities.

Parameters
peaksVector of Peak1D peaks sorted by m/z position
bin_widthSize of bin
binned_peaksResult vector with binned peaks passed in by reference

◆ flattenAndBinSpectra_()

void flattenAndBinSpectra_ ( MSExperiment exp,
const double  bin_width,
vector< Peak1D > &  merged_peaks 
)
inlineprivate

Flatten spectra from MSExperiment into a single vector of Peak1D peaks.

Parameters
expMSExperiment containing at least 1 spectrum
bin_widthSize of binned scan (m/z)
merged_peaksResult vector of peaks passed in by reference

References MSExperiment::getSpectra(), and MSExperiment::getSpectrum().

◆ getElementPeptideIdentificationsByElementIntensity_()

void getElementPeptideIdentificationsByElementIntensity_ ( const ConsensusFeature feature,
vector< pair< int, double >> &  sorted_element_maps,
vector< pair< int, int >> &  pepts 
)
inlineprivate

Retrieve list of PeptideIdentification parameters from ConsensusFeature metadata, sorted by map intensity.

Parameters
featureConsensusFeature feature containing PeptideIdentification annotations
sorted_element_mapsSorted list of element_maps
peptsResult vector of <map_index,spectrum_index> of PeptideIdentification annotations sorted by map intensity in feature

References BaseFeature::getPeptideIdentifications().

◆ main_()

ExitCodes main_ ( int  argc,
const char **  argv 
)
inlineoverrideprotectedvirtual

◆ registerOptionsAndFlags_()

void registerOptionsAndFlags_ ( )
inlineoverrideprotectedvirtual

Sets the valid command line options (with argument) and flags (without argument).

The options '-ini' '-log' '-instance' '-debug' and the flag '–help' are automatically registered.

Implements TOPPBase.

◆ sortElementMapsByIntensity_()

void sortElementMapsByIntensity_ ( const ConsensusFeature feature,
vector< pair< int, double >> &  element_maps 
)
inlineprivate

Private method used to sort PeptideIdentification map indices in order of annotation's intensity.

Parameters
featureConsensusFeature annotated with PeptideIdentifications
featureMaps_sortedByIntResult vector of map indices in order of PeptideIdentification intensity

References ConsensusFeature::begin(), and ConsensusFeature::end().

◆ writeMSMSBlock_()

void writeMSMSBlock_ ( ofstream &  output_file,
const vector< Peak1D > &  peaks 
)
inlineprivate

Private function to write peak mass and intensity to output file.

Parameters
output_fileStream that will write to file
peaksVector of peaks that will be outputted

◆ writeMSMSBlockHeader_()

void writeMSMSBlockHeader_ ( ofstream &  output_file,
const String output_type,
const int &  scan_index,
const String feature_id,
const int &  feature_charge,
const String feature_mz,
const String spec_index,
const String feature_rt 
)
inlineprivate

Private function that outputs MS/MS Block Header.

Parameters
output_fileStream that will write to file
scan_indexCurrent scan index in GNPSExport formatted output
feature_idConsensusFeature Id found in input mzXML file
feature_chargeConsensusFeature's highest charge as mentioned in the input mzXML file
feature_mzm/z position of PeptideIdentification with highest intensity
spec_indexSpectrum index of PeptideIdentification with highest intensity
feature_rtConsensusFeature's retention time specified in input mzXML file

Member Data Documentation

◆ DEF_COSINE_SIMILARITY

constexpr double DEF_COSINE_SIMILARITY = 0.9
staticconstexprprivate

◆ DEF_MERGE_BIN_SIZE

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

◆ DEF_MSMAP_CACHE

constexpr double DEF_MSMAP_CACHE = 50
staticconstexprprivate

◆ DEF_PEPT_CUTOFF

constexpr double DEF_PEPT_CUTOFF = 5
staticconstexprprivate

◆ DEF_PREC_MASS_TOL

constexpr double DEF_PREC_MASS_TOL = 0.5
staticconstexprprivate

◆ DEF_PREC_MASS_TOL_ISPPM

constexpr bool DEF_PREC_MASS_TOL_ISPPM = false
staticconstexprprivate