xwas

X-Wide Association Analyses

View the Project on GitHub nampho2/xwas

An R package for X-Wide Association Analyses

The xwas package was originally developed from research done in the exposome lab of the Department for Biomedical Informatics at Harvard Medical School.

During the course of investigation on the behavioral and environmental causes of mortality we found that studies have historically only evaluated one or a few hand-picked factors. This approach lacks the rigor of a systematic approach found in other data sciences and the lack of standardization in analytical approach can lead to spurious results. In some fields such as genomics, Genome-Wide Association Studies (GWAS) have resulted in a robust body of reproducible findings and we sought to take an analogous approach to environmentally- and behaviorally-based studies. This easy-to-use package provided here is a much needed framework to extend the Cox proportional hazards regression based approach to a more generalized audience.

DISCLAIMER: this package is provided as-is and we are not responsible for any issue resulting from is use.

User Quickstart

We are working on a submission of this package to CRAN and hope future installations will be the simple 1-liner below from within R. However, this is currently NOT a viable method of installing the xwas package.

# From CRAN
> install.packages("xwas")

Installing xwas using the source code from Github within R.

# Install and load the devtools package
> install.packages("devtools")
> library(devtools)

# Download and install the latest stable xwas version from Github
> install_github('chiragjp/xwas')

# Load the xwas library
> library(xwas)

For Developers

This method is for active contributors to xwas and developers who want the latest version in development. It requires cloning the source code from Github and building the package locally using the Makefile in a Terminal before loading xwas in R.

WARNING: please review the Makefile before compiling from source. I set the environment variable R_LIBS="~/.R_libs" within a ~/.Renviron file meaning I use a local folder within my home directory for personal library management. The Makefile actively destroys this folder on clean so please use with care.

# Grab the bleeding edge source
$ git clone git@github.com:nampho2/xwas.git

# Build the R package in the cloned directory
$ cd xwas
$ make deploy

$ R

# Load the xwas library
> library(xwas)

Using the Package

List included data sets.

> data(package='xwas')

Data sets in package ‘xwas’:

nhanes                  NHANES survey results.

Use the main xwas function for regression analysis. You need to pass the dependent variable, the independent variable, and the variables you are adjusting for. An example is shown below,

> xwas(data=nhanes, depvar="LBXGLU", varname="LBXGTC", adjvars=c("female", "RIDAGEYR"))
I(scale(LBXGLU)) ~ I(scale(LBXGTC)) + female + RIDAGEYR
<environment: 0x7fad9573cc40>
                    Estimate   Std. Error    t value     Pr(>|t|)    N varname
(Intercept)      -0.43849411 0.0363701062 -12.056443 9.524006e-33 3115  LBXGTC
I(scale(LBXGTC))  0.20384975 0.0165432041  12.322265 4.234986e-34 3115  LBXGTC
female           -0.20871535 0.0331005295  -6.305499 3.278831e-10 3115  LBXGTC
RIDAGEYR          0.01376026 0.0007220165  19.058095 1.118869e-76 3115  LBXGTC
> 

Support or Contact

The xwas package was originally authored by @chiragjp and currently maintained by @nampho2.

Please e-mail the current package maintainer with any questions.

References

  1. Patel CJ, Rehkopf DH, Leppert JT, Bortz WM, Cullen MR, Chertow GM, and JPA Ioannidis. "Systematic evaluation of environmental and behavioural factors associated with all-cause mortality in the United States National Health and Nutrition Examination Survey." International Journal of Epidemiology (2013) 1–16 [PubMed] [PDF]