Read a .hic file and return Hi-C data as a dataframe
readHic(
file,
chrom,
chromstart = NULL,
chromend = NULL,
altchrom = NULL,
altchromstart = NULL,
altchromend = NULL,
assembly = "hg38",
resolution = "auto",
res_scale = "BP",
zrange = NULL,
norm = "KR",
matrix = "observed",
params = NULL,
quiet = FALSE
)
A character value specifying the path to the .hic file.
Chromosome of data, as a string.
Integer start position on chromosome.
Integer end position on chromosome.
Alternate chromosome for interchromosomal data, as a string.
Alternate chromosome integer start position for interchromosomal data.
Alternate chromosome integer end position for interchromosomal data.
Default genome assembly as a string or a
assembly object.
Default value is assembly = "hg38"
.
A numeric specifying the width of each pixel. "auto" will attempt to choose a resolution in basepairs based on the size of the region.
A character value specifying the resolution scale.
Default value is res_scale = "BP"
. Options are:
"BP"
: Base pairs.
"FRAG"
: Fragments.
A numeric vector of length 2 specifying the range of interaction scores, where extreme values will be set to the max or min.
Character value specifying hic data normalization method.
This value must be found in the .hic file.
Default value is norm = "KR"
.
Character value indicating the type of matrix to output.
Default value is matrix = "observed"
. Options are:
"observed"
: Observed counts.
"oe"
: Observed/expected counts.
"log2oe"
: Log2 transformed observed/expected counts.
An optional pgParams object containing relevant function parameters.
A logical indicating whether or not to print messages.
Returns a 3-column dataframe in sparse upper triangular
format with the following columns: chrom
, altchrom
,
counts
.
hicFile <- system.file("extdata/test_chr22.hic", package="plotgardenerData")
## Read in data for all chr22 file at 2.5Mb bp resolution
hicData <- readHic(file = hicFile, chrom = "22",
assembly = "hg19",
resolution = 2500000)
#> Read in hic file with KR normalization at 2500000 BP resolution.
## Read in region `chr22:20000000-47500000` at 100 Kb resolution
hicData10Kb <- readHic(file = hicFile, chrom = "22",
chromstart = 20000000, chromend = 47500000,
assembly = "hg19",
resolution = 100000)
#> Read in hic file with KR normalization at 1e+05 BP resolution.