# \dontshow{
data.table::setDTthreads(2)
RhpcBLASctl::blas_set_num_threads(2)
RhpcBLASctl::omp_set_num_threads(2)
# }
example_gt <- load_example_gt("gen_tbl")
# For alternate allele frequency
example_gt %>% loci_alt_freq()
# For alternate allele frequency per locus per population
example_gt %>%
group_by(population) %>%
loci_alt_freq()
# alternatively, return a list of populations with their frequencies
example_gt %>%
group_by(population) %>%
loci_alt_freq(type = "list")
# or a matrix with populations in columns and loci in rows
example_gt %>%
group_by(population) %>%
loci_alt_freq(type = "matrix")
# or within reframe (not recommended, as it much less efficient
# than using it directly as shown above)
library(dplyr)
example_gt %>%
group_by(population) %>%
reframe(alt_freq = loci_alt_freq(genotypes))
# For MAF
example_gt %>% loci_maf()
# For minor allele frequency per locus per population
example_gt %>%
group_by(population) %>%
loci_maf()
# alternatively, return a list of populations with their frequencies
example_gt %>%
group_by(population) %>%
loci_maf(type = "list")
# or a matrix with populations in columns and loci in rows
example_gt %>%
group_by(population) %>%
loci_maf(type = "matrix")
Run the code above in your browser using DataLab