94 TOPPBase(name, description, official)
101 const bool split_file,
103 const String& readoptions,
104 boost::shared_ptr<ExperimentalSettings > & exp_meta,
105 std::vector< OpenSwath::SwathMap > & swath_maps,
111 if (split_file || file_list.size() > 1)
114 swath_maps = swath_file.
loadSplit(file_list, tmp, exp_meta, readoptions);
121 swath_maps = swath_file.
loadMzML(file_list[0], tmp, exp_meta, readoptions, plugin_consumer);
125 swath_maps = swath_file.
loadMzXML(file_list[0], tmp, exp_meta, readoptions);
129 swath_maps = swath_file.
loadSqMass(file_list[0], exp_meta);
134 "Input file needs to have ending mzML or mzXML");
166 boost::shared_ptr<ExperimentalSettings >& exp_meta,
167 std::vector< OpenSwath::SwathMap >& swath_maps,
168 const bool split_file,
170 const String& readoptions,
171 const String& swath_windows_file,
172 const double min_upper_edge_dist,
174 const bool sort_swath_maps,
179 loadSwathFiles_(file_list, split_file, tmp, readoptions, exp_meta, swath_maps, plugin_consumer);
182 if (!swath_windows_file.empty())
187 for (
Size i = 0; i < swath_maps.size(); i++)
190 <<
" with lower " << swath_maps[i].lower
191 <<
" and upper " << swath_maps[i].upper
192 <<
" and " << swath_maps[i].sptr->getNrSpectra()
193 <<
" spectra." << std::endl;
197 std::vector<std::pair<double, double>> sw_windows;
198 for (
Size i = 0; i < swath_maps.size(); i++)
200 if (!swath_maps[i].ms1)
202 sw_windows.push_back(std::make_pair(swath_maps[i].lower, swath_maps[i].upper));
206 std::sort(sw_windows.begin(), sw_windows.end());
208 for (
Size i = 1; i < sw_windows.size(); i++)
210 double lower_map_end = sw_windows[i-1].second - min_upper_edge_dist;
211 double upper_map_start = sw_windows[i].first;
212 LOG_DEBUG <<
"Extraction will go up to " << lower_map_end <<
" and continue at " << upper_map_start << std::endl;
214 if (upper_map_start - lower_map_end > 0.01)
216 LOG_WARN <<
"Extraction will have a gap between " << lower_map_end <<
" and " << upper_map_start << std::endl;
219 LOG_ERROR <<
"Extraction windows have a gap. Will abort (override with -force)" << std::endl;
224 if (sonar) {
continue;}
226 if (lower_map_end - upper_map_start > 0.01)
228 LOG_WARN <<
"Extraction will overlap between " << lower_map_end <<
" and " << upper_map_start <<
"!\n" 229 <<
"This will lead to multiple extraction of the transitions in the overlapping region " 230 <<
"which will lead to duplicated output. It is very unlikely that you want this." <<
"\n" 231 <<
"Please fix this by providing an appropriate extraction file with -swath_windows_file" << std::endl;
234 LOG_ERROR <<
"Extraction windows overlap. Will abort (override with -force)" << std::endl;
256 const boost::shared_ptr<ExperimentalSettings>& exp_meta,
260 if (!out_chrom.empty())
264 bool full_meta =
false;
265 bool lossy_compression =
true;
266 *chromatogramConsumer =
new MSDataSqlConsumer(out_chrom, 500, full_meta, lossy_compression);
271 int expected_chromatograms = transition_exp.
transitions.size();
292 *chromatogramConsumer = chromConsumer;
311 const Param& tsv_reader_param)
340 LOG_ERROR <<
"Provide valid TraML, TSV or PQP transition file." << std::endl;
343 return transition_exp;
380 std::vector< OpenSwath::SwathMap > & swath_maps,
383 const Param& feature_finder_param,
385 const Param& irt_detection_param,
386 const String & mz_correction_function,
389 bool load_into_memory,
390 const String& irt_trafo_out,
391 const String& irt_mzml_out)
395 if (!trafo_in.empty())
399 trafoxml.
load(trafo_in, trafo_rtnorm,
false);
401 model_params.
setValue(
"symmetric_regression",
"false");
403 model_params.
setValue(
"num_nodes", irt_detection_param.
getValue(
"b_spline:num_nodes"));
404 String model_type = irt_detection_param.
getValue(
"alignmentMethod");
405 trafo_rtnorm.
fitModel(model_type, model_params);
407 else if (!irt_tr_file.empty())
410 std::cout <<
"Will load iRT transitions and try to find iRT peptides" << std::endl;
420 feature_finder_param, cp_irt, irt_detection_param, mz_correction_function, irt_mzml_out,
421 debug_level, sonar, load_into_memory);
423 if (!irt_trafo_out.empty())
Definition: OpenSwathBase.h:87
Type
Actual file types enum.
Definition: FileTypes.h:58
msInspect file (.tsv)
Definition: FileTypes.h:87
void setWriteIndex(bool write_index)
Whether to write an index at the end of the file (e.g. indexedmzML file format)
void setCompression(bool compress)
std::vector< LightTransition > transitions
Definition: TransitionExperiment.h:215
static FileTypes::Type getType(const String &filename)
Tries to determine the file type (by name or content)
void setValue(const String &key, const DataValue &value, const String &description="", const StringList &tags=StringList())
Sets a value.
A more convenient string class.
Definition: String.h:58
Consumer class that writes MS data to disk using the mzML format.
Definition: MSDataWritingConsumer.h:240
void endProgress() const
Ends the progress display.
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.
Definition: OpenSwathBase.h:309
Consumer class that perform no operation.
Definition: MSDataWritingConsumer.h:258
std::vector< OpenSwath::SwathMap > loadMzML(const String &file, const String &tmp, boost::shared_ptr< ExperimentalSettings > &exp_meta, const String &readoptions="normal", Interfaces::IMSDataConsumer *plugin_consumer=nullptr)
Loads a Swath run from a single mzML file.
void setExperimentalSettings(const ExperimentalSettings &exp) override
Set experimental settings for the whole file.
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)
Definition: OpenSwathBase.h:100
void setCompression(const std::string &compression)
set compression using a string mapping to enum NumpressCompression.
Definition: MSNumpressCoder.h:111
File adapter for HUPO PSI TraML files.
Definition: TraMLFile.h:63
std::vector< OpenSwath::SwathMap > loadMzXML(String file, String tmp, boost::shared_ptr< ExperimentalSettings > &exp_meta, String readoptions="normal")
Loads a Swath run from a single mzXML file.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
void setParameters(const Param ¶m)
Sets the parameters.
Base class for TOPP applications.
Definition: TOPPBase.h:150
#define LOG_DEBUG
Macro for general debugging information.
Definition: LogStream.h:460
Configuration class for MSNumpress.
Definition: MSNumpressCoder.h:87
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, Interfaces::IMSDataConsumer *plugin_consumer=nullptr)
Load the DIA files into internal data structures.
Definition: OpenSwathBase.h:165
#define LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:448
#define LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged...
Definition: LogStream.h:452
double linear_fp_mass_acc
desired mass accuracy for *linear* encoding (-1 no effect, use 0.0001 for 0.2 ppm accuracy @ 500 m/z)...
Definition: MSNumpressCoder.h:93
void convertPQPToTargetedExperiment(const char *filename, OpenMS::TargetedExperiment &targeted_exp, bool legacy_traml_id=false)
Read in a PQP file and construct a targeted experiment (TraML structure)
A data consumer that inserts MS data into a SQLite database.
Definition: MSDataSqlConsumer.h:60
virtual void addDataProcessing(DataProcessing d)
Optionally add a data processing method to each chromatogram and spectrum.
const Param & getDefaults() const
Non-mutable access to the default parameters.
std::vector< OpenSwath::SwathMap > loadSqMass(String file, boost::shared_ptr< ExperimentalSettings > &)
Loads a Swath run from a single sqMass file.
void setNumpressConfigurationMassTime(MSNumpressCoder::NumpressConfig config)
Get numpress configuration options for m/z or rt dimension.
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
File adapter for Swath files.
Definition: SwathFile.h:67
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
void setNumpressConfigurationIntensity(MSNumpressCoder::NumpressConfig config)
Get numpress configuration options for intensity dimension.
PeakFileOptions & getOptions()
Get the peak file options.
const DataValue & getValue(const String &key) const
Returns a value of a parameter.
Param copy(const String &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenSWATH Peptide Query Parameter (PQP) SQLite DB.
Definition: FileTypes.h:104
TraML (HUPO PSI format) for transitions (.traML)
Definition: FileTypes.h:81
void setExpectedSize(Size expectedSpectra, Size expectedChromatograms) override
Set expected size of spectra and chromatograms to be written.
static void annotateSwathMapsFromFile(const std::string &filename, std::vector< OpenSwath::SwathMap > &swath_maps, bool do_sort, bool force)
Annotate a Swath map using a Swath window file specifying the individual windows. ...
static void convertTargetedExp(const OpenMS::TargetedExperiment &transition_exp_, OpenSwath::LightTargetedExperiment &transition_exp)
convert from the OpenMS TargetedExperiment to the LightTargetedExperiment
Param const & getParam_() const
Return all parameters relevant to this TOPP tool.
TOPPOpenSwathBase(String name, String description, bool official=true)
Definition: OpenSwathBase.h:93
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 String &mz_correction_function, 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.
Definition: OpenSwathBase.h:378
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:73
Management and storage of parameters / INI files.
Definition: Param.h:74
std::vector< OpenSwath::SwathMap > loadSplit(StringList file_list, String tmp, boost::shared_ptr< ExperimentalSettings > &exp_meta, String readoptions="normal")
Loads a Swath run from a list of split mzML files.
bool estimate_fixed_point
whether to estimate the fixed point or use the one proved with numpressFixedPoint ...
Definition: MSNumpressCoder.h:92
DataProcessing getProcessingInfo_(DataProcessing::ProcessingAction action) const
Returns the data processing information.
Smoothing of the signal to reduce noise.
Definition: DataProcessing.h:63
void convertTSVToTargetedExperiment(const char *filename, FileTypes::Type filetype, OpenMS::TargetedExperiment &targeted_exp)
Read in a tsv/mrm file and construct a targeted experiment (TraML structure)
void startProgress(SignedSize begin, SignedSize end, const String &label) const
Initializes the progress display.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:67
void load(const String &filename, TargetedExperiment &id)
Loads a map from a TraML file.
This class supports reading and writing of OpenSWATH transition lists.
Definition: TransitionTSVFile.h:142
This class supports reading and writing of PQP files.
Definition: TransitionPQPFile.h:57
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
static FileTypes::Type getTypeByFileName(const String &filename)
Determines the file type from a file name.
SqLite format for mass and chromatograms.
Definition: FileTypes.h:103
Execute all steps for retention time and m/z calibration of SWATH-MS data.
Definition: OpenSwathWorkflow.h:230
TransformationDescription performRTNormalization(const OpenSwath::LightTargetedExperiment &irt_transitions, 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 String &mz_correction_function, const String &irt_mzml_out, Size debug_level, bool sonar=false, bool load_into_memory=false)
Perform RT and m/z correction of the input data using RT-normalization peptides.
double numpressErrorTolerance
check error tolerance after encoding, guarantee abs(1.0-(encoded/decoded)) <= this, 0=do not guarantee anything
Definition: MSNumpressCoder.h:90
Definition: TransitionExperiment.h:206
void prepareChromOutput(Interfaces::IMSDataConsumer **chromatogramConsumer, const boost::shared_ptr< ExperimentalSettings > &exp_meta, const OpenSwath::LightTargetedExperiment &transition_exp, const String &out_chrom)
Prepare chromatogram output.
Definition: OpenSwathBase.h:255
MzML file (.mzML)
Definition: FileTypes.h:72
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
ProgressLogger::LogType log_type_
Type of progress logging.
Definition: TOPPBase.h:881
MzXML file (.mzXML)
Definition: FileTypes.h:64