Description Usage Arguments Details Value Author(s) See Also Examples
Calculates the allele frequencies or counts for reference or minor alleles.
1 2 3 4 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # 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)
|
Loading required package: gdsfmt
[1] "/usr/lib/R/site-library/SeqArray/extdata/CEU_Exon.gds"
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
[[1]]
[1] 0.96491228 0.03508772
[[2]]
[1] 0.990566038 0.009433962
[[3]]
[1] 0.96103896 0.03896104
[[4]]
[1] 0.1232877 0.8767123
[[5]]
[1] 0.92696629 0.07303371
[[6]]
[1] 0.994382022 0.005617978
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.0000 0.8114 0.9719 0.8488 0.9942 1.0000
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.000000 0.005731 0.027778 0.099848 0.155623 0.500000
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.00556 0.80907 0.97222 0.84647 0.99427 1.00000 32
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.00000 0.00568 0.02778 0.09892 0.15212 0.50000 32
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
[[1]]
[1] 110 4
[[2]]
[1] 105 1
[[3]]
[1] 148 6
[[4]]
[1] 18 128
[[5]]
[1] 165 13
[[6]]
[1] 177 1
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
[1] 110 105 148 18 165 177
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
[1] 4 1 6 18 13 1
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
[1] 110 105 6 128 165 177
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed, 0s
[1] 4 1 6 18 13 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.