Learn R Programming

wtest (version 3.0)

wtest.snps.meth: W-test for gene-methylation interaction analysis

Description

This function performs the W-test to calculate gene-methylation interactions at a (SNP,CpG) pair level for categorical data sets and suitable for a genome-wide testing. This function can automatically screen and exhaustively evaluate interaction effects of the SNPs and CpG sites located within a user-defined genome distance. The output can be filtered by p-values, such that only sets with smaller p-value than a threshold (output.pval) will be returned.

Usage

wtest.snps.meth(geno, meth, y, geno.pos, meth.pos, window.size = 10000,
  hf = "default.hf", output.pval = NULL, sort = TRUE)

Arguments

geno

a data frame or matrix contains genotypes in the columns. Genotypes should be coded as (0, 1, 2) or (0, 1). SNP names should be stored at column names of the data.

meth

a data frame or matrix contains methylation data in the columns. Methylation data should be recoded as (0, 1, 2) or (0, 1). Names of CpG sites should be stored at column names of the data.

y

a numeric vector composed of 0 or 1; or a factor variable with two levels.

geno.pos

a data frame contains SNP names and positions in two columns.

meth.pos

a data frame contains CpG names and positions in two columns.

window.size

a numeric number specifies the size of genome distance. Interaction effects of the SNPs and CpG sites located within the size of genome distance will be evaluated exhaustively.

hf

a data frame or matrix, contains the h and f values for pairwise interaction effect calculation when k = 2 to 9. Default hf is h = k/(k-1) and f = k-1, where k = 2 to 9, the first row is the h and f for k = 2, and the last row is the h and f for k = 9.

output.pval

a p-value threshold for filtering the output. If NULL, all the results will be listed; otherwise, the function will only output the results with p-values smaller than the output.pval.

sort

a logical value indicating whether or not to sort the output by p-values in ascending order. Default = TRUE.

Value

An object "wtest.snps.meth" containing:

results

The test results include: SNP name, CpG name, SNP position, CpG position, W value, k, and p-value.

hf

The h and f values used for each k in pairwise calculation, where k = 2 to 9.

Details

W-test is a model-free statistical test to measure main effect or pairwise interactions in case-control studies with categorical variables. Theoretically, the test statistic follows a Chi-squared distribution with f degrees of freedom. The data-adaptive degree of freedom f, and a scalar h in the test statistics allow the W-test to correct for distributional bias due to sparse data and small sample size. Let k be the number of columns of the 2 by k contingency table formed by a single variable or a variable pair. When the sample size is large and there is no population stratification, the h and f will approximate well to the theoretical value h = (k-1)/k, and f = k-1. When sample size is small and there is population stratification, the h and f will vary to correct for distributional bias caused by the data structure.

References

Maggie Haitian Wang, Rui Sun, Junfeng Guo, Haoyi Weng, Jack Lee, Inchi Hu, Pak Sham and Benny C.Y. Zee (2016). A fast and powerful W-test for pairwise epistasis testing. Nucleic Acids Research.doi:10.1093/nar/gkw347.

See Also

wtest, hf.snps.meth

Examples

Run this code
# NOT RUN {
data(SNP_pos)
data(CpG_pos)
data(genotype)
data(methylation)
data(phenotype2)

w <- 13000

# Recode methylation data
methylation <- methylation.recode(methylation)

## Step 1. HF Calculation.
# Please note that parameter B is recommended to be greater than 400.
hf.pair <- hf.snps.meth(B = 80, geno = genotype, meth = methylation, y = phenotype2,
                        geno.pos = SNP_pos, meth.pos = CpG_pos, window.size = w)

## Step 2. Application
result <- wtest.snps.meth(geno = genotype, meth = methylation, y = phenotype2, geno.pos = SNP_pos,
                          meth.pos = CpG_pos, window.size = w, hf = hf.pair, output.pval = 0.1)

# }

Run the code above in your browser using DataLab