RWire is an R package for the correlation analysis of single-cell ATAC-seq data. This vignette shows how to use it to calculate accessibility matrices and correlation matrices, which contain information on co-regulated genomic regions. For further information see the 'sample-scripts' folder.
RWire can be installed by starting R and typing:
install.packages("devtools") devtools::install_github("FabianErdel/RWire")
The following libraries are required to run the analysis:
library("ggplot2") library("data.table") library("GenomicRanges") library("RWire")
The sample data provided with this package contain counts from 100 human B cells in the genomic region surrounding the TCF4 gene on chromosome 18.
path <- system.file("extdata", package = "RWire")
With the following function, 1 kb-tiles for chromosome 18 are generated, which can be used with the sample data.
tiles <- makeTiles(18)
The following function makes an accessibility matrix based on the BED files located in the folder 'path'. The entries of this matrix correspond to the number of integrations in a given genomic region and cell.
# make accessibility matrix from a set of BED files am <- makeAccMatrix(path, tiles) # remove empty rows am <- removeEmptyRows(am)
The following code creates histograms for the number of integrations per cell and for the 'number of cells with integrations' per genomic region, and retrieves some basic information about the distributions. This information can be useful to detect outliers and to assess the overall data quality.
hist_ipc <- makeIPCHist(am) print(hist_ipc) makeIPCStats(am) hist_ipr <- makeIPRHist(am) print(hist_ipr[[1]]) makeIPRStats(am)
This function creates a correlation matrix, which contains a Pearson correlation coefficient for each pair-wise combination of genomic regions. Entry (i, j) contains the correlation coefficient for regions i and j.
cor <- makeCorMatrix(am)
This function creates a correlation matrix with genomic positions on its axes, i.e., entry (i, j) contains the average of the pair-wise correlation coefficients for the regions in genomic bin i and genomic bin j.
chr <- 18 size <- 200 scm <- scaleCorMatrix(cor, chr, size)
This function makes a graphical representation of the correlation matrix.
saveImage(scm, "your_path", size, size, getCorLUT(), -1, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.