Description Usage Arguments Details Value Author(s) See Also Examples
Compute area in the interaction space for each pair of regions.
1 |
data |
an InteractionSet object |
bp |
a logical scalar indicating whether areas should be reported in base-pair terms |
The getArea
function returns the area in the interaction space for each pair of regions.
If bp=TRUE
, the area is reported in terms of squared base pairs.
This tends to be the easiest to interpret.
Otherwise, the area is reported as the number of pairs of restriction fragments.
This may be more relevant to the actual resolution of the Hi-C experiment.
Some special consideration is required for areas overlapping the diagonal. This is because counting is only performed on one side of the diagonal, to avoid redundancy. Base-pair areas are automatically adjusted to account for this feature, based on the presence of partial overlaps between interacting regions.
For fragment-based areas, some additional work is required to properly compute areas around the diagonal for partially overlapping regions.
This is only necessary when data
is produced by connectCounts
.
This is because bins will not partially overlap in any significant manner when counts are generated with squareCounts
.
A numeric vector is returned containing the area in the interaction space for each pair of regions in data
.
Aaron Lun
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Making up an InteractionSet for binned data.
nfrags <- 50
frag.sizes <- as.integer(runif(nfrags, 5, 10))
ends <- cumsum(frag.sizes)
cuts <- GRanges("chrA", IRanges(c(1, ends[-nfrags]+1), ends))
param <- pairParam(cuts)
regions <- diffHic:::.assignBins(param, 20)$region
all.combos <- combn(length(regions), 2)
y <- InteractionSet(matrix(0, ncol(all.combos), 1),
GInteractions(anchor1=all.combos[2,], anchor2=all.combos[1,],
regions=regions, mode="reverse"),
colData=DataFrame(lib.size=1000), metadata=List(param=param, width=20))
# Generating partially overlapping regions.
set.seed(3424)
re <- sample(nfrags, 20)
rs <- as.integer(runif(20, 1, re+1))
regions <- GRanges("chrA", IRanges(start(cuts)[rs], end(cuts)[re]))
regions$nfrags <- re - rs + 1L
regions <- sort(regions)
all.combos <- combn(length(regions), 2)
y2 <- InteractionSet(matrix(0, ncol(all.combos), 1),
GInteractions(anchor1=all.combos[2,], anchor2=all.combos[1,],
regions=regions, mode="reverse"),
colData=DataFrame(lib.size=1000), metadata=List(param=param))
#### Getting areas. ####
getArea(y)
getArea(y, bp=FALSE)
getArea(y2)
getArea(y2, bp=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.