BinderScriptNotebook

AlignmentBasedQuantification

QuantBasedAlignment predicts where a peptide ion identified in another run should elute in this run. AlignmentBasedQuantification goes to that place. For every peptide ion in the .align file it extracts an ion chromatogram from the .mzlite file around the predicted scan time, and, with PerformLocalWarp set, moves the scan time estimate by dynamic time warping of the extracted chromatogram against the chromatogram the ion had in the source run. Baseline correction, peak detection, peak fitting and the labeled counterpart work as in PSMBasedQuantification. The result is a .quant file that holds the quantifications of this run's own identifications together with the transferred ones.

Inputs and outputs

Flag

Meaning

Comes from

-i

.mzlite of the run

MzMLToMzLite

-ii

.align of the run

QuantBasedAlignment

-iii

.alignmetric of the run

QuantBasedAlignment

-iv

.quant of the same run

PSMBasedQuantification

-d

peptide database (SQLite)

PeptideDB

-o

output directory, created when missing

-p

parameter file (JSON)

this page

-mf

switch: pair the four file lists by base name instead of by position

-dc

switch: write chromatogram and m/z correction charts

-c

number of runs processed in parallel, default 1, in the directory case

Each of the four input flags takes exactly one path. When -i is an existing file, the tool processes that single run and expects single files for -ii through -iv as well. When -i and -ii are directories, the tool searches -i for *.mzlite, -ii for *.align, -iii for *.alignmetric and -iv for *.quant and processes every run it can pair. Without -mf the four file lists are paired by position. With -mf they are paired by file name without extension, and a run that lacks one of the four files is skipped with a note in the log.

The tool writes <run>.quant into the output directory, a tab separated table with the rows of the input .quant file followed by one row per transferred peptide ion. The column QuantificationSource tells them apart (PSM or Alignment). AlignmentScore and AlignmentQValue hold NaN until AlignmentBasedQuantStatistics fills them. The file is also read by AddDeducedPeptides and JoinQuantPepIonsWithProteins. Next to it the tool writes <run>.alignquantMetrics, a table of the alignment metrics in quantification format. With -dc the chromatograms and the m/z correction go as HTML charts into <run>_plots. Delete an existing <run>.quant or <run>.alignquantMetrics in the output directory before a rerun, the tool appends to them. Logs go to AlignmentBasedQuantification_log.txt and one <run>_log.txt per run.

Parameters

Parameter

Default

Meaning

PerformLabeledQuantification

true

Also extract and quantify the differentially labeled counterpart of every transferred ion.

PerformLocalWarp

true

Refine the predicted scan time by dynamic time warping against the source chromatogram before peak detection.

XicExtraction

see below

How the ion chromatogram is extracted and processed.

BaseLineCorrection

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

Asymmetric least squares baseline correction of the chromatogram. None switches it off.

XicExtraction is the same record PSMBasedQuantification uses.

Field

Default

Meaning

ScanTimeWindow

2.0

Half width in minutes of the scan time range extracted around the predicted scan time.

MzWindow_Da

Window.Estimate

Keep Window.Estimate. The tool estimates the m/z tolerance from the run itself.

XicProcessing

XicProcessing.Wavelet waveletParams

Peak detection method. The wavelet fields are described on the PSMBasedQuantification page.

TopKPSMs

None

Keep None. Transferred ions have no identifications to rank.

The default file is AlignmentBasedQuantificationParams.json.

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 alignmentBasedQuantificationParams : Dto.AlignmentBasedQuantificationParams =
    {
        PerformLabeledQuantification = true
        PerformLocalWarp             = true
        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(), "AlignmentBasedQuantificationParams.json")

Json.serializeAndWrite outputPath alignmentBasedQuantificationParams

Running the tool

Install the tool with dotnet tool install --global ProteomIQon.AlignmentBasedQuantification. The four run specific inputs share the run name, so the same base name appears four times.

proteomiqon-alignmentbasedquantification -i path/to/run.mzlite -ii path/to/run.align -iii path/to/run.alignmetric -iv path/to/run.quant -d path/to/peptides.db -o path/to/output -p path/to/AlignmentBasedQuantificationParams.json

Process every run in a set of directories, paired by position, three at a time.

proteomiqon-alignmentbasedquantification -i path/to/mzlite -ii path/to/align -iii path/to/alignmetric -iv path/to/quant -d path/to/peptides.db -o path/to/output -p path/to/AlignmentBasedQuantificationParams.json -c 3

The same, paired by file name.

proteomiqon-alignmentbasedquantification -i path/to/mzlite -ii path/to/align -iii path/to/alignmetric -iv path/to/quant -d path/to/peptides.db -o path/to/output -p path/to/AlignmentBasedQuantificationParams.json -c 3 -mf

Print the description of every argument.

proteomiqon-alignmentbasedquantification --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 alignmentBasedQuantificationParams: Dto.AlignmentBasedQuantificationParams
module Dto from ProteomIQon
Multiple items
module AlignmentBasedQuantificationParams from ProteomIQon.Dto

--------------------
type AlignmentBasedQuantificationParams = { PerformLabeledQuantification: bool PerformLocalWarp: bool XicExtraction: XicExtraction BaseLineCorrection: BaseLineCorrection option } member Equals: AlignmentBasedQuantificationParams * IEqualityComparer -> bool
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