LD scores

snp_ld_scores(
  Gna,
  ind.row = rows_along(Gna),
  ind.col = cols_along(Gna),
  size = 500,
  infos.pos = NULL,
  ncores = 1
)

bed_ld_scores(
  obj.bed,
  ind.row = rows_along(obj.bed),
  ind.col = cols_along(obj.bed),
  size = 500,
  infos.pos = NULL,
  ncores = 1
)

Arguments

Gna

A FBM.code256 (typically <bigSNP>$genotypes).
You can have missing values in these data.

ind.row

An optional vector of the row indices (individuals) that are used. If not specified, all rows are used.
Don't use negative indices.

ind.col

An optional vector of the column indices (SNPs) that are used. If not specified, all columns are used.
Don't use negative indices.

size

For one SNP, window size around this SNP to compute correlations. Default is 500. If not providing infos.pos (NULL, the default), this is a window in number of SNPs, otherwise it is a window in kb (genetic distance).

infos.pos

Vector of integers specifying the physical position on a chromosome (in base pairs) of each SNP.
Typically <bigSNP>$map$physical.pos.

ncores

Number of cores used. Default doesn't use parallelism. You may use nb_cores.

obj.bed

Object of type bed, which is the mapping of some bed file. Use obj.bed <- bed(bedfile) to get this object.

Value

A vector of LD scores. For each variant, this is the sum of squared correlations with the neighboring variants (including itself).

Examples

test <- snp_attachExtdata() G <- test$genotypes (ld <- snp_ld_scores(G, ind.col = 1:1000))
#> [1] 2.483941 2.172068 3.263946 2.183188 2.429795 2.398690 2.014529 2.356609 #> [9] 2.366944 2.372684 2.027740 3.122179 2.133183 2.172548 2.519639 2.021563 #> [17] 2.314697 2.037480 2.782503 1.924502 2.041895 2.750078 2.725187 2.169489 #> [25] 2.172800 2.056492 2.310708 1.954138 2.218048 1.992463 2.052143 2.817170 #> [33] 2.348052 2.522452 1.988571 2.460693 2.348271 2.171589 2.309941 2.141150 #> [41] 2.898284 2.228980 1.957499 2.321395 2.283141 3.252310 2.071685 2.436255 #> [49] 2.422020 3.116608 #> [ reached getOption("max.print") -- omitted 950 entries ]