Compute the Identity by State Matrix for a bigSNP object
snp_ibs.Rd
This function computes the IBS matrix.
Usage
snp_ibs(
X,
ind.row = bigstatsr::rows_along(X),
ind.col = bigstatsr::cols_along(X),
type = c("proportion", "adjusted_counts", "raw_counts"),
block.size = bigstatsr::block_size(nrow(X))
)
Arguments
- X
a bigstatsr::FBM.code256 matrix (as found in the
genotypes
slot of a bigsnpr::bigSNP object).- ind.row
An optional vector of the row indices that are used. If not specified, all rows are used. Don't use negative indices.
- ind.col
An optional vector of the column indices that are used. If not specified, all columns are used. Don't use negative indices.
- type
one of "proportion" (equivalent to "ibs" in PLINK), "adjusted_counts" ("distance" in PLINK), and "raw_counts" (the counts of identical alleles and non-missing alleles, from which the two other quantities are computed)
- block.size
maximum number of columns read at once. Note that, to optimise the speed of matrix operations, we have to store in memory 3 times the columns.
Value
if as.counts = TRUE function returns a list of two bigstatsr::FBM matrices, one of counts of IBS by alleles (i.e. 2*n loci), and one of valid alleles (i.e. 2 * n_loci - 2 * missing_loci). If as.counts = FALSE returns a single matrix of IBS proportions.