Preprocessing (GPU)¶
The CPU twin is bixverse.pp.
pp
¶
GPU sparse PCA.
Writes what bixverse.pp.calculate_pca writes: scores, loadings and the first
no_pcs singular values to sc.cache, stamped "pca".
calculate_pca
¶
calculate_pca(
sc: SingleCells,
no_pcs: int,
*,
pca_params: PcaParams | None = None,
hvg: ndarray
| Sequence[int]
| Sequence[str]
| None = None,
seed: int = 42,
verbose: Verbose = True,
backend: Backend = "wgpu",
) -> None
Sparse PCA over the kept cells and the HVGs on the GPU.
Always sparse, so the data are never scaled into a dense matrix.
svd_solver = "randomised" runs the randomised SVD, every other solver
the exact block Lanczos; there is no GPU covariance path. No residual
path either: use bixverse.pp.calculate_pca(..., residuals=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sc
|
SingleCells
|
The experiment. |
required |
no_pcs
|
int
|
Number of components. |
required |
pca_params
|
PcaParams | None
|
The PCA parameters. |
None
|
hvg
|
ndarray | Sequence[int] | Sequence[str] | None
|
0-based gene indices or gene ids to use instead of |
None
|
seed
|
int
|
Seed for the sketch or the Lanczos starting block. |
42
|
verbose
|
Verbose
|
|
True
|
backend
|
Backend
|
|
'wgpu'
|
Raises:
| Type | Description |
|---|---|
BixverseError
|
Without a GPU adapter, or with |