snp_ibs | R Documentation |
This function computes the IBS matrix.
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))
)
X |
a bigstatsr::FBM.code256 matrix (as found in the |
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. |
Note that monomorphic sites are currently counted. Should we filter them beforehand? What does plink do?
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.
example_gt <- load_example_gt("gen_tbl")
X <- attr(example_gt$genotypes, "bigsnp")
snp_ibs(X$genotypes)
# Compute for individuals 1 to 5
snp_ibs(X$genotypes, ind.row = 1:5, ind.col = 1:5)
# Adjust block.size
snp_ibs(X$genotypes, block.size = 2)
# Change type
snp_ibs(X$genotypes, type = "proportion")
snp_ibs(X$genotypes, type = "adjusted_counts")
snp_ibs(X$genotypes, type = "raw_counts")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.