Peff

R code for calculating the effective number of independent tests, either for single SNP tests, as in Li and Ji (2005) or for interaction tests.

If you use this procedure, please cite the following reference:

A new correction for multiple testing in gene x gene interaction studies
MC BABRON, A ETCHETO, MH DIZIER
Ann Hum Genet. 2015 Apr 23. doi: 10.1111/ahg.12113

Running the procedure:

One has to provide a pedfile in PLINK format, with alleles coded as 1 and 2.

Once stripped of the first 6 columns, the genotypes are recoded as 0, 1 and 2 into the matrix geno with number of rows equal to the number of individuals and number of columns equal to the number of SNPs. Missing data is imputed with median.

Meff, the number of independent single SNP tests, is calculated as in Li and Ji (2005).

Peff, the number of independent interaction tests between pairs of SNPs is then obtained as Meff (Meff – 1)/2.

Code:

# Marie-Claude Babron, Adrien Etcheto, Marie-Hélène Dizier
# 2014

# R procedure for calculating the effective number of tests
# either for single SNP tests, as in Li and Ji (2005)
# or for interaction tests

# reference:
# A new correction for multiple testing in gene x gene interaction studies
# MC BABRON, A ETCHETO, MH DIZIER
# Ann Hum Genet. 2015 Apr 23. doi: 10.1111/ahg.12113.

# —————————–
# Implementation of the Li&Ji procedure
# M is the correlation matrix
f.Ji=function(M){
eigen.value=abs(eigen(M, only.values=TRUE)$values)
sum(eigen.value>=1)+sum(eigen.value-floor(round(eigen.value,15)))
}
# ———————————–
data <- read.table(« plink.ped », header=F)
data <- data[,-c(1:6)]
nsnp <- dim(data)[2]/2

geno <- matrix(NA, nrow=dim(data)[1],ncol=nsnp)
for (i in 1:nsnp) {
geno[,i] <- data[,2*i-1]+data[,2*i]-2
geno[geno[,i] == -2,i] <- median(geno[geno[,i]!= -2,i])
}

Meff <- f.Ji(cor(geno)^2)
Peff <- Meff*(Meff-1)/2