BinderScriptNotebook

PSMStatistics

PeptideSpectrumMatching reports several scores for every spectrum (SEQUEST-like, Andromeda-like, X!Tandem-like, plus mass error, peptide length and how far the best candidate is ahead of the next one). PSMStatistics learns one combined score from these columns. It uses the target and decoy labels of the matches as training signal, retrains in iterations while the set of confident targets grows (semi supervised), and stops when an iteration adds too few new positives or the iteration limit is reached. From the combined score it computes a q-value and a PEP value per match and keeps the PSMs under both thresholds.

Inputs and outputs

Flag

Meaning

Comes from

-i

one or more .psm files, or a directory that is searched for *.psm (not recursive)

PeptideSpectrumMatching

-d

the SQLite peptide database

PeptideDB

-o

the output directory, created when missing

-p

the parameter file in JSON

this page

-dc

switch: save diagnostic charts to the output directory

-c

number of files scored at the same time, default 1

For every input run.psm the tool writes run.qpsm to the output directory. The file is tab separated with a header and holds one row per scan: the identifiers of the peptide and its modification state, the search scores, the combined ModelScore, QValue, PEPValue, the sequence and the protein names. ProteinInference and PSMBasedQuantification read .qpsm files.

The tool also creates a run_plots directory per input. It stays empty unless you pass -dc, which adds Metrics.html and InitialSeparation.html, plus one separationAtIteration_<n>.html per training iteration. Charts exist only for the estimated threshold. Log output goes to PSMStatistics_log.txt and run_log.txt in the output directory.

Parameters

Parameter

Default

Meaning

Threshold

Threshold.Estimate estimationParams

Learn the combined score and filter by q-value and PEP value. The nested record is listed below.

Threshold (alternative)

Threshold.Fixed { SequestLike = 0.; Andromeda = 0. }

Skip the learning. Keep the best match per scan among those whose SequestScore exceeds SequestLike and whose AndroScore exceeds Andromeda, and drop it when it is a decoy. ModelScore, QValue and PEPValue are written as nan. Pick your own cutoffs, the values here are placeholders.

ParseProteinIDRegexPattern

"id"

Regex applied to the FASTA headers of the database to produce the ProteinNames column. Use the same pattern as in PeptideDB.

KeepTemporaryFiles

true

Part of the parameter record. Keep it at true.

The fields of Threshold.Estimate:

Parameter

Default

Meaning

QValueThreshold

0.01

Keep PSMs with a q-value below this value.

PepValueThreshold

0.05

Keep PSMs with a PEP value below this value.

MaxIterations

15

Upper limit for the retraining iterations.

MinimumIncreaseBetweenIterations

0.005

Stop when the number of positives at the q-value threshold grows by less than this fraction from one iteration to the next.

PepValueFittingMethod

PepValueFittingMethod.IRLS

How the PEP curve is fitted. IRLS (iteratively reweighted least squares) is the only case.

The default file is pSMStatisticsParams.json.

Writing a parameter file

open ProteomIQon
open ProteomIQon.Domain

let psmStatisticsParams : Dto.PSMStatisticsParams =
    {
        Threshold =
            Threshold.Estimate
                {
                    QValueThreshold                  = 0.01
                    PepValueThreshold                = 0.05
                    MaxIterations                    = 15
                    MinimumIncreaseBetweenIterations = 0.005
                    PepValueFittingMethod            = PepValueFittingMethod.IRLS
                }
        ParseProteinIDRegexPattern = "id"
        KeepTemporaryFiles         = true
    }

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

Json.serializeAndWrite outputPath psmStatisticsParams

Running the tool

Install with dotnet tool install --global ProteomIQon.PSMStatistics, then score one run:

proteomiqon-psmstatistics -i path/to/run.psm -d path/to/database.db -o path/to/output -p path/to/pSMStatisticsParams.json

Several runs at once, three of them in parallel:

proteomiqon-psmstatistics -i path/to/run1.psm path/to/run2.psm path/to/run3.psm -d path/to/database.db -o path/to/output -p path/to/pSMStatisticsParams.json -c 3

Add -dc to write the separation charts for each iteration:

proteomiqon-psmstatistics -i path/to/psmFolder -d path/to/database.db -o path/to/output -p path/to/pSMStatisticsParams.json -c 3 -dc

All flags:

proteomiqon-psmstatistics --help
namespace ProteomIQon
module Domain from ProteomIQon
val psmStatisticsParams: Dto.PSMStatisticsParams
module Dto from ProteomIQon
Multiple items
module PSMStatisticsParams from ProteomIQon.Dto

--------------------
type PSMStatisticsParams = { Threshold: Threshold ParseProteinIDRegexPattern: string KeepTemporaryFiles: bool } member Equals: PSMStatisticsParams * IEqualityComparer -> bool
type Threshold = | Estimate of EstimationParams | Fixed of ScoreCutoff member Equals: Threshold * IEqualityComparer -> bool member IsEstimate: bool member IsFixed: bool
union case Threshold.Estimate: EstimationParams -> Threshold
type PepValueFittingMethod = | IRLS member Equals: PepValueFittingMethod * IEqualityComparer -> bool
union case PepValueFittingMethod.IRLS: PepValueFittingMethod
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