OpenMS  2.8.0
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
TOPPOpenSwathBase Class Reference

#include <OpenMS/APPLICATIONS/OpenSwathBase.h>

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

Public Member Functions

 TOPPOpenSwathBase (String name, String description, bool official=true)
 
- 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

bool loadSwathFiles (const StringList &file_list, boost::shared_ptr< ExperimentalSettings > &exp_meta, std::vector< OpenSwath::SwathMap > &swath_maps, const bool split_file, const String &tmp, const String &readoptions, const String &swath_windows_file, const double min_upper_edge_dist, const bool force, const bool sort_swath_maps, const bool sonar, const bool prm, Interfaces::IMSDataConsumer *plugin_consumer=nullptr)
 Load the DIA files into internal data structures. More...
 
void prepareChromOutput (Interfaces::IMSDataConsumer **chromatogramConsumer, const boost::shared_ptr< ExperimentalSettings > &exp_meta, const OpenSwath::LightTargetedExperiment &transition_exp, const String &out_chrom, const UInt64 run_id)
 Prepare chromatogram output. More...
 
OpenSwath::LightTargetedExperiment loadTransitionList (const FileTypes::Type &tr_type, const String &tr_file, const Param &tsv_reader_param)
 Loads transition list from TraML / TSV or PQP. More...
 
TransformationDescription performCalibration (String trafo_in, String irt_tr_file, std::vector< OpenSwath::SwathMap > &swath_maps, double min_rsq, double min_coverage, const Param &feature_finder_param, const ChromExtractParams &cp_irt, const Param &irt_detection_param, const Param &calibration_param, Size debug_level, bool sonar, bool load_into_memory, const String &irt_trafo_out, const String &irt_mzml_out)
 Perform retention time and m/z calibration. More...
 
- Protected Member Functions inherited from TOPPBase
virtual void registerOptionsAndFlags_ ()=0
 Sets the valid command line options (with argument) and flags (without argument). More...
 
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 registerOutputPrefix_ (const String &name, const String &argument, const String &default_value, const String &description, bool required=true, bool advanced=false)
 Registers an output file prefix used for tools with multiple file output. 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...
 
virtual ExitCodes main_ (int argc, const char **argv)=0
 The actual "main" method. main_() is invoked by main(). 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 loadSwathFiles_ (const StringList &file_list, const bool split_file, const String &tmp, const String &readoptions, boost::shared_ptr< ExperimentalSettings > &exp_meta, std::vector< OpenSwath::SwathMap > &swath_maps, Interfaces::IMSDataConsumer *plugin_consumer)
 

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

◆ TOPPOpenSwathBase()

TOPPOpenSwathBase ( String  name,
String  description,
bool  official = true 
)
inline

Member Function Documentation

◆ loadSwathFiles()

bool loadSwathFiles ( const StringList file_list,
boost::shared_ptr< ExperimentalSettings > &  exp_meta,
std::vector< OpenSwath::SwathMap > &  swath_maps,
const bool  split_file,
const String tmp,
const String readoptions,
const String swath_windows_file,
const double  min_upper_edge_dist,
const bool  force,
const bool  sort_swath_maps,
const bool  sonar,
const bool  prm,
Interfaces::IMSDataConsumer plugin_consumer = nullptr 
)
inlineprotected

Load the DIA files into internal data structures.

Loads SWATH files into the provided OpenSwath::SwathMap data structures. It uses the SwathFile class to load files from either mzML, mzXML or SqMass. The files will be either loaded into memory or cached to disk (depending on the readoptions parameter).

Parameters
file_listThe input file(s)
exp_metaThe output (meta data about experiment)
swath_mapsThe output (ptr to raw data)
file_listThe input file(s)
split_fileIf loading a single file that contains a single SWATH window
tmpTemporary directory
readoptionsDescription on how to read the data ("normal", "cache")
swath_windows_fileProvided file containing the SWATH windows which will be mapped to the experimental windows
min_upper_edge_distDistance for each assay to the upper edge of the SWATH window
forceWhether to override the sanity check
sort_swath_mapsWhether to sort the provided windows first before mapping
sonarWhether data is in sonar format
Returns
Returns whether loading and sanity check was successful

References SwathWindowLoader::annotateSwathMapsFromFile(), TOPPOpenSwathBase::loadSwathFiles_(), OPENMS_LOG_DEBUG, OPENMS_LOG_ERROR, and OPENMS_LOG_WARN.

◆ loadSwathFiles_()

void loadSwathFiles_ ( const StringList file_list,
const bool  split_file,
const String tmp,
const String readoptions,
boost::shared_ptr< ExperimentalSettings > &  exp_meta,
std::vector< OpenSwath::SwathMap > &  swath_maps,
Interfaces::IMSDataConsumer plugin_consumer 
)
inlineprivate

◆ loadTransitionList()

OpenSwath::LightTargetedExperiment loadTransitionList ( const FileTypes::Type tr_type,
const String tr_file,
const Param tsv_reader_param 
)
inlineprotected

◆ performCalibration()

TransformationDescription performCalibration ( String  trafo_in,
String  irt_tr_file,
std::vector< OpenSwath::SwathMap > &  swath_maps,
double  min_rsq,
double  min_coverage,
const Param feature_finder_param,
const ChromExtractParams cp_irt,
const Param irt_detection_param,
const Param calibration_param,
Size  debug_level,
bool  sonar,
bool  load_into_memory,
const String irt_trafo_out,
const String irt_mzml_out 
)
inlineprotected

Perform retention time and m/z calibration.

This function will create the retention time transformation either by loading a provided .trafoXML file or determine it from the data itself by extracting the transitions specified in the irt_tr_file TraML file. It will also perform the m/z calibration.

Note
Internally, the retention time and m/z calibration are performed by OpenMS::OpenSwathCalibrationWorkflow::performRTNormalization
Parameters
trafo_inInput trafoXML file (if not empty, transformation will be loaded from this file)
irt_tr_fileInput TraML file containing transitions (if trafo_in is empty, this file will be loaded and transitions will be extracted)
swath_mapsThe raw data (swath maps)
min_rsqMinimal R^2 value that is expected for the RT regression
min_coverageMinimal coverage of the chromatographic space that needs to be achieved
feature_finder_paramParameter set for the feature finding in chromatographic dimension
cp_irtParameter set for the chromatogram extraction
irt_detection_paramParameter set for the detection of the iRTs (outlier detection, peptides per bin etc)
calibration_paramParameter for the m/z and im calibration (see SwathMapMassCorrection)
debug_levelDebug level (writes out the RT normalization chromatograms if larger than 1)
sonarWhether the data is SONAR data
load_into_memoryWhether to cache the current SWATH map in memory
irt_trafo_outOutput trafoXML file (if not empty and no input trafoXML file is given, the transformation parameters will be stored in this file)
irt_mzml_outOutput Chromatogram mzML containing the iRT peptides (if not empty, iRT chromatograms will be stored in this file)

References Param::copy(), TransformationDescription::fitModel(), DefaultParamHandler::getDefaults(), TOPPBase::getParam_(), FileHandler::getType(), Param::getValue(), TransformationXMLFile::load(), TOPPOpenSwathBase::loadTransitionList(), TOPPBase::log_type_, OpenSwathCalibrationWorkflow::performRTNormalization(), ProgressLogger::setLogType(), Param::setValue(), TransformationXMLFile::store(), and ParamValue::toString().

◆ prepareChromOutput()

void prepareChromOutput ( Interfaces::IMSDataConsumer **  chromatogramConsumer,
const boost::shared_ptr< ExperimentalSettings > &  exp_meta,
const OpenSwath::LightTargetedExperiment transition_exp,
const String out_chrom,
const UInt64  run_id 
)
inlineprotected

Prepare chromatogram output.

Sets up the chromatogram output, either sqMass or mzML (using numpress lossy compression). This assumes that 0.05 accuracy in RT is sufficient for all purposes.

Parameters
chromatogramConsumerThe consumer to process chromatograms
exp_metameta data about experiment
transition_expThe spectral library
out_chromThe output file for the chromatograms
run_idUnique identifier which links the sqMass and OSW file

References MSDataWritingConsumer::addDataProcessing(), MSNumpressCoder::NumpressConfig::estimate_fixed_point, MzMLHandler::getOptions(), TOPPBase::getProcessingInfo_(), String::hasSuffix(), MSNumpressCoder::NumpressConfig::linear_fp_mass_acc, MSNumpressCoder::NumpressConfig::numpressErrorTolerance, PeakFileOptions::setCompression(), MSNumpressCoder::NumpressConfig::setCompression(), MSDataWritingConsumer::setExpectedSize(), MSDataWritingConsumer::setExperimentalSettings(), PeakFileOptions::setNumpressConfigurationIntensity(), PeakFileOptions::setNumpressConfigurationMassTime(), PeakFileOptions::setWriteIndex(), DataProcessing::SMOOTHING, String::toLower(), and LightTargetedExperiment::transitions.