Allele frequencies of a bed object.

bed_MAF(
  obj.bed,
  ind.row = rows_along(obj.bed),
  ind.col = cols_along(obj.bed),
  ncores = 1
)

Arguments

obj.bed

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

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.

ncores

Number of cores used. Default doesn't use parallelism. You may use bigstatsr::nb_cores().

Value

A data.frame with

  • $ac: allele counts,

  • $mac: minor allele counts,

  • $af: allele frequencies,

  • $maf: minor allele frequencies,

  • $N: numbers of non-missing values.

Examples

bedfile <- system.file("extdata", "example-missing.bed", package = "bigsnpr")
obj.bed <- bed(bedfile)

bed_MAF(obj.bed, ind.col = 1:5)
#>   ac mac         af        maf   N
#> 1  8   8 0.02094241 0.02094241 191
#> 2 16  16 0.04145078 0.04145078 193
#> 3 23  23 0.05989583 0.05989583 192
#> 4 34  34 0.08717949 0.08717949 195
#> 5 43  43 0.10969388 0.10969388 196