BeviMed Introduction

knitr::opts_chunk$set(dev="svg", fig.width=7, fig.height=7)

BeviMed, which stands for Bayesian Evaluation of Variant Involvement in Mendelian Disease [1], is an association test which estimates the probability of an association between a given set of variants and a case/control label, the mode of inheritance for the disease, and the probability that each individual variant is pathogenic. This vignette gives a quick description of what can be done with the package and demonstrates how to use it on simulated data. For more detailed explanations, see the 'BeviMed Guide' vignette and the individual function help pages.

Inference is performed by the bevimed function, which evaluates the data with respect to three models: a model of no association between case/control label and allele counts, and models of dominant and recessive association. The function depends on input parameters:

bevimed returns an object of class BeviMed which contains the output of the (MCMC-based) inference procedure, including samples from the posterior distributions of the model parameters. The object can be evaluated at the command line to print a summary of inference, telling you summary statistics of interest, including the probability of association. The object is likely to take up a lot of memory, so it is useful to store a summary, computed with summary, for each result if the procedure is being applied to multiple loci.

Summary statistics can also be computed directly from the arguments using the functions (see help for individual functions for more information):

Here we demonstrate a simple application of BeviMed for some simulated data.


Firstly, we'll generate a random allele-count matrix G for 100 samples at 20 variant sites (each with an allele frequency of 0.02) and an independently generated case-control label, y_random.

G <- matrix(rbinom(size=2, prob=0.02, n=100*20), nrow=100, ncol=20)
y_random <- runif(n=nrow(G)) < 0.1

prob_association(G=G, y=y_random)

The results indicate that there is a low probability of association. We now generate a new case control label y_dependent which depends on G - specifically, we treat variants 1 to 3 as 'pathogenic', and label any samples harbouring alleles for any of these variants as cases.

y_dependent <- apply(G, 1, function(variants) sum(variants[1:3]) > 0)

prob_association(G=G, y=y_dependent)

Notice that there is now a higher estimated probability of association.

By default, prob_association integrates over mode of inheritance (e.g. are at least 1 or 2 pathogenic variants required for a pathogenic configuration?). The probabilities of association with each mode of inheritance can by shown by passing the option by_MOI=TRUE (for more details, including how to set the ploidy of the samples within the region, see ?prob_pathogenic).

For a more detailed output, the bevimed function can be used, and it's returned values can be summarised and stored/printed.

output <- summary(bevimed(G=G, y=y_dependent))


  1. Greene et al., A Fast Association Test for Identifying Pathogenic Variants Involved in Rare Diseases, The American Journal of Human Genetics (2017),

Try the BeviMed package in your browser

Any scripts or data that you put into this service are public.

BeviMed documentation built on Aug. 21, 2017, 5:05 p.m.