hic.file <- system.file("exdata", "hic_sort.bam", package="diffHic")
cuts <- readRDS(system.file("exdata", "cuts.rds", package="diffHic"))
param <- pairParam(fragments=cuts)
# Setting up the parameters
fout <- "output.h5"
invisible(preparePairs(hic.file, param, file=fout))
# Collating to count combinations.
y <- neighborCounts(fout, param, width=50, filter=2,
flank=5, prior.count=2)
y
mcols(y)$enrichment
# Practically identical to a more memory-intensive call.
ref <- squareCounts(fout, param, width=50, filter=1)
keep <- rowSums(assay(ref)) >= 2
enriched <- enrichedPairs(ref, flank=5, prior.count=2)
stopifnot(identical(anchors(ref[keep,]), anchors(y)))
stopifnot(all(abs(enriched[keep] - mcols(y)$enrichment) < 1e-6))
Run the code above in your browser using DataLab