f4_from_afdat | R Documentation |
Compute f4 from allele frequencies
f4_from_afdat(afdat, popcombs)
afdat |
A data frame with allele frequencies and SNP metadata. Can be grouped. |
popcombs |
A data frame with population combinations. Columns |
## Not run:
# Compute f4 for all mutatation classes separately
afs = plink_to_afs('/my/geno/prefix', pops = c('p1', 'p2', 'p3', 'p4', 'p5'))
afdat = bind_cols(afs$snpfile, afs$afs %>% as_tibble()) %>%
mutate(gr = paste0(pmin(A1, A2), pmax(A1, A2))) %>%
group_by(gr)
popcombs = tibble(pop1 = c('p1', 'p5'), pop2 = 'p2', pop3 = 'p3', pop4 = 'p4')
out = f4_from_afdat(afdat, popcombs)
out %>% ggplot(aes(gr, est)) + geom_point() +
geom_errorbar(aes(ymin = est - se, ymax = est + se)) +
facet_wrap(~paste(pop1, pop2, pop3, pop4), scales = 'free')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.