allele_freq_corr_windows: Allele frequency correlations across genomic windows

View source: R/allele_freq_corr_windows.R

allele_freq_corr_windowsR Documentation

Allele frequency correlations across genomic windows

Description

This function takes a data table of population allele frequencies across different chromosomes/contigs and estimates correlations between loci within specified windows. Loci within these windows can be randomly subsmapled to reduce computational time and memory cost.

Usage

allele_freq_corr_windows(
  dat,
  chromCol = "CHROM",
  posCol = "POS",
  locusCol = "LOCUS",
  popCol = "POP",
  freqCol = "FREQ",
  windowSize = 10000,
  numLoci = 0
)

Arguments

dat

Data table: Contains populations allele frequencies.

chromCol

Character: The column with chromosome information. Default is 'CHROM'.

posCol

Character: The column with position information. Default is 'POS'.

locusCol

Character: The column with locus ID. Default is 'LOCUS'.

popCol

Character: The column with population ID. Default is 'POP'.

freqCol

Character: The column with frequencies of a focal allele. Default is 'FREQ'.

windowSize

Integer: The window size to use. Default is 10000.

numLoci

Integer: The number of loci to subsample per window. You may need to adjust this value depending on the density of markers in your dataset. Default is 0, which triggers all loci to be used. Specify >0 if you want to control the subsampling.

Value

Returns a long-format data table of pairwise correlations between loci within windows, within chromosomes. Has the columns: \enumterate $CHROM, the chromosome ID. \item $WINDOW, the window ID. \item $LOCUS.1, the locus 1 ID. \item $CHROM, the locus 2 ID. \item $DIST, the distance between loci in base pairs. \item $CORR, the Pearson correlation between locus allele frequencies.

Examples

library(genomalicious)

# RADseq pool-seq dataset
data(data_PoolFreqs)

# Note, only subset of contigs have multiple alleles, so only
# a few pairwise loci are returned.
allele_freq_corr_windows(data_PoolFreqs)

j-a-thia/genomalicious documentation built on Oct. 19, 2024, 7:51 p.m.