A package for calculating Bayes factors and credible sets from genome-wide association study (GWAS) results.
This package provides functions for calculating Bayes factors and credible sets using p-values from GWAS results. These functions can be used separately, or combined with locuszoom.js for interactive credible set visualization.
LocusZoom implements a simple procedure based on this package. See the usage instructions, below, for an example. In the future, additional methods for identifying and annotating credible sets may be provided.
How to include in your project
dist/gwas-credible-sets.min.js directly into your page (as a standalone file, or via a CDN option such as unpkg).
gwas-credible-sets also supports several packaging environments and may be used in both client and server side
applications, including Node.js, ES6 modules, and Webpack. It may be installed from NPM:
npm install --save gwas-credible-sets
For information about performance impacts of client-side computation, see timing and performance estimates.
Sample credible set calculation
The instructions below assume that the module is being sourced directly into a page:
The example below assumes that you are given an array of p-values, each representing a different data point. It returns a set of booleans saying whether each data point is a member of the 95% credible set.
/// Calculate Bayes factors and process into a form that can be used for the credible set var scores = gwasCredibleSets.scoring.bayesFactors(nlogpvals); var posteriorProbabilities = gwasCredibleSets.scoring.normalizeProbabilities(scores); // Identify the credible set and apply filters for visualization var credibleSet = gwasCredibleSets.marking.findCredibleSet(posteriorProbabilities, 0.95); var credibleSetBoolean = gwasCredibleSets.marking.markBoolean(credibleSet);
marking module contains several helper functions to control how the credible set is returned. Helper methods are
provided to process the set members (posterior probabilities) in ways that support visualization needs.
See full documentation for details.
This package has been developed and tested using Node.js 8 LTS (Carbon).
If you would like to make changes to the core functionality within this module for development, install package requirements as follows:
Some portions of the documentation (such as methods) require
pandoc and a working
LaTeX installation on your
system; you must install these separately.
The following commands are particularly useful during development
npm test: run unit tests and exit
npm run watch: auto-run tests whenever code changes
npm run build: build
dist/files and update documentation