phewasMeta: Perform meta-analysis of PheWAS results

View source: R/phewasMeta.R

phewasMetaR Documentation

Perform meta-analysis of PheWAS results

Description

This function wraps the meta package's metagen function to meta analyze phewas results.

Usage

phewasMeta(results, fixed=T, keep.both=T, cores=1, ...)

Arguments

results

Data frame containing phewas results. This data frame should include an additional column, study, identifying which study the results are for. See details and examples for more information.

fixed

Use the fixed effects model results in columns p, OR, beta, and SE? Default is TRUE.

keep.both

If FALSE, remove the specified fixed effects and random effects results columns (e.g., p.fixed and p.random). Default is TRUE.

cores

The number of cores to use in the parallel socket cluster implementation. If cores=1, will be used instead.

...

Additional parameters to be passed to metagen.

Details

This function uses by to split results into groups of studies based on phenotype, snp, and adjustment. phewasMeta forces NA adjustment values to be a character string "NA" due to by restrictions on the INDICES. The results dataframe must contain an additional column, study, which contains a study identifier for the meta analysis. Adding a study column for each set of phewas results followed by an rbind joining them together would create a functional results parameter. See the examples section.

Value

A data frame containing meta-analysis results. Includes most phewas result columns and summary information on the meta analysis.

See Also

phewasMetaModels will return a by object of complete metagen objects.

Examples


#Generate some example data
ex=generateExample(hit="335")
#Extract the two parts from the returned list
id.icd9.count=ex$id.icd9.count
genotypes=ex$genotypes
#Create the PheWAS code table- translates the icd9s, adds exclusions, and reshapes to a wide format
phenotypes=createPhewasTable(id.icd9.count)
#Run the PheWAS
results.1=phewas(phenotypes,genotypes,cores=4,significance.threshold=c("bonferroni"))
#Set up a study identifier
results.1$study="335"
#Perform another PheWAS
ex=generateExample(hit="250.2")
id.icd9.count=ex$id.icd9.count
genotypes=ex$genotypes
phenotypes=createPhewasTable(id.icd9.count)
results.2=phewas(phenotypes,genotypes,cores=4,significance.threshold=c("bonferroni"))
results.2$study="250.2"
#Join the two sets of PheWAS results
results=rbind(results.1,results.2)
#Perform the meta analysis, and do not assume fixed effects.
results.meta=phewasMeta(results, fixed=FALSE, keep.both=FALSE)


PheWAS/PheWAS documentation built on July 3, 2023, 3:40 p.m.