| gl.alf | R Documentation |
Calculates the frequency of the reference allele (alf1) and the alternate allele (alf2) at each locus, pooled across all individuals in the genlight object.
gl.alf(x, verbose = NULL)
x |
Name of the genlight object [required]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default NULL, adopting the global verbosity set by gl.set.verbosity(), or 2 if no global is set]. |
This is a lightweight accessor: it returns the per-locus frequencies directly (visibly) and does not modify the input. Apart from the datatype check (which honours the resolved verbosity, so it is silent at verbose = 0), it produces no console output. The alternate allele frequency is the mean genotype score at the locus divided by 2, computed with na.rm = TRUE, and alf1 is its complement, so the two columns sum to 1 at every locus with at least one scored genotype. A locus with no scored genotypes returns NaN in both columns.
The frequencies are unrounded, and they are computed in a single pass over
the genotype matrix without splitting the object by population, which
makes this the fast path used inside loops and by utils.recalc.maf.
gl.allele.freq with simple = TRUE returns the same
quantity rounded to 4 decimal places, and additionally offers the
per-population and population x locus aggregations that gl.alf does not.
Row names are the locus names, in locus order. Duplicate locus names are
disambiguated with make.unique() so that the row keys always
correspond positionally to the loci of the input.
The function applies to SNP genotype data only. Tag presence/absence (SilicoDArT) data has ploidy 1 and no alternate allele, so it is rejected rather than divided by the SNP ploidy.
A data.frame with one row per locus, in locus order, and two columns: alf1, the frequency of the reference allele, and alf2, the frequency of the alternate allele. Loci with all genotypes missing return NaN in both columns.
Author(s): Bernd Gruber. Custodian: Bernd Gruber – Post to https://groups.google.com/d/forum/dartr
gl.allele.freq, gl.He,
gl.Ho
Other utilities:
gl.He(),
gl.Ho(),
utils.allelic.richness(),
utils.basic.stats(),
utils.check.datatype(),
utils.collapse.matrix(),
utils.dart2genlight(),
utils.dist.binary(),
utils.fbm.amat(),
utils.fbm.blocks(),
utils.fbm.colblocks(),
utils.fbm.colwise(),
utils.fbm.copy(),
utils.fbm.count.mean(),
utils.fbm.decode(),
utils.fbm.grm(),
utils.fbm.has(),
utils.fbm.new(),
utils.fbm.pair.counts(),
utils.fbm.reader(),
utils.fbm.rowwise(),
utils.fbm.tempfile(),
utils.flag.start(),
utils.het.pop(),
utils.history.call(),
utils.is.fixed(),
utils.jackknife(),
utils.n.var.invariant(),
utils.plot.save(),
utils.read.fasta(),
utils.read.ped(),
utils.recalc.avgpic(),
utils.recalc.callrate(),
utils.recalc.freqhets(),
utils.recalc.freqhomref(),
utils.recalc.freqhomsnp(),
utils.recalc.maf(),
utils.reset.flags(),
utils.transpose(),
utils.vcf.depth(),
utils.vcfr2genlight.polyploid()
#test fbm
if (isTRUE(getOption("dartR_fbm"))) possums.gl <- gl.gen2fbm(possums.gl)
#for the first 10 loci only
gl.alf(possums.gl[,1:10])
barplot(t(as.matrix(gl.alf(possums.gl[,1:10]))))
gl.allele.freq(possums.gl[,1:10],simple=TRUE)
barplot(t(as.matrix(gl.allele.freq(possums.gl[,1:10],simple=TRUE))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.