PolyTest: Test for evidence of polygenic selection

Description Usage Arguments Value Examples

View source: R/polygenic_test.R

Description

Tests for evidence of polygenic selection by matching SNPs by DAF and using a one-sided Wilcoxon rank sum test.

Usage

1
PolyTest(DAFs, pvalues, quantiles, allele_ages_quantiles)

Arguments

DAFs

1d array. Derived allele frequencies of trait associations

pvalues

1d array. Selection pvalues of trait associations

quantiles

data frame. Obtained from PolyTest_Init.

allele_ages_quantiles

List of data tables. Obtained from PolyTest_Init.

Value

Returns a pvalue.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Example analysis:
# read files
mut         <- read.mut(system.file("extdata/example.mut.gz", package = "relater"), CHR = 1)
sele        <- read.sele(system.file("extdata/example.sele.gz", package = "relater"), CHR = 1)
freq        <- read.freq(system.file("extdata/example.freq.gz", package = "relater"), CHR = 1)
qual        <- read.qual(system.file("extdata/example.qual.gz", package = "relater"), CHR = 1)

# Obtain allele_ages data table
allele_ages <- get.allele_ages(mut, freq, sele)
allele_ages <- filter.allele_ages(allele_ages, qual)

######### Polygenic selection test #########

# Initialise
quant       <- PolyTest_Init(allele_ages)

# Make a fake polygenic trait
df          <- allele_ages[!is.na(allele_ages$pvalue),]
df          <- df[sample(1:nrow(df), 50, replace = FALSE),]

# Run polygenic test
PolyTest(df$DAF, df$pvalue, quant$quantiles, quant$allele_ages_quantiles)

leospeidel/relater documentation built on Feb. 3, 2022, 8:22 p.m.