OpenMS
OpenSwathOSWWriter Class Reference

Class to write out an OpenSwath OSW SQLite output (PyProphet input). More...

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

Collaboration diagram for OpenSwathOSWWriter:
[legend]

Public Member Functions

 OpenSwathOSWWriter (const String &output_filename, const UInt64 run_id, const String &input_filename="inputfile", bool ms1_scores=false, bool sonar=false, bool uis_scores=false)
 
bool isActive () const
 
void writeHeader ()
 Initializes file by generating SQLite tables. More...
 
String getScore (const Feature &feature, const std::string &score_name) const
 Prepare scores for SQLite insertion. More...
 
std::vector< StringgetSeparateScore (const Feature &feature, const std::string &score_name) const
 Prepare concatenated scores for SQLite insertion. More...
 
String prepareLine (const OpenSwath::LightCompound &, const OpenSwath::LightTransition *, const FeatureMap &output, const String &id) const
 Prepare a single line (feature) for output. More...
 
void writeLines (const std::vector< String > &to_osw_output)
 Write data to disk. More...
 

Private Attributes

String output_filename_
 
String input_filename_
 
OpenMS::UInt64 run_id_
 
bool doWrite_
 
bool use_ms1_traces_
 
bool sonar_
 
bool enable_uis_scoring_
 

Detailed Description

Class to write out an OpenSwath OSW SQLite output (PyProphet input).

The class can take a FeatureMap and create a set of string from it suitable for output to OSW using the prepareLine function. The SQL data is directly linked to the PQP file format described in the TransitionPQPFile class. See also OpenSwathTSVWriter for another output format.

The file format has the following tables:

RUN
ID INT Primary Key (run id)
FILENAME TEXT Original filename associated with the run
FEATURE
ID INT Primary Key (feature id)
RUN_ID INT Foreign Key (RUN.ID)
PRECURSOR_ID INT Foreign Key (TransitionPQPFile PRECURSOR.ID)
EXP_RT REAL Experimental RT (retention time) of the feature
NORM_RT REAL Normalized RT (retention time) of the feature. The position of the peak group in the normalized retention time space (e.g. fx(RT) where fx describes the transformation fx)
DELTA_RT REAL The difference in retention between expected retention time of the assay and the measured feature retention time (EXP_RT)
LEFT_WIDTH REAL Retention time start of the peak (left width) in seconds
RIGHT_WIDTH REAL Retention time end of the peak (right width) in seconds
FEATURE_MS1
FEATURE_ID INT Foreign Key (FEATURE.ID)
AREA_INTENSITY REAL Precursor intensity (area)
APEX_INTENSITY REAL Precursor intensity (apex)
VAR_... REAL Precursor score used in pyProphet
FEATURE_MS2
FEATURE_ID INT Foreign Key (FEATURE.ID)
AREA_INTENSITY REAL Summed fragment ion intensity (area)
TOTAL_AREA_INTENSITY REAL Summed total XIC of the whole chromatogram
APEX_INTENSITY REAL Summed fragment ion intensity (apex)
TOTAL_MI REAL Total mutual information (MI)
VAR_... REAL Fragment ion score used in pyProphet
FEATURE_PRECURSOR
FEATURE_ID INT Foreign Key (FEATURE.ID)
ISOTOPE INT Isotope identifier
AREA_INTENSITY REAL Precursor isotope ion intensity (area)
APEX_INTENSITY REAL Precursor isotope ion intensity (apex)
FEATURE_TRANSITION
FEATURE_ID INT Foreign Key (FEATURE.ID)
TRANSITION_ID INT Foreign Key (transition identifier)
AREA_INTENSITY REAL Fragment ion intensity (area)
TOTAL_AREA_INTENSITY REAL Total XIC of the whole chromatogram
APEX_INTENSITY REAL Fragment ion intensity (apex)
TOTAL_MI REAL Total mutual information (MI)
VAR_... REAL Fragment ion score used in pyProphet

Constructor & Destructor Documentation

◆ OpenSwathOSWWriter()

OpenSwathOSWWriter ( const String output_filename,
const UInt64  run_id,
const String input_filename = "inputfile",
bool  ms1_scores = false,
bool  sonar = false,
bool  uis_scores = false 
)

Member Function Documentation

◆ getScore()

String getScore ( const Feature feature,
const std::string &  score_name 
) const

Prepare scores for SQLite insertion.

Some scores might not be defined, those are reported as NULL

Parameters
featureThe feature being evaluated
score_nameThe name of the queried score
Returns
A string with the queried score

◆ getSeparateScore()

std::vector<String> getSeparateScore ( const Feature feature,
const std::string &  score_name 
) const

Prepare concatenated scores for SQLite insertion.

Some scores might not be defined, those are reported as NULL

Parameters
featureThe feature being evaluated
score_nameThe name of the queried score
Returns
A vector of strings with the queried scores

◆ isActive()

bool isActive ( ) const

◆ prepareLine()

String prepareLine ( const OpenSwath::LightCompound ,
const OpenSwath::LightTransition ,
const FeatureMap output,
const String id 
) const

Prepare a single line (feature) for output.

The result can be flushed to disk using writeLines (either line by line or after collecting several lines).

Parameters
pepThe compound (peptide/metabolite) used for extraction
transitionThe transition used for extraction
outputThe feature map containing all features (each feature will generate one entry in the output)
idThe transition group identifier (peptide/metabolite id)
Returns
A string to be written using writeLines

◆ writeHeader()

void writeHeader ( )

Initializes file by generating SQLite tables.

◆ writeLines()

void writeLines ( const std::vector< String > &  to_osw_output)

Write data to disk.

Takes a set of pre-prepared data statements from prepareLine and flushes them to disk

Parameters
to_osw_outputStatements generated by prepareLine
Note
Try to call this function as little as possible (it opens a new database connection each time)
Only call inside an OpenMP critical section

Member Data Documentation

◆ doWrite_

bool doWrite_
private

◆ enable_uis_scoring_

bool enable_uis_scoring_
private

◆ input_filename_

String input_filename_
private

◆ output_filename_

String output_filename_
private

◆ run_id_

OpenMS::UInt64 run_id_
private

◆ sonar_

bool sonar_
private

◆ use_ms1_traces_

bool use_ms1_traces_
private