snp_cor | R Documentation |
Get significant (Pearson) correlations between nearby SNPs of the same chromosome (p-values are computed using a two-sided t-test).
snp_cor(
Gna,
ind.row = rows_along(Gna),
ind.col = cols_along(Gna),
size = 500,
alpha = 1,
thr_r2 = 0,
fill.diag = TRUE,
infos.pos = NULL,
ncores = 1
)
bed_cor(
obj.bed,
ind.row = rows_along(obj.bed),
ind.col = cols_along(obj.bed),
size = 500,
alpha = 1,
thr_r2 = 0,
fill.diag = TRUE,
infos.pos = NULL,
ncores = 1
)
Gna |
A FBM.code256
(typically |
ind.row |
An optional vector of the row indices (individuals) that
are used. If not specified, all rows are used. |
ind.col |
An optional vector of the column indices (SNPs) that are used.
If not specified, all columns are used. |
size |
For one SNP, window size around this SNP to compute correlations.
Default is |
alpha |
Type-I error for testing correlations.
Default is |
thr_r2 |
Threshold to apply on squared correlations. Default is |
fill.diag |
Whether to fill the diagonal with 1s (the default) or to keep it as 0s. |
infos.pos |
Vector of integers specifying the physical position
on a chromosome (in base pairs) of each SNP. |
ncores |
Number of cores used. Default doesn't use parallelism.
You may use |
obj.bed |
Object of type bed, which is the mapping of some bed file.
Use |
The (Pearson) correlation matrix. This is a sparse symmetric matrix.
test <- snp_attachExtdata()
G <- test$genotypes
corr <- snp_cor(G, ind.col = 1:1000)
corr[1:10, 1:10]
# Sparsity
length(corr@x) / length(corr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.