OpenSwathTSVWriter Class Reference

Class to write out an OpenSwath TSV output (mProphet input). More...

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

Collaboration diagram for OpenSwathTSVWriter:

Public Member Functions

 OpenSwathTSVWriter (const String &output_filename, const String &input_filename="inputfile", bool ms1_scores=false, bool sonar=false)
bool isActive () const
void writeHeader ()
 Initializes file by writing TSV header. More...
String prepareLine (const OpenSwath::LightCompound &pep, const OpenSwath::LightTransition *transition, const FeatureMap &output, const String &id) const
 Prepare a single line (feature) for output. More...
void writeLines (const std::vector< String > &to_output)
 Write data to disk. More...

Private Attributes

std::ofstream ofs
String input_filename_
bool doWrite_
bool use_ms1_traces_
bool sonar_

Detailed Description

Class to write out an OpenSwath TSV output (mProphet input).

The output is organized as a set of rows where each row describes a single peak in a chromatogram with a start and end retention time. Per chromatogram multiple rows can be reported if more than one potential peak was found. See also OpenSwathOSWWriter for another output format.

The class can take a FeatureMap and create a set of string from it suitable for output to tsv using the prepareLine() function. These lines can also be directly written to a file using writeLines().

The output format written by this class is a TSV file (tab-separated plain text file) with the following columns:

transition_group_id string designates the transition group [e.g. peptide/molecule] to which this transition belongs
peptide_group_label string designates to which peptide label group (as defined in MS:1000893) the peptide belongs to2
run_id integer LC-MS/MS run (currently always 0)
filename string filename of the raw LC-MS/MS file
RT float peak group retention time (apex)
id string unique peak group identifier
Sequence string Peptide sequence
MC int Number of missed cleavages
FullPeptideName string Full peptide sequence including modifications 1
Charge string Peptide (analyte) precursor charge
m/z string Peptide (analyte) precursor m/z
Intensity float Peptide (analyte) intensity (sum over all fragment ion intensities)
ProteinName string Protein Identifier
GeneName string Gene identifier
decoy string Whether peak group was found in a decoy chromatogram (0 = false)
assay_rt string The retention time at which the peptide (analyte) was expected to elute based on the retention time calibration
delta_rt string The difference in retention between expected retention time (assay_rt) and peak group retention time (RT)
leftWidth float Retention time start of the peak (left width) in seconds
main_var_xx_swath_prelim_score float Preliminary separation for pyProphet initialization
norm_RT string The position of the peak group in the normalized retention time space (e.g. fx(RT) where fx describes the transformation fx)
nr_peaks int The number of transitions used
peak_apices_sum float The sum of the peak apices intensities
potentialOutlier string Potential outlier transition
initialPeakQuality float Initial peak quality score (if computing peak quality was enabled)
rightWidth string Retention time end of the peak (left width) in seconds
rt_score string sequence
sn_ratio float Signal-to-Noise ratio
total_xic float Total XIC
var_... float A variable used for the post-processing and scoring
aggr_prec_Peak_Area float-list MS1 Precursor peak area (for each isotope)
aggr_prec_Peak_Apex float-list MS1 Precursor peak apex (for each isotope)
aggr_prec_Annotation string-list MS1 Precursor annotation (for each isotope)
aggr_Peak_Area float-list Fragment ion peak area (for each transition)
aggr_Peak_Apex float-list Fragment ion peak apex (for each transition)
aggr_Fragment_Annotation string-list Fragment ion annotation (for each transition)
masserror_ppm string Fragment-level mass error for each transition (see aggr_Fragment_Annotation for order)
rt_fwhm string Fragment-level FWHM (full width half maximum) for each individual transition (see aggr_Fragment_Annotation for order)


  • 1. modifications should be supplied inside the sequence using UniMod identifiers or freetext identifiers that are understood by OpenMS. See also OpenMS::AASequence for more information. For example:
    • PEPT(Phosphorylation)IDE(UniMod:27)A )
  • 2. peptide label groups designate groups of peptides that are isotopically modified forms of the same peptide species. For example, the heavy and light forms of the same peptide will both be assigned the same peptide group label. For example:
    • PEPTIDEAK -> gets label "PEPTIDEAK_gr1"
    • PEPTIDEAK[+8] -> gets label "PEPTIDEAK_gr1"
    • PEPT(Phosphorylation)IDEAK -> gets label "PEPTIDEAK_gr2"
    • PEPT(Phosphorylation)IDEAK[+8] -> gets label "PEPTIDEAK_gr2"

Constructor & Destructor Documentation

◆ OpenSwathTSVWriter()

OpenSwathTSVWriter ( const String output_filename,
const String input_filename = "inputfile",
bool  ms1_scores = false,
bool  sonar = false 

Member Function Documentation

◆ isActive()

bool isActive ( ) const

◆ prepareLine()

String prepareLine ( const OpenSwath::LightCompound pep,
const OpenSwath::LightTransition transition,
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).

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)
A string to be written using writeLines

◆ writeHeader()

void writeHeader ( )

Initializes file by writing TSV header.

◆ writeLines()

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

Write data to disk.

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

to_outputStatements generated by prepareLine to be written to a file
Only call inside an OpenMP critical section

Member Data Documentation

◆ doWrite_

bool doWrite_

◆ input_filename_

String input_filename_

◆ ofs

std::ofstream ofs

◆ sonar_

bool sonar_

◆ use_ms1_traces_

bool use_ms1_traces_