Correlation between variants, from either a dosage matrix already in memory or a genotype panel read on demand.
Three backends compute the same sample correlation different ways.
"internal" is a single BLAS crossprod (Rfast::cora, or
cor() without it) and is both the fastest and the default;
"snprelate" and "snpstats" exist to cross-check it and do
strictly more work, since each converts the same matrix into its own
representation first.
Arguments
- X
A numeric dosage matrix (samples x variants), or a genotype panel – a
RangedSummarizedExperimentwhose dosage assay reads through a genotype handle.- method
Estimator:
"sample"(default),"population"or"gcta". The last two are"internal"-only.- backend
"internal"(default),"snprelate"or"snpstats".- trimSamples
Logical; drop samples to a multiple of four, matching DENTIST's block handling. Ignored for
method = "sample".- shrinkage
Numeric in (0, 1]; shrink towards the identity (lassosum, Mak et al. 2017). Zero (default) applies none.
- onDisk
Logical, default
FALSE. Read the correlation straight off a GDS panel without materialising dosages. The dosage matrix scales with samples x variants while the result scales with variants^2, so on a wide panel the input dwarfs the output and keeping it on disk is what makes a large block feasible at all.Not a drop-in substitute: SNPRelate applies its own missing-data policy where the in-memory backends mean-impute first. On complete data the two agree to ~2e-15, but with missing calls they diverge and the gap widens with the missing rate. Requires
backend = "snprelate",method = "sample"and a GDS-backed panel.- snpIdx
Optional variant selection when
Xis a panel; row indices into it.NULL(default) uses every variant. Not meaningful for a dosage matrix, which is already the block.