extractPatch | R Documentation |
Extract and count read pairs into bin pairs for a subset of the interaction space.
extractPatch(file, param, first.region, second.region=first.region,
width=10000, restrict.regions=FALSE)
file |
character string specifying the path to an index file produced by |
param |
a |
first.region |
a |
second.region |
a |
width |
an integer scalar specifying the width of each bin in base pairs |
restrict.regions |
A logical scalar indicating whether the output regions should be limited to entries in |
This function behaves much like squareCounts
, but only for the “path” of the interaction space defined by first.region
and second.region
.
Read pairs are only counted into bin pairs where one end overlaps first.region
and the other end overlaps second.region
.
This allows for rapid extraction of particular regions of interest without having to count across the entire interaction space.
Note that the first anchor region (i.e., bin) in each bin pair is not necessarily the bin that overlaps first.region
.
In each pair, the bins are sorted so that the first bin has a higher genomic coordinate than the second bin.
The flipped
flag in the metadata of the output object indicates whether this order is flipped.
If TRUE
, the first bin in each pair corresponds to second.region
, and vice versa.
If restrict.regions=TRUE
, only bins on the chromosomes in first.region
and second.region
will be reported in the regions
slot of the output object.
This avoids the overhead of constructing many bins when only a small subset of them are used.
By default, restrict.regions=FALSE
to ensure that the anchor IDs of the output object are directly comparable between different calls to extractPatch
.
An InteractionSet object containing the number of read pairs for each bin pair in the specified patch.
Aaron Lun
squareCounts
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 <- tempfile(fileext=".h5")
invisible(preparePairs(hic.file, param, file=fout))
stuff <- extractPatch(fout, param, GRanges("chrA:1-100"))
interactions(stuff)
stuff <- extractPatch(fout, param, GRanges("chrA:1-100"), GRanges("chrB:1-20"))
interactions(stuff)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.