rbonferroni

Applying Bonferroni correction to eQTL analysis done with Matrix_eQTL_engine


I have completed an eqtl analysis using the MatrixEQTL package.

me <- Matrix_eQTL_engine(
    snps = snps,
    gene = gene,
    cvrt = cvrt,
    output_file_name = output_file_name,
    pvOutputThreshold = 0.05,
    useModel = modelLINEAR, 
    errorCovariance = errorCovariance, 
    verbose = TRUE,
    pvalue.hist = TRUE,
    min.pv.by.genesnp = FALSE,
    noFDRsaveMemory = FALSE)

The code is taken from ?Matrix_eQTL_engine, which also contains the code to set things up.

I set a threshold pvalue as 0.05 but I am wondering if there is a way to find a threshold value by a test to include in this script. I also want to correct for multiple testing and as per matrixeqtl manual, it does correct for False Discovery Rate. But I want to find a threshold pvalue for multiple testing for Bonferroni correction and then used that pvalue. I hope to add that to this code as well. Thank you for any suggestion/help!


Solution

  • the author of the package here.

    First, I would NOT suggest using pvOutputThreshold = 1 as it can result in storing billions of p-values and make R run out of memory.

    Second, Matrix eQTL returns the number of tests it has conducted, so that you can do Bonferroni correction yourself. You can get it with this line:

    me$all$ntests
    

    or, if you differentiate local and distant tests:

    me$cis$ntests
    me$trans$ntests