Description Usage Arguments Value Examples
Maps cells of a contact map given in sparse format to TADs. User must provide interactions data frame and TADs for single and the same chromosome, otherwise the function will throw an error or behaviour will undefined.
1 | interactions2tads(mtx.sparse, tads, cols = c("val"))
|
mtx.sparse |
data.frame with Hi-C contact map in sparse format; must have i and j columns, i.e. cell coordinates |
tads |
data frame containg TADs, for single chromosome; it is assumed that first TAD on every chromosome start at 0 and end of TAD equals start of next TAD (in case if there is no break between consecutive TADs); also user is responsible for converting TAD boundary coordinates to bins |
cols |
character vector with columns from mtx.sparse or tads data.frames to be included in resulting data frame; by default only val column is included |
data.frame with following columns: i, j, val, tad.id, start, end, name (and additional if cols specified), where each row corresponds to cell in Hi-C contact map with i, j coordinates and cells are assigned to TADs (cells which do not belong to any TAD are discarded)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # create artificial interactions set
sparse.mtx <- data.frame(i = c(1,3,4,4,8,9,11), j = c(7,2,4,5,3,10,9), val = c(10,8,3,1,1,2,20), compartment = c("AA","AA","AB","AB","BB","BB","AB"))
# create artificial TAD set in 20000 bp resolution
resolution <- 20000
tads <- data.frame(start = c(0,2,10) * resolution, end = c(2,8,13) * resolution, name = as.character(c(1,1,1)))
print(tads)
# convert basepairs to bins
tads$start <- tads$start / resolution
tads$end <- tads$end / resolution
print(tads)
# map interactions to TADs
interactions2tads(sparse.mtx, tads)
# map interactions to TADs and keep also compartment columns
interactions2tads(sparse.mtx, tads, cols = c("val","compartment"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.