Introduction

The package annotator3D r packageVersion("mclust") is an R package to classify DNA motifs or features into chromatin loops. There are four public or private functions in annotator3D: Public functions: classify which acts as a master function to classify the motifs/features; and * visualize_annotation which returns an ggbio annotation track. Private functions: * bin_motifs, a helper function to classify. It calculates the frequencies of the feature in different loops. calculate_overflow, a helper function to bin_motifs. It calculates how much of a feature overlaps with the loop region.

To give you an idea of how to use the functions, follow along with this tutorial.

Loading annotator3D

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(annotator3D)
sessionInfo()

Loading Sample Data

First let's load the chromatin loops dataset from ENCODE. It contains predicted loops in the A549 cell line's chromosome 18 (Salameh, et al., 2019).

data("A549ChromLoops")
head(A549ChromLoops)

Now to load a matched feature:

data("matchedMotifs")
head(matchedMotifs)

matchedMotifs contains motifs observed to predict methylation of H3 histones' lysine 9 (Ngo et al., 2019).

Classifying Motifs into Chromatin Loops

For motif classification, simply call the classify function in annotator3D

classify(matchedMotifs, A549ChromLoops)

It creates a local file directory called BEDs where it stores classified motifs as BED files. Each motif will have its own BED file. If you would like to treat all motifs equally, you can simply run concatenate the files contents into a BED master file. For this example, we are working with one motif, however, so we will continue with the output H3K9me3.bed file.

Visualize Classified Motifs

To get the classified annotation track, simply call antrack <- classifiedAnnotationTrack("<path to>/H3K9me3.bed", gen=gen) where

gen <- c("mm10")
names(gen) <- "chr18"

Here thresh refers to a lower bound for loop membership score. You can see the distribution of this score from BED file.

Now, you can layer this track with other Gviz tracks as follows

data("antrack")
library(Gviz)

plotTracks(antrack)

or for the layered Gviz figure

{r layer_gviz} plot_layered_gviz(antrack, gen=gen, from = 1, to = 10000000)

References

Ngo V, Chen Z, Zhang K, Whitaker J, Wang M, Wang W. (2019) Epigenomic analysis reveals DNA motifs regulating histone modifications in human and mouse. PNAS 116(9): 3668--3677.

Salameh TJ, Wang X, Song F, Zhang B, Wright SM, Khunsriraksakul C, Yue F. A supervised learning framework for chromatin loop detection in genome-wide contact maps. biorXiv. doi: https://doi.org/10.1101/739698.



NElnour/3dannotator documentation built on Dec. 12, 2019, 12:55 a.m.