wavesum {adwave}R Documentation

Wavelet Summaries of Localized Admixture Signals

Description

Produces wavelet summaries for each individual and group. Returns the wavelet variance and average block size metric (ABS).

Usage

wavesum(x, populations, popA = NA, popB = NA, ml = NULL, type = "la8",
    t.factor = 1, fullWT = FALSE)

Arguments

x

object of class adsig.

populations

list containing a vector of individual IDs for each population in the analysis.

popA

name of ancestral population 1 (used for forming the axes of variation). Must match one of the names in populations.

popB

name of ancestral population 2 (used for forming the axes of variation). Must match one of the names in populations.

ml

number of wavelet scales in the decomposition. Must not exceed log_2(T), where T is the length of the signal.

type

name of the wavelet to use in the decomposition. The default, “la8”, is Daubechies Least Asymmetric wavelet of length 8. Other options include “haar”.

t.factor

multiplicative factor for thresholding. See paper for details. Default is 1.

fullWT

if TRUE, save the full wavelet periodogram, as well as the wavelet variance. Object size will be large. Default is FALSE.

Details

Produces wavelet summaries for objects of class adsig. The function computes the wavelet variance for each individual and population, extracts the informative wavelet variance based on levels observed in the ancestral populations, and computes summary measures of average block size metric (ABS) and peak wavelet scale for each individual and population.

See waveslim documentation for details of the modwt function and alternative wavelet options.

Value

The code returns a list with the following components:

n.ind

number of individuals in the analysis.

n.group

number of groups in the analysis.

rv.ind

matrix of dimension n x ml, returning the raw wavelet variance for each individual.

rv.group

matrix of dimension n.group x ml, returning the raw wavelet variance for each group.

threshold

vector of length ml, returning threshold values for each wavelet scale.

iv.ind

matrix of dimension n x ml, returning the informative (thresholded) wavelet variance for each individual.

iv.group

matrix of dimension n.group x ml, returning the informative (thresholded) wavelet variance for each group.

abs.ind

vector of length n, returning the average block size metric (ABS) for each individual.

abs.group

vector of length n.group, returning the average block size metric (ABS) for each group.

pws.ind

vector of length n, returning the peak wavelet scale for each individual.

pws.group

vector of length n.group, returning the peak wavelet scale for each group.

wtmatrix

(only if fullWT = TRUE). Array of dimension T x n x ml, containing squared wavelet coefficients for each individual.

wtmatrix.group

(only if fullWT = TRUE). Array of dimension T x n.group x ml, squared wavelet coefficients, averaged for each group.

Author(s)

Jean Sanderson

References

Sanderson J, H Sudoyo, TM Karafet, MF Hammer and MP Cox. 2015. Reconstructing past admixture processes from local genomic ancestry using wavelet transformation. Genetics 200:469-481. https://doi.org/10.1534/genetics.115.176842

See Also

signal

Examples

data(admix)

# Generate the admixture signal 
AdexPCA <- signal(admix$data,popA="popA",popB="popB",populations=admix$populations,
  tol=0.001, n.signal=NULL)

# Compute wavelet summaries
WSN <- wavesum(AdexPCA,populations=admix$populations,popA="popA",popB="popB")

# Plot raw wavelet variance for each population
barplot(WSN$rv.group[3,],ylim=c(0,0.9),col="red", names.arg=1:11,border=NA)
barplot(WSN$rv.group[1,],ylim=c(0,0.9),col="green3",names.arg=1:11,border=NA,add=TRUE)
barplot(WSN$rv.group[2,],ylim=c(0,0.9),col="blue", names.arg=1:11,border=NA,add=TRUE)
legend("topright",c("popA","popB","popAB"),col=c(3,4,2),pch=15)
box()

# Plot informative wavelet variance for admixed population
barplot(WSN$iv.group[3,],ylim=c(0,0.15),col="red",names.arg=1:11,border=NA)
ABS <- round(WSN$abs.group[3],2) 
text(11,0.13,paste("ABS=",ABS))
box()

[Package adwave version 1.3 Index]