| seqAlleleFreq {SeqArray} | R Documentation |
Calculates the allele frequencies or counts for reference or minor alleles.
seqAlleleFreq(gdsfile, ref.allele=0L, minor=FALSE, .progress=FALSE,
parallel=seqGetParallel(), verbose=FALSE)
seqAlleleCount(gdsfile, ref.allele=0L, minor=FALSE, .progress=FALSE,
parallel=seqGetParallel(), verbose=FALSE)
gdsfile |
a |
ref.allele |
|
minor |
if |
.progress |
[deprecated] if TRUE, show progress information |
parallel |
|
verbose |
if |
If the gds node 'genotype/data' (integer genotypes) is not available, the node 'annotation/format/DS' (numeric genotype dosages for alternative alleles) will be used to calculate allele frequencies. At a site, it assumes 'annotation/format/DS' stores the dosage of the 1st alternative allele in the 1st column, 2nd alt. allele in the 2nd column if it is multi-allelic, and so on.
If ref.allele=NULL, the function returns a list of allele
frequencies/counts according to all allele per site. If ref.allele is a
single numeric value (like 0L), it returns a numeric/integer vector for
the specified allele (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/count).
Xiuwen Zheng
seqNumAllele, seqMissing,
seqParallel, seqGetParallel
# the GDS file
(gds.fn <- seqExampleFileName("gds"))
# display
f <- seqOpen(gds.fn)
# return a list
head(seqAlleleFreq(f, NULL, verbose=TRUE))
# return a numeric vector
summary(seqAlleleFreq(f, 0L, verbose=TRUE))
# return a numeric vector
summary(seqAlleleFreq(f, 0L, minor=TRUE, verbose=TRUE))
# return a numeric vector, AA is ancestral allele
AA <- seqGetData(f, "annotation/info/AA", .padNA=TRUE)
summary(seqAlleleFreq(f, AA))
summary(seqAlleleFreq(f, AA, minor=TRUE))
# allele counts
head(seqAlleleCount(f, NULL, verbose=TRUE))
head(seqAlleleCount(f, 0L, verbose=TRUE))
head(seqAlleleCount(f, 0L, minor=TRUE, verbose=TRUE))
head(seqAlleleCount(f, AA, verbose=TRUE))
head(seqAlleleCount(f, AA, minor=TRUE, verbose=TRUE))
# close the GDS file
seqClose(f)