Let
Y = XB + ZA + E,
for
- Y an n by p matrix of gene expression data with n samples and p genes,
- X an n by q matrix of q covariates,
- B a q by p matrix of unobserved coefficients for the observed covariates,
- Z an n by k matrix of hidden confounders,
- A a k by p matrix of hidden coefficients for the hidden confounders, and
- E an n by p matrix of independent normal errors with column variances s1,…,sp.
Not accounting for the hidden covariates, Z, can reduce power and result in poor control of false discovery rate. This package provides a suite of functions to adjust for hidden confounders, both when one has and does not have access to control genes.
The functions mouthwash()
and backwash()
can adjust for hidden
confounding when one does not have access to control genes. They do so
via non-parametric empirical Bayes methods that use the powerful
methodology of Adaptive Shrinkage (Stephens 2016) within the
factor-augmented regression framework described in Wang et al. (2017).
backwash()
is a slightly more Bayesian version of mouthwash()
. These
methods are described in Gerard and Stephens (2020).
When one has control genes, there are many approaches to take. Such methods include RUV2 (J. A. Gagnon-Bartsch and Speed 2012), RUV4 (J. Gagnon-Bartsch, Jacob, and Speed 2013), and CATE (Wang et al. 2017). This package adds to the field of confounder adjustment with control genes by
- Implementing a version of CATE that is calibrated using control
genes similarly to the method in J. Gagnon-Bartsch, Jacob, and
Speed (2013). The function is called
vruv4()
. - Introduces RUV3, a version of RUV that can be considered both RUV2
and RUV4. The function is called
ruv3()
. - Introduces RUV-impute, a more general framework for accounting for
hidden confounders in regression. The function is called
ruvimpute()
- Introduces RUV-Bayes, a Bayesian version of RUV. The function is
called
ruvb()
.
These additions are described in detail in Gerard and Stephens (2021).
See also the related R packages
cate
(Wang and Zhao 2015)
and ruv
(J. Gagnon-Bartsch
2015).
Check out NEWS.md to see what’s new with each version.
If you use any of the control-gene based methods, please cite:
Gerard, D., & Stephens, M. 2021. “Unifying and Generalizing Methods for Removing Unwanted Variation Based on Negative Controls.” Statistica Sinica, 31(3), 1145-1166 <doi:10.5705/ss.202018.0345>.
Or, using BibTex:
@article{gerard2021unifying,
title={Unifying and Generalizing Methods for Removing Unwanted Variation Based on Negative Controls},
author={Gerard, David and Stephens, Matthew},
journal={Statistica Sinica},
doi={10.5705/ss.202018.0345},
volume={31},
number={3},
pages={1145--1166},
year={2021}
}
If you use either MOUTHWASH or BACKWASH, please cite:
Gerard, D., & Stephens, M. 2020. “Empirical Bayes shrinkage and false discovery rate estimation, allowing for unwanted variation,” Biostatistics, 21(1), 15-32 <doi:10.1093/biostatistics/kxy029>.
Or, using BibTex:
@article{gerard2020empirical,
author = {Gerard, David and Stephens, Matthew},
title = {Empirical {B}ayes shrinkage and false discovery rate estimation, allowing for unwanted variation},
journal = {Biostatistics},
volume = {21},
number = {1},
pages = {15--32},
year = {2020},
issn = {1465-4644},
doi = {10.1093/biostatistics/kxy029},
}
To install, first install sva
and limma
from Bioconductor in R:
install.packages("BiocManager")
BiocManager::install(c("limma", "sva"))
Then run in R:
install.packages("devtools")
devtools::install_github("dcgerard/vicar")
If you want some of the tools in vicar
to be exactly equivalent to
those in ruv
, you’ll need to install an older version of ruv
(ruv
was updated and now the those equivalencies are not exactly the same)
devtools::install_version("ruv", version = "0.9.6", repos = "https://cran.us.r-project.org")
A note about matrix computations in vicar: Some of the methods in the vicar package such as mouthwash and backwash rely heavily on matrix-vector operations. The speed of these operations can have a big impact on vicar’s performance, especially in large-scale data sets. If you are applying vicar to large data sets, I recommend that you set up R with optimized BLAS (optionally, LAPACK) libraries, especially if you have a multicore computer (most modern laptops and desktops are multicore). See here and here for advice and technical details on this. For example, in our experiments on a high-performance compute cluster we set up R with multithreaded OpenBLAS.
I’ve provided three vignettes to help you get started with vicar. By
default, the vignettes are not built when you use install_github
. To
build the vignettes during installation, run
install.packages("devtools")
devtools::install_github("dcgerard/vicar", build_vignettes = TRUE)
Note that this will result in a somewhat slower install. The first
vignette, sample_analysis, gives a sample analysis using vicar to
account for hidden confounding. The second vignette, customFA, gives a
few instructions on how to incorporate user-defined factor analyses with
the confounder adjustment procedures implemented in vicar. The third
vignette, custom_prior, gives instructions and examples on
incorporating a user-specified prior into ruvb
. To see these vignettes
after install, run
utils::vignette("sample_analysis", package = "vicar")
utils::vignette("customFA", package = "vicar")
utils::vignette("custom_prior", package = "vicar")
Gagnon-Bartsch, Johann. 2015. ruv: Detect and Remove Unwanted Variation Using Negative Controls. https://CRAN.R-project.org/package=ruv.
Gagnon-Bartsch, Johann A, and Terence P Speed. 2012. “Using Control Genes to Correct for Unwanted Variation in Microarray Data.” Biostatistics 13 (3): 539–52. https://doi.org/10.1093/biostatistics/kxr034.
Gagnon-Bartsch, Johann, Laurent Jacob, and Terence Speed. 2013. “Removing Unwanted Variation from High Dimensional Data with Negative Controls.” Technical Report 820, Department of Statistics, University of California, Berkeley. https://statistics.berkeley.edu/tech-reports/820.
Gerard, David, and Matthew Stephens. 2020. “Empirical Bayes shrinkage and false discovery rate estimation, allowing for unwanted variation.” Biostatistics 21 (1): 15–32. https://doi.org/10.1093/biostatistics/kxy029.
———. 2021. “Unifying and Generalizing Methods for Removing Unwanted Variation Based on Negative Controls.” Statistica Sinica 31 (3): 1145–66. https://doi.org/10.5705/ss.202018.0345.
Stephens, Matthew. 2016. “False discovery rates: a new deal.” Biostatistics 18 (2): 275–94. https://doi.org/10.1093/biostatistics/kxw041.
Wang, Jingshu, and Qingyuan Zhao. 2015. cate: High Dimensional Factor Analysis and Confounder Adjusted Testing and Estimation. https://CRAN.R-project.org/package=cate.
Wang, Jingshu, Qingyuan Zhao, Trevor Hastie, and Art B. Owen. 2017. “Confounder Adjustment in Multiple Hypothesis Testing.” Ann. Statist. 45 (5): 1863–94. https://doi.org/10.1214/16-AOS1511.