alleleFrequency {SeqVarTools} | R Documentation |
Calculate allele frequency for each variant
## S4 method for signature 'SeqVarGDSClass' alleleFrequency(gdsobj, n=0, use.names=FALSE) ## S4 method for signature 'SeqVarData' alleleFrequency(gdsobj, n=0, use.names=FALSE, sex.adjust=TRUE, genome.build=c("hg19", "hg38"))
gdsobj |
A |
n |
An integer indicating which allele to calculate the frequency
of. |
use.names |
A logical indicating whether to assign variant IDs as names of the output vector. |
sex.adjust |
Logical for whether to adjust frequency calculations based on sex. If |
genome.build |
A character sting indicating genome build. |
Frequency can be calculated over any allele, specified by the argument
n
. Default is the reference allele frequency (n=0
).
The SeqVarData
method will calculate frequency correctly for X and Y chromosomes, provided a column "sex" is included in the sampleData slot with values "M"/"F" or 1/2. Arguments given to this method are passed to the parent method for SeqVarGDSClass
.
A numeric vector of allele frequencies.
Stephanie Gogarten
chromWithPAR
,
SeqVarGDSClass
,
applyMethod
,
heterozygosity
gds <- seqOpen(seqExampleFileName("gds")) head(alleleFrequency(gds)) head(alleleFrequency(gds, n=1)) head(alleleFrequency(gds, n=2)) seqClose(gds)