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

Shared spectral-library preparation helper for OpenSWATH-family workflows. More...

#include <OpenMS/ANALYSIS/OPENSWATH/OpenSwathLibraryPreparation.h>

Classes

struct  AssayGeneratorParameters
 
struct  DecoyGeneratorParameters
 
struct  LibraryStats
 
struct  PredictedLibraryParameters
 

Public Member Functions

 OpenSwathLibraryPreparation ()
 
void setLogType (ProgressLogger::LogType log_type)
 
ProgressLogger::LogType getLogType () const
 
void ensureUnimodLoaded (const AssayGeneratorParameters &parameters) const
 Ensure the requested Unimod source is loaded before modified sequences are parsed.
 
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.
 
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.
 
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.
 
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.
 
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.
 

Private Attributes

ProgressLogger::LogType log_type_ = ProgressLogger::CMD
 

Detailed Description

Shared spectral-library preparation helper for OpenSWATH-family workflows.

This helper centralizes the file-format-aware spectral library preparation steps that historically lived directly inside TOPP front-ends:

  • prepared-library normalization to PQP
  • assay generation / preparation
  • decoy generation
  • empirical-library preparation for full DIA workflows

The implementation mirrors the existing TOPP behavior, including the lightweight TSV/PQP/OSWPQ path where possible and the heavy TraML path when required.


Class Documentation

◆ OpenMS::OpenSwathLibraryPreparation::AssayGeneratorParameters

struct OpenMS::OpenSwathLibraryPreparation::AssayGeneratorParameters
Class Members
vector< size_t > allowed_fragment_charges {1, 2, 3, 4}
vector< string > allowed_fragment_types {"b", "y"}
bool disable_decoy_transitions = false
bool enable_detection_specific_losses = false
bool enable_detection_unspecific_losses = false
bool enable_identification_ms2_precursors = true
bool enable_identification_specific_losses = true
bool enable_identification_unspecific_losses = false
bool enable_ipf = false
bool enable_swath_specifity = false
int ipf_decoy_seed = 1
size_t max_num_alternative_localizations = 10000
Int max_transitions = 6
Int min_transitions = 6
double precursor_lower_mz_limit = 400.0
double precursor_mz_threshold = 0.025
double precursor_upper_mz_limit = 1200.0
double product_lower_mz_limit = 350.0
double product_mz_threshold = 0.025
double product_upper_mz_limit = 2000.0
bool reuse_existing_modifications_db = false
vector< pair< double, double > > swathes
bool test_mode = false
string unimod_file

◆ OpenMS::OpenSwathLibraryPreparation::DecoyGeneratorParameters

struct OpenMS::OpenSwathLibraryPreparation::DecoyGeneratorParameters
Class Members
double aim_decoy_fraction = 1.0
vector< size_t > allowed_fragment_charges {1, 2, 3, 4}
vector< string > allowed_fragment_types {"b", "y"}
string decoy_tag = "DECOY_"
bool enable_detection_specific_losses = false
bool enable_detection_unspecific_losses = false
string method = "shuffle"
double min_decoy_fraction = 0.8
double product_mz_threshold = 0.025
bool separate = false
double shift_precursor_mz_shift = 0.0
double shift_product_mz_shift = 20.0
Int shuffle_max_attempts = 30
Int shuffle_seed = 1 Shuffle RNG seed: 1 gives reproducible decoys, -1 uses the current time.
double shuffle_sequence_identity_threshold = 0.5
bool switch_kr = true

◆ OpenMS::OpenSwathLibraryPreparation::PredictedLibraryParameters

struct OpenMS::OpenSwathLibraryPreparation::PredictedLibraryParameters
Class Members
string ccs_model_path
bool clip_nterm_methionine {}
string enzyme
vector< string > fixed_modifications
Int inference_threads {}
Int instrument_index {}
Size max_peptide_length {}
Size max_variable_modifications {}
Size min_peptide_length {}
Size missed_cleavages {}
string ms2_model_path
double nce {}
vector< Int > precursor_charges
bool predict_ccs {}
Size prediction_batch_size {}
string rt_model_path
vector< string > variable_modifications

Constructor & Destructor Documentation

◆ OpenSwathLibraryPreparation()

Member Function Documentation

◆ ensureUnimodLoaded()

void ensureUnimodLoaded ( const AssayGeneratorParameters &  parameters) const

Ensure the requested Unimod source is loaded before modified sequences are parsed.

◆ generateDecoys()

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.

◆ getLogType()

ProgressLogger::LogType getLogType ( ) const

◆ normalizeLibraryToPQP()

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.

◆ prepareAssays()

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.

◆ prepareEmpiricalLibraryToPQP()

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.

Parameters
input_fileInput transition library file.
input_typeFile type of the input transition library.
output_pqpOutput path for the prepared target/decoy PQP library.
assay_parametersAssay-generation parameters applied before decoy generation.
decoy_parametersDecoy-generation parameters used for the prepared assays.
reader_parametersOptional parameters passed to the transition-library reader.
scratch_directoryOptional directory for the temporary assay-preparation file. The intermediate gets a unique per-invocation file name, so concurrent callers can share this directory without sharing or overwriting the same intermediate. No subdirectory is created, which keeps paths short on Windows. The file is removed on both success and failure. When empty, a fresh system temporary directory is used.

◆ preparePredictedLibraryToPQP()

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.

FASTA entries whose identifier starts with decoy_parameters.decoy_tag, or carries a decoy affix detected by DecoyHelper::findDecoyString, are skipped.

Prediction batches are spilled to disk; global UIS/decoy generation still materializes the library.

Parameters
[in]input_fastaFASTA file to digest and predict.
[in]output_pqpPrepared target/decoy library.
[in]assay_parametersAssay filtering and UIS settings.
[in]decoy_parametersDecoy generation settings.
[in]prediction_parametersDigestion and prediction settings (charges must be unique).
[in]scratch_directoryDirectory for temporary prediction batches; empty uses the system temporary directory. Scratch files are removed on success and failure.

The method remains available in non-ONNX builds but throws Exception::Precondition when called.

◆ setLogType()

void setLogType ( ProgressLogger::LogType  log_type)

Member Data Documentation

◆ log_type_