gmfp.gpd: Genomic Mediation analysis with Fixed Permutation scheme and...

View source: R/gmfp.gpd.R

gmfp.gpdR Documentation

Genomic Mediation analysis with Fixed Permutation scheme and Generalized Pareto Distribution(GPD)

Description

The gmfp.gpd function performs genomic mediation analysis with fixed permutation. It tests for mediation effects for a set of user specified mediation trios(e.g., eQTL, cis- and trans-genes) in the genome with the assumption of the presence of cis-association. When the empirical P-value is small enough, the GPD fit is used to estimate a more accurate empirical P value.

It returns the mediation p-values(nominal P-value, empirical P-values obtained from ordinary calculations and empirical P-values estimated using GPD fitting), the coefficient of linear models(e.g, t_stat, std.error, beta, beta.total) and the proportions mediated(e.g., the percentage of reduction in trans-effects after accounting for cis-mediation).

Usage

gmfp.gpd(
  snp.dat,
  fea.dat,
  conf,
  trios.idx,
  cl = NULL,
  nperm = 10000,
  gpd.perm = 0.01
)

Arguments

snp.dat

The eQTL genotype matrix. Each row is an eQTL, each column is a sample.

fea.dat

A feature profile matrix. Each row is for one feature, each column is a sample.

conf

A confounders matrix which is adjusted in mediation tests. Each row is a confounder, each column is a sample.

trios.idx

A matrix of selected trios indexes (row numbers) for mediation tests. Each row consists of the index (i.e., row number) of the eQTL in snp.dat, the index of cis-gene feature in fea.dat, and the index of trans-gene feature in fea.dat. The dimension is the number of trios by three.

cl

Parallel backend if it is set up. It is used for parallel computing. We set cl=NULL as default.

nperm

The number of permutations for testing mediation. If nperm=0, only the nominal P-value is calculated. We set nperm=10000 as default.

gpd.perm

Decide when to use GPD to fit estimation parameters. When the proportion of permutation better than the original statistic is greater than par, the GPD is fitted to estimate the empirical P-value. We set gpd.perm=0.01 as default.

Details

The function performs genomic mediation analysis with fixed permutation. Fixed Permutation schemeWhen calculating the empirical P-value, the data is permutated by a fixed number of times, and the statistics after permutation are separately calculated. Assuming that the number of permutation is N, where the number of permutation statistics that is better than the original statistic is M, then the Empirical P-value = (M + 1) / (N + 1). calculate Empirical P-values using GPD fittingThe use of a fixed number of permutations to calculate empirical P-values has the disadvantage that the minimum empirical P-value that can be calculated is 1/N. This makes a larger number of permutations needed to calculate a smaller P-value. Therefore, we model the tail of the permutation value as a Generalized Pareto Distribution(GPD), enabling a smaller empirical P-value with fewer permutation times.

Value

The algorithm will return a list of empirical.p, empirical.p.gpd, nominal.p, beta, std.error, t_stat, beta.total, beta.change.

empirical.p

The mediation empirical P-values with nperm times permutation. A matrix with dimension of the number of trios.

empirical.p.gpd

The mediation empirical P-values with nperm times permutation using GPD fit. A matrix with dimension of the number of trios.

nominal.p

The mediation nominal P-values. A matrix with dimension of the number of trios.

std.error

The return std.error value of feature1 for fit liner models. A matrix with dimension of the number of trios.

t_stat

The return t_stat value of feature1 for fit liner models. A matrix with dimension of the number of trios.

beta

The return beta value of feature2 for fit liner models in the case of feature1. A matrix with dimension of the number of trios.

beta.total

The return beta value of feature2 for fit liner models without considering feature1. A matrix with dimension of the number of trios.

beta.change

The proportions mediated. A matrix with dimension of the number of trios.

References

Knijnenburg TA, Wessels LFA, Reinders MJT, Shmulevich I. (2009) Fewer permutations, more accurate P-values. Bioinformatics. 2009;25:i161–i168. doi: 10.1093/bioinformatics/btp211

Examples


output <- gmfp.gpd(conf = dat$known.conf, fea.dat = dat$fea.dat, snp.dat = dat$snp.dat,
                   trios.idx = dat$trios.idx[1:10,], nperm = 100)

## Not run: 
  ## generate a cluster with 2 nodes for parallel computing
  cl <- makeCluster(2)

  ## When the empirical P-value is less than 0.02, a more accurate
     empirical P-value is estimated using the GPD fit.
  output <- gmfp.gpd(conf = dat$known.conf, fea.dat = dat$fea.dat,
                     snp.dat = dat$snp.dat, trios.idx = dat$trios.idx[1:10,],
                     cl = cl, nperm = 100, gpd.perm = 0.02)

  stopCluster(cl)

## End(Not run)


QidiPeng/eQTLMAPT documentation built on Jan. 25, 2023, 11:03 p.m.