PheWAS-package | R Documentation |
This package provides the tools necessary to perform a PheWAS analysis.
Package: | PheWAS |
Type: | Package |
Version: | 0.99.6-1 |
Date: | 2023-05-31 |
License: | GPL3 |
This package contains the mappings and information for phecodes version 1.2 (ICD9CM) and the 2018 beta version of ICD10CM.
With the package installed, the command vignette("PheWAS-package")
will display the vignette.
The examples on the PheWASExamples github repository provide some helpful guides, especially the V1.0 walkthrough here.
mapCodesToPhecodes
allows users to transform their ICD9CM and ICD10CM codes into phecodes.
addPhecodeInfo
allows users to add the description for phecodes.
createPhenotypes
takes code count data produces output suitable for PheWAS anaylsis.
phewas
allows users to perform a PheWAS analysis with genetics, ICD9 codes, phecodes, etc.
phewasManhattan
is a high level plot function that will generate a ggplot2 of PheWAS results.
phenotypeManhattan
provides a more general interface for plotting phenotype based Manhattan plots.
phenotypePlot
provides a complex interface for plotting many types of phenotype data.
phewasMeta
will perform a meta analysis of phewas
results.
generateExample
creates data for example or testing purposes.
Robert Carroll <robert.carroll@vumc.org>
The original PheWAS manuscript can be found here: http://www.ncbi.nlm.nih.gov/pubmed/20335276
mapICD9ToPhecodes
addPhecodeInfo
createPhewasTable
phewas
PheWAS plotting methods
phewasMeta
#Load the PheWAS package
library(PheWAS)
#Set the random seed so it is replicable
set.seed(1)
#Generate some example data
ex=generateExample()
#Extract the three parts from the returned list
id.vocab.code.count=ex$id.vocab.code.count
genotypes=ex$genotypes
id.sex=ex$id.sex
#Create the phecode table- translates the codes, adds
#exclusions, and reshapes to a wide format.
#Sum up the counts in the data where applicable.
phenotypes=createPhenotypes(id.vocab.code.count,
aggregate.fun=sum, id.sex=id.sex)
#Combine the data
data=inner_join(inner_join(phenotypes,genotypes),id.sex)
#Run the PheWAS
results=phewas_ext(data,phenotypes=names(phenotypes)[-1],genotypes=c("rsEXAMPLE"),
covariates=c("sex"), cores=1)
#Plot the results
phewasManhattan(results,
title="My Example PheWAS Manhattan Plot")
#Add PheWAS descriptions
results_d=addPhecodeInfo(results)
#List the top 10 results
results_d[order(results_d$p)[1:10],]
#Create a nice interactive table (eg, in RStudio)
phewasDT(results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.