wAFd: Directed Weighted Adaptive Fisher Test for Trait-SNV Set...

Description Usage Arguments Value See Also Examples

View source: R/wAFd.R

Description

This function performs weighted Adaptive Fisher (wAF) test for detecting association between a single trait and a set of single nucleotide variatnts (SNVs).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
wAFd(
  Y,
  X,
  binary = FALSE,
  cov = NULL,
  w = c("sd", "flat"),
  weight = NULL,
  adapt_perm = FALSE,
  cutoff = 2.5e-06,
  nperm = 1000,
  n0 = 1,
  seed = NULL
)

Arguments

Y

Y Phenotype data. It can be a continuous trait or a binary trait. A vector or length n (number of subjects).

X

Genotype data. A matrix with dimensions n (number of subjects) by K (number of variants).

binary

Indicator of whether Y is binary.

cov

Covariates. A matrix with dimensions n (number of subjects) by J (number of covariates).

w

Weight option. Use "sd" for standard deviation weights, "flat" for flat weights.

weight

User-specified weights. A vector of length K (number of variants).

adapt_perm

Whether "step-up" algorithm is used for P-value calculation. If FALSE, function permutes nperm times and stops. If TRUE, nperm will be increased 10 times each round if P-value <= 5/nperm. Algorithm stops if P-value > 5/nperm or <= cutoff.

cutoff

Cutoff for "step-up" algorithm.

nperm

Number of permutations. Also the starting number of permutations for "step-up" algorithm. Default is 1,000.

n0

Tuning parameter. Discard the first n0-1 P-values of each column.

seed

Specify seed for permutations.

Value

An object of "wAF" class.

pv

P-value of wAF test.

stat

Test statistic of wAF test.

loci_combined

Variants which are combined into the test statistic. The index of included variants are returned in the ascending order of their weighted P-values.

stat_all

wAFd statistics for all permuted samples.

pv_all

P-values of wAFd statistics for all permuted samples.

method

Method used.

weight

Method of weighing variants, "sd" of "flat".

weight_values

Vector of weights used (if "sd" or user-specified weights are used).

See Also

set.seed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Binary trait
Y <- RV_sparse$trait
X <- RV_sparse$SNV[, -RV_sparse$zero_var]

# sd weights
test1 <- wAFd(Y, X, binary = TRUE, nperm = 100)
summary(test1)

# flat weights
test2 <- wAFd(Y, X, w = "flat", nperm = 100, adapt_perm = TRUE)
test2

songbiostat/wAF documentation built on Feb. 26, 2021, 6:24 p.m.