abought / raremetal.js

JS implementation of rare variant aggregation tests

Home Page:https://statgen.github.io/raremetal.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

raremetal.js

Build Status Dependency Status devDependency Status

A package for performing rare variant aggregation tests and meta-analysis using score covariance matrices.

For a general overview of these types of tests and study design issues, refer to "Rare-Variant Association Analysis: Study Designs and Statistical Tests". Lee et al, 2014.

The methods implemented in this package are described across a number of papers and websites.

Collapsing burden test (specifically the Morris-Zeggini test):

SKAT test:

Methods for aggregation tests on covariance matrices:

This package is based partly on methods implemented in the following software:

Usage

Installation

The package can be installed with NPM:

npm install --save raremetal.js

Importing

This package may be incorporated into both web/browser and node.js based projects.

On the web, include the dist/raremetal.min.js file in your site:

<script src="/path/to/your/assets/raremetal.min.js" type="application/javascript"></script>

Or alternatively via CDN:

<script src="https://cdn.example/raremetal.min.js" type="application/javascript"></script>

Alternatively, the module can be loaded via node.js:

// In node.js
const raremetal = require("raremetal.js");

// Helper functions for browser, such as loading JSON defining covariance/masks.
const helpers = raremetal.helpers;

// Statistical functions for calculating aggregation tests.
const stats = raremetal.stats;

Examples

The best working example of how to use the library can be found in LocusZoom. The aggregation test example shows how LocusZoom uses the functions in src/app/helpers.js to:

  • Load score statistics and covariance matrices for genes within a genomic region.
  • Calculate aggregation tests (burden, SKAT) for each gene in the region.

Functions in src/app/helpers.js are designed to load data in JSON format from an API (or a static JSON file.) The API format is specified this PDF.

For examples of loading data and running tests using the command-line (CLI) version of this package, see src/app/cli.js. Scores and covariances are loaded from rvtest or RAREMETAL formatted files. When installing this package, an executable script raremetal.js should be installed, which corresponds to src/app/cli.js.

Development

Requirements

This package has been developed and tested using Node.js 8 LTS (Carbon). It currently does not work with the latest version of Node.js, though we aim to patch that eventually. You can manage multiple Node.js versions using nvm, and this package includes a .nvmrc file that specifies which version we are currently testing against.

If you would like to make changes to the core functionality within this module for development, the best method would be to fork the repository on Github, and then clone your fork locally:

# Clone from github
git clone https://github.com/your_account/raremetal.js

# Install project dependencies
cd raremetal.js
npm install

Alternatively, you could clone directly from our repository with git clone https://github.com/statgen/raremetal.js. This will make it difficult to contribute your changes back upstream to us, however.

Building some portions of the documentation (such as methods and API docs) require pandoc and a working LaTeX installation on your system; you must install these separately. Already built documentation is provided in both the npm package and the git repository.

Useful Commands

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 documentation

About

JS implementation of rare variant aggregation tests

https://statgen.github.io/raremetal.js/

License:MIT License


Languages

Language:JavaScript 99.1%Language:HTML 0.7%Language:Shell 0.2%