Binder  Script  Notebook

PSMBasedQuantification

PSMBasedQuantification turns the identifications from PSMStatistics into peptide ion intensities. For every identified peptide ion (sequence, modification state and charge) it takes the scan times of its MS/MS identifications, extracts an ion chromatogram of the monoisotopic m/z in a window around them, detects the peaks in that trace and fits the peak closest to the identification. The fitted area is the reported quantity. For metabolically labeled samples the tool computes the m/z of the partner ion (the heavy form of a light identification, or the other way round) and quantifies that trace as well, so every row can carry a light and a heavy value.

Inputs and outputs

Flag

Meaning

Comes from

-i

one or more .mzlite files, or a directory

MzMLToMzLite

-ii

one or more .qpsm files, or a directory that is searched for *.qpsm

PSMStatistics

-d

the SQLite peptide database

PeptideDB

-o

the output directory, created when missing

-p

the parameter file in JSON

this page

-mf

switch: pair files by base name instead of by position

-dc

switch: write diagnostic charts

-z

switch: pack the chart directory into a zip file and delete it

-c

number of runs quantified at the same time, default 1

The input must be .mzlite. A directory given to -i is also scanned for .mzML, but the tool opens every file with the mzlite reader and fails on anything else, so convert first. With one file per flag the pair is used as given. With lists, the n-th mzlite file is paired with the n-th qpsm file unless you pass -mf, which pairs files by their base name (run1.mzlite with run1.qpsm) and skips mzlite files without a partner.

For every run the tool writes run.quant, tab separated with a header and one row per quantified peptide ion. Next to the identifiers and the best q-value and PEP value of the ion it reports the fitted quantity (Quant_Light, Quant_Heavy), the apex intensity, the fit parameters, the difference between identification and fitted scan time, the extracted traces and the isotope pattern for both channels. QuantBasedAlignment, AlignmentBasedQuantification, AlignmentBasedQuantStatistics and JoinQuantPepIonsWithProteins read .quant files.

With -dc the tool writes one chart per peptide ion into run_plots, plus mzErrorAndCorrection.html and precMzCorrected.html for the m/z calibration it derives from the identifications. -z packs that directory into run_plots.zip and deletes it. Delete an existing run.quant in the output directory before a rerun, the tool appends to it. Logs go to PSMBasedQuantification_log.txt and run_log.txt in the output directory.

Parameters

Parameter

Default

Meaning

PerformLabeledQuantification

Labeling.N15Labeling

Unlabeled quantifies only the identified ion. N15Labeling quantifies the partner ion too and keeps rows where both fits pass the quality filter. N15LabelingOnly applies the filter to the heavy channel alone. Labelshift quantifies both and skips the filter.

FragPipe

false

Marks qpsm input in the FragPipe layout, which PSMBasedQuantificationTIMs reads. Keep it at false for this tool.

XicExtraction.ScanTimeWindow

2.0

Half width of the scan time window around the identification that is extracted and searched for the peak, in the scan time unit of the run.

XicExtraction.MzWindow_Da

Window.Estimate

Half width of the m/z window of the trace, in Da. Estimate uses four times the MS1 mass error the tool measures on the precursor m/z of the identifications. Window.Fixed 0.07 sets it to 0.07 Da.

XicExtraction.XicProcessing

XicProcessing.Wavelet waveletParams

Peak detection on the trace. The wavelet parameters are listed below. SecondDerivative is the other supported case. Gabor3D belongs to the TIMs tool and makes this tool fail.

XicExtraction.TopKPSMs

None

Some k keeps only the k identifications with the highest SequestScore per peptide ion when placing the scan time.

BaseLineCorrection

Some { MaxIterations = 10; Lambda = 6; P = 0.05 }

Asymmetric least squares baseline subtraction on the trace before peak detection. None skips it.

The wavelet parameters:

Parameter

Default

Meaning

Borderpadding

None

Number of points padded at both ends of the trace. None derives it from the data.

BorderPadMethod

Padding.BorderPaddingMethod.Random

How the border points are filled (Random or Zero).

InternalPaddingMethod

Padding.InternalPaddingMethod.LinearInterpolation

How small gaps inside the trace are filled.

HugeGapPaddingMethod

Padding.HugeGapPaddingMethod.Zero

How gaps longer than HugeGapPaddingDistance are filled.

HugeGapPaddingDistance

100.

Gap length from which a gap counts as huge.

MinPeakDistance

None

Peaks closer than this are merged. None uses the point spacing of the trace.

MinPeakLength

Some 0.1

Smallest peak width the wavelet scales start at.

MaxPeakLength

1.5

Largest peak width the wavelet scales go up to.

NoiseQuantile

0.01

Quantile of the wavelet correlation used as noise level.

MinSNR

0.01

A peak needs a correlation above MinSNR times the noise level.

The default file is QuantificationParams.json. To run without baseline correction set BaseLineCorrection = None in the script below.

Writing a parameter file

open ProteomIQon
open ProteomIQon.Domain
open FSharp.Stats.Signal

let waveletParams : WaveletParameters =
    {
        Borderpadding          = None
        BorderPadMethod        = Padding.BorderPaddingMethod.Random
        InternalPaddingMethod  = Padding.InternalPaddingMethod.LinearInterpolation
        HugeGapPaddingMethod   = Padding.HugeGapPaddingMethod.Zero
        HugeGapPaddingDistance = 100.
        MinPeakDistance        = None
        MinPeakLength          = Some 0.1
        MaxPeakLength          = 1.5
        NoiseQuantile          = 0.01
        MinSNR                 = 0.01
    }

let quantificationParams : Dto.QuantificationParams =
    {
        PerformLabeledQuantification = Labeling.N15Labeling
        FragPipe                     = false
        XicExtraction =
            {
                ScanTimeWindow = 2.
                MzWindow_Da    = Window.Estimate
                XicProcessing  = XicProcessing.Wavelet waveletParams
                TopKPSMs       = None
            }
        BaseLineCorrection = Some { MaxIterations = 10; Lambda = 6; P = 0.05 }
    }

// Replace the temp folder with your project folder.
let outputPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "QuantificationParams.json")

Json.serializeAndWrite outputPath quantificationParams

Outputs

The resulting .quant file is generated as a tab-delimited text file. These columns can be inspected individually to examine specific search results, scoring metrics, and identification parameters.

Column

Description

StringSequence

Amino Acid sequence (one-letter code) from PeptideDB which matches the psm candidate

GlobalMod

Indicator, if a peptide ion species is labeled or unlabeled

Charge

Precursor ion charge state

PepSequenceID

Unique identifier of the unmodified peptide sequence, which points to PeptideDB

ModSequenceID

Unique identifier of the modified peptide sequence (including PTMs, e.g., methylation), which points to PeptideDB

PrecursorMZ

Precursor ion mass-to-charge ratio (m/z)

MeasuredMass

Measured mass of precursor ions in Dalton

TheoMass

Theoretical peptide mass in the spectrum (based on amino acid composition) in Dalton

AbsDeltaMass

Absolute mass deviation between theoretical and measured mass (mass error)

MeanPercolatorScore

The peptide spectrum matches (PSMs) are re-scored based on several parameters. This value corresponds to the average consensus score determined in the process

QValue

Q-value (False-Discovery-Rate) based on combined model scores

PEPValue

Posterior Error Probability

ProteinNames

Protein Names out of the PeptideDB

QuantMZ_Light

Mass-to-charge ratio from the extracted XIC of the unlabeled peptide ion

Quant_Light

Peak area from the extracted XIC of the unlabeled peptide ion

MeasuredApex_Light

Measured Apex of unlabeled peak

Seo_Light

Standard Error of Prediction for quantification

Params_Light

Describes the shape of the fitted peak for the unlabeled version of a peptide. Contains information about peak height, estimated peak time, and peak width.

Diffrence_SearchRT_FittedRT_Light

Difference between the retention time originally determined using PSMs and the retention time calculated from the measured peak

KLDiv_Observed_Theoretical_Light

Describes how well the measured unlabeled isotope pattern matches the theoretically expected pattern.

KLDiv_CorrectObserved_Theoretical_Light

Corrected Kullback-Leiber divergence of isotopic pattern of unlabeled peptide ion versus the measured pattern

QuantMZ_Heavy

Mass-to-charge ratio from the extracted XIC of the labeled peptide ion

Quant_Heavy

Peak area from the extracted XIC of the labeled peptide ion

MeasuredApex_Heavy

Measured Apex of labeled peak

Seo_Heavy

Standard Error of Prediction of quantification

Params_Heavy

Describes the shape of the fitted peak for the labeled version of a peptide. Contains information about peak height, estimated peak time, and peak width.

Diffrence_SearchRT_FittedRT_Heavy

Difference between the retention time originally determined using PSMs and the retention time calculated from the measured peak

KLDiv_Observed_Theoretical_Heavy

Describes how well the measured labeled isotope pattern matches the theoretically expected pattern.

KLDiv_CorrectObserved_Theoretical_Heavy

Corrected Kullback-Leiber divergence of isotopic pattern of labeled peptide ion versus the measured pattern

Correlation_Light_Heavy

Correlation calculated based on Pearson between unlabeled and labeled peaks

QuantificationSource

If spectra are found over Alignments or Peptide Spectrum Matching

IsotopicPatternMz_Light

M/z-distribution of isotope cluster in spectra for unlabeled peaks

IsotopicPatternIntensity_Observed_Light

Observed intensity distribution of unlabeled isotopic clusters

IsotopicPatternIntensity_Corrected_Light

Corrected intensity distribution of unlabeled isotopic clusters

RtTrace_Light

Retention Time Profile of unlabeled peptide ion

IntensityTrace_Observed_Light

Intensity trace over for an observed unlabeled isotopic peak cluster

IntensityTrace_Corrected_Light

Corrected intensity trace between an unlabeled peak and a measured isotopic peak cluster

IsotopicPatternMZ_Heavy

M/z-distribution of isotope cluster in spectra for labeled peaks

IsotopicPatternIntensity_Observed_Heavy

Observed intensity distribution of labeled isotopic clusters

IsotopicPatternIntensity_Corrected_Heavy

Corrected intensity distribution of labeled isotopic clusters

RtTrace_Heavy

Retention Time Profile of labeled peptide ion

IntensityTrace_Observed_Heavy

Intensity trace for an observed labeled isotopic peak cluster

IntensityTrace_Corrected_Heavy

Corrected intensity trace between a labeled peak and a measured isotopic peak cluster

AlignmentScore

Actual known alignments compared with the observed alignments

AlignmentQValue

Q-value, which is calculated based on the alignment score

Running the tool

Install with dotnet tool install --global ProteomIQon.PSMBasedQuantification, then quantify one run:

proteomiqon-psmbasedquantification -i path/to/run.mzlite -ii path/to/run.qpsm -d path/to/database.db -o path/to/output -p path/to/QuantificationParams.json

Several runs, paired by position in the two lists, three in parallel:

proteomiqon-psmbasedquantification -i path/to/run1.mzlite path/to/run2.mzlite path/to/run3.mzlite -ii path/to/run1.qpsm path/to/run2.qpsm path/to/run3.qpsm -d path/to/database.db -o path/to/output -p path/to/QuantificationParams.json -c 3

Two directories, paired by file name:

proteomiqon-psmbasedquantification -i path/to/mzliteFolder -ii path/to/qpsmFolder -d path/to/database.db -o path/to/output -p path/to/QuantificationParams.json -c 3 -mf

All flags:

proteomiqon-psmbasedquantification --help
namespace ProteomIQon
module Domain from ProteomIQon
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
namespace FSharp.Stats
namespace FSharp.Stats.Signal
val waveletParams: WaveletParameters
type WaveletParameters = FSharpStats'.Wavelet.Parameters
union case Option.None: Option<'T>
module Padding from FSharp.Stats.Signal
<summary> padds data points to the beginning, the end and on internal intervals of the data </summary>
type BorderPaddingMethod = | Random | Zero
<summary> padds data point at signals start and end </summary>
union case Padding.BorderPaddingMethod.Random: Padding.BorderPaddingMethod
<summary> inserts random data points taken from the original data set </summary>
type InternalPaddingMethod = | Random | NaN | Delete | Zero | LinearInterpolation
<summary> padds data point in small gaps (e.g. a missing data point or small ranges with no data) </summary>
union case Padding.InternalPaddingMethod.LinearInterpolation: Padding.InternalPaddingMethod
<summary> inserts points lying on the linear interpolation of the two adjacent knots </summary>
type HugeGapPaddingMethod = | Random | NaN | Delete | Zero | LinearInterpolation
<summary> padds data point in huge gaps (e.g. big ranges with no data) </summary>
union case Padding.HugeGapPaddingMethod.Zero: Padding.HugeGapPaddingMethod
<summary> inserts 0.0 as y_Value </summary>
union case Option.Some: Value: 'T -> Option<'T>
val quantificationParams: Dto.QuantificationParams
module Dto from ProteomIQon
Multiple items
module QuantificationParams from ProteomIQon.Dto

--------------------
type QuantificationParams = { PerformLabeledQuantification: Labeling FragPipe: bool XicExtraction: XicExtraction BaseLineCorrection: BaseLineCorrection option } member Equals: QuantificationParams * IEqualityComparer -> bool
type Labeling = | Labelshift | Unlabeled | N15Labeling | N15LabelingOnly member Equals: Labeling * IEqualityComparer -> bool member IsLabelshift: bool member IsN15Labeling: bool member IsN15LabelingOnly: bool member IsUnlabeled: bool
union case Labeling.N15Labeling: Labeling
type XicExtraction = { ScanTimeWindow: float MzWindow_Da: Window XicProcessing: XicProcessing TopKPSMs: int option } member Equals: XicExtraction * IEqualityComparer -> bool
type Window = | Fixed of float | Estimate member Equals: Window * IEqualityComparer -> bool member IsEstimate: bool member IsFixed: bool
union case Window.Estimate: Window
type XicProcessing = | SecondDerivative of SecondDerivativeParams | Wavelet of WaveletParameters | Gabor3D of Gabor3DParams member Equals: XicProcessing * IEqualityComparer -> bool member IsGabor3D: bool member IsSecondDerivative: bool member IsWavelet: bool
union case XicProcessing.Wavelet: WaveletParameters -> XicProcessing
type BaseLineCorrection = { MaxIterations: int Lambda: int P: float } member Equals: BaseLineCorrection * IEqualityComparer -> bool
BaseLineCorrection.P: float
val outputPath: string
namespace System
namespace System.IO
type Path = static member ChangeExtension: path: string * extension: string -> string static member Combine: path1: string * path2: string -> string + 4 overloads static member EndsInDirectorySeparator: path: ReadOnlySpan<char> -> bool + 1 overload static member Exists: path: string -> bool static member GetDirectoryName: path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload static member GetExtension: path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload static member GetFileName: path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload static member GetFileNameWithoutExtension: path: ReadOnlySpan<char> -> ReadOnlySpan<char> + 1 overload static member GetFullPath: path: string -> string + 1 overload static member GetInvalidFileNameChars: unit -> char array ...
<summary>Performs operations on <see cref="T:System.String" /> instances that contain file or directory path information. These operations are performed in a cross-platform manner.</summary>
System.IO.Path.Combine(paths: System.ReadOnlySpan<string>) : string
System.IO.Path.Combine([<System.ParamArray>] paths: string array) : string
System.IO.Path.Combine(path1: string, path2: string) : string
System.IO.Path.Combine(path1: string, path2: string, path3: string) : string
System.IO.Path.Combine(path1: string, path2: string, path3: string, path4: string) : string
System.IO.Path.GetTempPath() : string
module Json from ProteomIQon
val serializeAndWrite: path: string -> obj: 'a -> unit