joint_spectrum: Estimate joint allele frequency spectrum

joint_spectrumR Documentation

Estimate joint allele frequency spectrum

Description

Estimate joint allele frequency spectrum

Usage

joint_spectrum(afs)

Arguments

afs

A matrix or data frame of allele frequencies

Value

A data frame with columns pattern and proportion

Examples

## Not run: 
dat = plink_to_afs('/my/plink/file', pops = c('pop1', 'pop2', 'pop3', 'pop4', 'pop5'))

# Spectrum across all SNPs
joint_spectrum(dat$afs)

# Stratify by allele frequency in one population
dat$afs %>% as_tibble %>% select(1:4) %>%
  group_by(grp = cut(pop1, 10)) %>%
  group_modify(joint_spectrum) %>%
  ungroup

# Stratify by mutation class
dat$afs %>% as_tibble %>% select(1:4) %>%
  mutate(mut = paste(dat$snpfile$A1, dat$snpfile$A2)) %>%
  group_by(mut) %>%
  group_modify(joint_spectrum) %>%
  ungroup

## End(Not run)

uqrmaie1/admixtools documentation built on Nov. 3, 2024, 12:56 a.m.