OpenMS
Loading...
Searching...
No Matches
OpenSwathLibraryPreparation.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Justin Sing $
6// $Authors: Justin Sing $
7// --------------------------------------------------------------------------
8
9#pragma once
10
15#include <OpenMS/config.h>
16
17#include <string>
18#include <utility>
19#include <vector>
20
21namespace OpenMS
22{
40 class OPENMS_DLLAPI OpenSwathLibraryPreparation
41 {
42 public:
43 struct OPENMS_DLLAPI LibraryStats
44 {
45 Size protein_count = 0;
46 Size compound_count = 0;
47 Size transition_count = 0;
48 Size decoy_transition_count = 0;
49 Size identifying_transition_count = 0;
50
51 bool hasDecoys() const
52 {
53 return decoy_transition_count > 0;
54 }
55
57 {
58 return identifying_transition_count > 0;
59 }
60 };
61
62 struct OPENMS_DLLAPI AssayGeneratorParameters
63 {
64 Int min_transitions = 6;
65 Int max_transitions = 6;
66 std::vector<std::string> allowed_fragment_types{"b", "y"};
67 std::vector<size_t> allowed_fragment_charges{1, 2, 3, 4};
68 bool enable_detection_specific_losses = false;
69 bool enable_detection_unspecific_losses = false;
70
71 double precursor_mz_threshold = 0.025;
72 double precursor_lower_mz_limit = 400.0;
73 double precursor_upper_mz_limit = 1200.0;
74 double product_mz_threshold = 0.025;
75 double product_lower_mz_limit = 350.0;
76 double product_upper_mz_limit = 2000.0;
77 std::vector<std::pair<double, double>> swathes;
78
79 bool enable_ipf = false;
80 size_t max_num_alternative_localizations = 10000;
81 bool enable_identification_ms2_precursors = true;
82 bool enable_identification_specific_losses = true;
83 bool enable_identification_unspecific_losses = false;
84 bool enable_swath_specifity = false;
85 bool disable_decoy_transitions = false;
86 int ipf_decoy_seed = 1;
87 bool test_mode = false;
88 std::string unimod_file;
89 bool reuse_existing_modifications_db = false;
90 };
91
92 struct OPENMS_DLLAPI PredictedLibraryParameters
93 {
94 std::string enzyme;
95 Size missed_cleavages{};
96 Size min_peptide_length{};
97 Size max_peptide_length{};
98 std::vector<Int> precursor_charges;
99 std::vector<std::string> fixed_modifications;
100 std::vector<std::string> variable_modifications;
101 Size max_variable_modifications{};
102 bool clip_nterm_methionine{};
103 Size prediction_batch_size{};
104 Int inference_threads{};
105 double nce{};
106 Int instrument_index{};
107 bool predict_ccs{};
108 std::string rt_model_path;
109 std::string ccs_model_path;
110 std::string ms2_model_path;
111 };
112
113 struct OPENMS_DLLAPI DecoyGeneratorParameters
114 {
115 std::string method = "shuffle";
116 std::string decoy_tag = "DECOY_";
117 double min_decoy_fraction = 0.8;
118 double aim_decoy_fraction = 1.0;
119 Int shuffle_max_attempts = 30;
120 double shuffle_sequence_identity_threshold = 0.5;
121 double shift_precursor_mz_shift = 0.0;
122 double shift_product_mz_shift = 20.0;
123 double product_mz_threshold = 0.025;
124 std::vector<std::string> allowed_fragment_types{"b", "y"};
125 std::vector<size_t> allowed_fragment_charges{1, 2, 3, 4};
126 bool enable_detection_specific_losses = false;
127 bool enable_detection_unspecific_losses = false;
128 bool switch_kr = true;
129 bool separate = false;
131 Int shuffle_seed = 1;
132 };
133
135
137
139
141 void ensureUnimodLoaded(const AssayGeneratorParameters& parameters) const;
142
144 LibraryStats normalizeLibraryToPQP(const std::string& input_file,
145 FileTypes::Type input_type,
146 const std::string& output_pqp,
147 const Param& reader_parameters = Param()) const;
148
150 LibraryStats prepareAssays(const std::string& input_file,
151 FileTypes::Type input_type,
152 const std::string& output_file,
153 FileTypes::Type output_type,
154 const AssayGeneratorParameters& parameters,
155 const Param& reader_parameters = Param()) const;
156
158 LibraryStats generateDecoys(const std::string& input_file,
159 FileTypes::Type input_type,
160 const std::string& output_file,
161 FileTypes::Type output_type,
162 const DecoyGeneratorParameters& parameters,
163 const Param& reader_parameters = Param()) const;
164
180 LibraryStats prepareEmpiricalLibraryToPQP(const std::string& input_file,
181 FileTypes::Type input_type,
182 const std::string& output_pqp,
183 const AssayGeneratorParameters& assay_parameters,
184 const DecoyGeneratorParameters& decoy_parameters,
185 const Param& reader_parameters = Param(),
186 const std::string& scratch_directory = "") const;
187
206 const std::string& input_fasta,
207 const std::string& output_pqp,
208 const AssayGeneratorParameters& assay_parameters,
209 const DecoyGeneratorParameters& decoy_parameters,
210 const PredictedLibraryParameters& prediction_parameters,
211 const std::string& scratch_directory = "") const;
212
213 private:
214 ProgressLogger::LogType log_type_ = ProgressLogger::CMD;
215 };
216} // namespace OpenMS
Shared spectral-library preparation helper for OpenSWATH-family workflows.
Definition OpenSwathLibraryPreparation.h:41
std::vector< Int > precursor_charges
Definition OpenSwathLibraryPreparation.h:98
std::string ms2_model_path
Definition OpenSwathLibraryPreparation.h:110
LibraryStats prepareEmpiricalLibraryToPQP(const std::string &input_file, FileTypes::Type input_type, const std::string &output_pqp, const AssayGeneratorParameters &assay_parameters, const DecoyGeneratorParameters &decoy_parameters, const Param &reader_parameters=Param(), const std::string &scratch_directory="") const
Prepare an empirical library by running assay generation and decoy generation into a final PQP.
std::string ccs_model_path
Definition OpenSwathLibraryPreparation.h:109
std::vector< std::pair< double, double > > swathes
Definition OpenSwathLibraryPreparation.h:77
std::vector< std::string > fixed_modifications
Definition OpenSwathLibraryPreparation.h:99
LibraryStats preparePredictedLibraryToPQP(const std::string &input_fasta, const std::string &output_pqp, const AssayGeneratorParameters &assay_parameters, const DecoyGeneratorParameters &decoy_parameters, const PredictedLibraryParameters &prediction_parameters, const std::string &scratch_directory="") const
Build a prepared target/decoy PQP directly from FASTA using native PeptDeep prediction.
void ensureUnimodLoaded(const AssayGeneratorParameters &parameters) const
Ensure the requested Unimod source is loaded before modified sequences are parsed.
LibraryStats generateDecoys(const std::string &input_file, FileTypes::Type input_type, const std::string &output_file, FileTypes::Type output_type, const DecoyGeneratorParameters &parameters, const Param &reader_parameters=Param()) const
Run decoy generation and write the requested output format.
std::string rt_model_path
Definition OpenSwathLibraryPreparation.h:108
std::string enzyme
Definition OpenSwathLibraryPreparation.h:94
std::vector< std::string > variable_modifications
Definition OpenSwathLibraryPreparation.h:100
LibraryStats prepareAssays(const std::string &input_file, FileTypes::Type input_type, const std::string &output_file, FileTypes::Type output_type, const AssayGeneratorParameters &parameters, const Param &reader_parameters=Param()) const
Run assay generation / preparation and write the requested output format.
ProgressLogger::LogType getLogType() const
LibraryStats normalizeLibraryToPQP(const std::string &input_file, FileTypes::Type input_type, const std::string &output_pqp, const Param &reader_parameters=Param()) const
Normalize a prepared library into internal PQP format.
void setLogType(ProgressLogger::LogType log_type)
std::string unimod_file
Definition OpenSwathLibraryPreparation.h:88
Definition OpenSwathLibraryPreparation.h:63
Definition OpenSwathLibraryPreparation.h:114
Definition OpenSwathLibraryPreparation.h:93
Management and storage of parameters / INI files.
Definition Param.h:46
LogType
Possible log types.
Definition ProgressLogger.h:44
int Int
Signed integer type.
Definition Types.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Type
Actual file types enum.
Definition FileTypes.h:31
Definition OpenSwathLibraryPreparation.h:44
bool hasIdentifyingTransitions() const
Definition OpenSwathLibraryPreparation.h:56
bool hasDecoys() const
Definition OpenSwathLibraryPreparation.h:51