Zalpha_all: Runs all the statistics in the zalpha package

Description Usage Arguments Details Value References See Also Examples

View source: R/Zalpha_all.R

Description

Returns every statistic for each SNP location, given the appropriate parameters. See Details for more information.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Zalpha_all(
  pos,
  ws,
  x = NULL,
  dist = NULL,
  LDprofile_bins = NULL,
  LDprofile_rsq = NULL,
  LDprofile_sd = NULL,
  LDprofile_Beta_a = NULL,
  LDprofile_Beta_b = NULL,
  minRandL = 4,
  minRL = 25,
  X = NULL
)

Arguments

pos

A numeric vector of SNP locations

ws

The window size which the statistics will be calculated over. This should be on the same scale as the pos vector.

x

Optional. A matrix of SNP values. Columns represent chromosomes; rows are SNP locations. Hence, the number of rows should equal the length of the pos vector. SNPs should all be biallelic.

dist

Optional. A numeric vector of genetic distances (e.g. cM, LDU). This should be the same length as pos.

LDprofile_bins

Optional. A numeric vector containing the lower bound of the bins used in the LD profile. These should be of equal size.

LDprofile_rsq

Optional. A numeric vector containing the expected r^2 values for the corresponding bin in the LD profile. Must be between 0 and 1.

LDprofile_sd

Optional. A numeric vector containing the standard deviation of the r^2 values for the corresponding bin in the LD profile.

LDprofile_Beta_a

Optional. A numeric vector containing the first estimated Beta parameter for the corresponding bin in the LD profile.

LDprofile_Beta_b

Optional. A numeric vector containing the second estimated Beta parameter for the corresponding bin in the LD profile.

minRandL

Minimum number of SNPs in each set R and L for the statistics to be calculated. L is the set of SNPs to the left of the target SNP and R to the right, within the given window size ws. Default is 4.

minRL

Minimum value for the product of the set sizes for R and L. Default is 25.

X

Optional. Specify a region of the chromosome to calculate the statistics for in the format c(startposition, endposition). The start position and the end position should be within the extremes of the positions given in the pos vector. If not supplied, the function will calculate the statistics for every SNP in the pos vector.

Details

Not all statistics will be returned, depending on the parameters supplied to the function.
If x is not supplied, only Zalpha_expected, Zbeta_expected, LR and L_plus_R will be calculated.
For any of the statistics which use an expected r^2 value, the parameters dist, LDprofile_bins and LDprofile_rsq must be supplied. This includes the statistics: Zalpha_expected, Zalpha_rsq_over_expected, Zalpha_log_rsq_over_expected, Zalpha_Zscore, Zalpha_BetaCDF, Zbeta_expected, Zbeta_rsq_over_expected, Zbeta_log_rsq_over_expected, Zbeta_Zscore and Zbeta_BetaCDF.

The LD profile describes the expected correlation between SNPs at a given genetic distance, generated using simulations or real data. Care should be taken to utilise an LD profile that is representative of the population in question. The LD profile should consist of evenly sized bins of distances (for example 0.0001 cM per bin), where the value given is the (inclusive) lower bound of the bin. Ideally, an LD profile would be generated using data from a null population with no selection, however one can be generated using this data. See the create_LDprofile function for more information on how to create an LD profile. For more information about the statistics, please see Jacobs (2016).

Value

A list containing the SNP positions and the statistics for those SNPs

References

Jacobs, G.S., T.J. Sluckin, and T. Kivisild, Refining the Use of Linkage Disequilibrium as a Robust Signature of Selective Sweeps. Genetics, 2016. 203(4): p. 1807

See Also

Zalpha, Zalpha_expected, Zalpha_rsq_over_expected, Zalpha_log_rsq_over_expected, Zalpha_Zscore, Zalpha_BetaCDF, Zbeta, Zbeta_expected, Zbeta_rsq_over_expected, Zbeta_log_rsq_over_expected, Zbeta_Zscore, Zbeta_BetaCDF, LR, L_plus_R, create_LDprofile.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## load the snps and LDprofile example datasets
data(snps)
data(LDprofile)
## run Zalpha_all over all the SNPs with a window size of 3000 bp
## will return all 15 statistics
Zalpha_all(snps$bp_positions,3000,as.matrix(snps[,3:12]),snps$cM_distances,
 LDprofile$bin,LDprofile$rsq,LDprofile$sd,LDprofile$Beta_a,LDprofile$Beta_b)
## only return results for SNPs between locations 600 and 1500 bp
Zalpha_all(snps$bp_positions,3000,as.matrix(snps[,3:12]),snps$cM_distances,
 LDprofile$bin,LDprofile$rsq,LDprofile$sd,LDprofile$Beta_a,LDprofile$Beta_b,X=c(600,1500))
## will only return statistics not requiring an LD profile
Zalpha_all(snps$bp_positions,3000,as.matrix(snps[,3:12]))

zalpha documentation built on Nov. 27, 2021, 9:06 a.m.