The nullranges package contains functions for generation of sets of genomic ranges, represented as GRanges objects, for exploring various null hypotheses. For example, one may want to assess the significance of the overlap of two sets of ranges, by generating statistics of what would be expected under the null distribution of no relationship between these sets. We note that many other test statistics are supported via the flexible framework described here, combining nullranges with plyranges. The nullranges package contains a number of vignettes describing different functionality, from basic to more advanced usage. For a listing of all the vignettes in the package, one can type:
The nullranges package has two distinct branches of functionality: matching or bootstrapping to generate null sets of genomic ranges.
In the vignette sections below we describe these two branches and give more formal definitions, where each branch has associated vignettes and man page sections (see Reference tab from the package website). To give a high level overview, we first provide a decision tree that helps to indicate the considerations when choosing between these branches of functionality.
Define features as a set of genomic locations of interest, these are minimally represented with a chromosome, start and width, and optionally strand and metadata (genomic ranges). Given a set of features, suppose that we wish to create an alternate set that represents a null feature set, sometimes also referred to as “background” or a “control set”. For example, we may see that our primary features are close to transcription start sites, but are they closer than we would expect compared to a reasonable choice of null features?
Additionally, define pool as a much larger set of
genomic locations compared to the primary features, and
covariates as pieces of metadata attached to all of the
considered features (stored as mcols(<GRanges>)
,
which may be continuous, integer, factor, etc.).
Our choice of methods is informed by the following:
The following decision tree then informs what methods to choose:
In summary, while matchRanges does not control for genomic distribution and clustering of features, bootRanges does not directly control for feature covariates independent of proximity and local context.
Suppose we want to examine the significance of overlaps of genomic sets of features x and y. To test the significance of this overlap, we calculate the overlap expected under the null by generating a null feature set y′ (potentially many times). The null features in y′ may be characterized by:
We provide a number of vignettes to describe the different matching and bootstrapping use cases. In the matching case, we have implemented a number of options, including nearest neighbor matching or rejection sampling based matching. In the bootstrapping case, we have implemented options for bootstrapping across or within chromosomes, and bootstrapping only within states of a segmented genome. We also provide a function to segment the genome by density of features. For example, supposing that x is a subset of genes, we may want to generate y′ from y such that features are re-sampled in blocks from segments across the genome with similar gene density. In both cases, we provide a number of functions for performing quality control via visual inspection of diagnostic plots.
Finally, we recommend to incorporate list of regions where artificial features should not be placed, including the ENCODE Exclusion List (Amemiya, Kundaje, and Boyle 2019). This and other excluded ranges are made available in the excluderanges Bioconductor package by Mikhail Dozmorov et al. (Ogata et al. 2023). Use of excluded ranges is demonstrated in the segmented block bootstrap vignette.