CalcD: Calculate Patterson's D-statistic

View source: R/CalcD.R

CalcDR Documentation

Calculate Patterson's D-statistic

Description

These functions calculate Patterson's D-statistic to compare the frequencies of discordant SNP genealogies. These tests assume equal substitution rates and unlinked loci, D-statistics significantly different from 0 suggest that introgression has occurred.

Usage

CalcD(alignment = "alignment.fasta", sig.test = "N", ambig="D", 
block.size = 1000, replicate = 1000, align.format='fasta')

CalcPopD(alignment = "alignment.fasta", sig.test = "N", ambig="D", 
block.size = 1000, replicate = 1000, align.format='fasta')

Arguments

alignment

This is an alignment in fasta format. Sequences should be in the order: P1, P2, P3, Outgroup. In the case of CalcPopD sequence from each populations should have identical names see file 3.fasta for an example

sig.test

This indicates whether or if to test for significance. Options are "B" bootstrap, "J" jackknife, or "N" none.

ambig

This flag indicate how to deal with sequence ambiguities. Options are "D" drop all ambigous loci, "R" resolve each biallelic ambiguity, or "I" ignore ambiguity and perform analysis without checking sequences. If the argument "R"" is chosen there is becomes a degree of stochasticity in the analysis and the user should run the analysis more than once. Also it would be wise to compare this result to setting the argument to "D".

block.size

The number of sites to be dropped in the jackknife approach

replicate

Number of replicates to be used in estimating variance

align.format

a character string specifying the format of the alignment file : mase, clustal, phylip, fasta or msf

Details

The functions CalcD and CalcPopD are implementations of the algorithm described in Durand et al. 2011. Significance of the D-stat can be calculated either through bootstrapping or jackknifing. Bootstrapping is appropriate for datasets where SNPs are unlinked for instance unmapped RADSeq data. Jackknifing is the appropriate approach when SNPs are potentially in linkage for instance gene alignments or genome alignments.

Value

Returns the number of each type of site, Z scores and p-values

Author(s)

Heath Blackmon

References

http://coleoguy.github.io/

Durand, Eric Y., et al. Testing for ancient admixture between closely related populations. Molecular biology and evolution 28.8 (2011): 2239-2252.

Eaton, D. A. R., and R. H. Ree. 2013. Inferring phylogeny and introgression using RADseq data: An example from flowering plants (Pedicularis: Orobanchaceae). Syst. Biol. 62:689-706

Examples

CalcD(alignment = system.file("1.fasta", package = "evobiR"), sig.test = "N")

CalcPopD(alignment = system.file("3.fasta", package = "evobiR"), sig.test = "N")
  

coleoguy/evobir documentation built on July 27, 2023, 12:40 p.m.