align¶
pg.align runs the four steps of the pipeline in one call, with the
manuscript's defaults, and returns an AlignmentResult. The classes on the
following pages run the same steps one at a time.
pgalign.pipeline.align
¶
Align an unknown dataset onto a reference with the full PGAlign pipeline.
Runs the four steps of the Methods in order, then the diagnostic for ambiguous
alignments, and returns the aligned dataset. The defaults are those of the
Methods and of the atherosclerosis analysis in the manuscript. smooth=True
calls peaks on the three-point moving average described in the Methods
("Peak calling"), with PeakCallingmv; smooth=False uses
PeakCalling, as in the simulation study and the canine sarcoma analysis.
Step 4 applies the best offset to every paired group, as every analysis in the
manuscript did (fine_alignment_assessment(ignore=True)). The inputs are not
modified; a sparse intensity matrix is accepted and densified on the copy.
Input that cannot be aligned (no var["m/z"], m/z not increasing, missing
intensities, m/z ranges that do not overlap) raises a ValueError saying
what to fix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unk
|
the unknown dataset, an |
required | |
ref
|
the reference dataset, in the same form. |
required | |
smooth
|
call peaks on the moving average ( |
True
|
|
alpha
|
the peak calling quantile (alpha in the paper). Defaults to 0.9. |
0.9
|
|
percentile
|
the peak grouping parameter. Defaults to 0.9. |
0.9
|
|
delta
|
the pairing criterion (delta in the paper). Defaults to 0. |
0
|
|
tau
|
the tolerance of the diagnostic for ambiguous alignments (tau in the paper). Defaults to 0.1. |
0.1
|
|
normalize
|
scale each spectrum to the median total intensity before
aligning (Methods, "Data normalization"), on copies of the inputs.
|
True
|
Returns:
| Type | Description |
|---|---|
|
an :class: |
Source code in pgalign/pipeline.py
pgalign.pipeline.AlignmentResult
¶
Bases: object
The output of :func:align.
Attributes:
| Name | Type | Description |
|---|---|---|
aligned |
the unknown spectra on the reference m/z grid, as an
|
|
reference |
the reference spectra on the same bins and the same scale as
|
|
shifts |
a DataFrame with one row per paired peak group: |
|
ambiguity |
the table of |
|
peaks |
the peak calling object of Steps 1 and 2. |
|
steps |
the |
|
tau |
the tolerance the ambiguity table was computed with. |
Source code in pgalign/pipeline.py
summary
¶
Return a one-line count of paired, shifted and flagged peak groups.