Learn R Programming

SeqArray (version 1.12.5)

seqAlleleFreq: Get Allele Frequencies or Counts

Description

Calculates the allele frequencies or counts.

Usage

seqAlleleFreq(gdsfile, ref.allele=0L, .progress=FALSE, parallel=getOption("seqarray.parallel", FALSE)) seqAlleleCount(gdsfile, .progress=FALSE, parallel=getOption("seqarray.parallel", FALSE))

Arguments

gdsfile
ref.allele
NULL, a single numeric value, a numeric vector or a character vector; see Value
.progress
if TRUE, show progress information
parallel
FALSE (serial processing), TRUE (parallel processing) or other value; parallel is passed to the argument cl in seqParallel, see seqParallel for more details.

Value

If ref.allele=NULL, the function returns a list of allele frequencies according to all allele per site. If ref.allele is a single numeric value (like 0L), it returns a numeric vector for the specified alleles (0L for the reference allele, 1L for the first alternative allele, etc). If ref.allele is a numeric vector, ref.allele specifies each allele per site. If ref.allele is a character vector, ref.allele specifies the desired allele for each site (e.g, ancestral allele for the derived allele frequency).

See Also

seqNumAllele, seqMissing, seqParallel

Examples

Run this code
# the GDS file
(gds.fn <- seqExampleFileName("gds"))

# display
f <- seqOpen(gds.fn)

# return a list
head(seqAlleleFreq(f, NULL, .progress=TRUE))

# return a numeric vector
summary(seqAlleleFreq(f, 0L, .progress=TRUE))

# return a numeric vector, AA is ancestral allele
AA <- toupper(seqGetData(f, "annotation/info/AA")$data)
summary(seqAlleleFreq(f, AA))

# allele counts
head(seqAlleleCount(f, .progress=TRUE))

# close the GDS file
seqClose(f)

Run the code above in your browser using DataLab