readHic: Read a .hic file and return Hi-C data as a dataframe

View source: R/readHic.R

readHicR Documentation

Read a .hic file and return Hi-C data as a dataframe

Description

Read a .hic file and return Hi-C data as a dataframe

Usage

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
)

Arguments

file

A character value specifying the path to the .hic file.

chrom

Chromosome of data, as a string.

chromstart

Integer start position on chromosome.

chromend

Integer end position on chromosome.

altchrom

Alternate chromosome for interchromosomal data, as a string.

altchromstart

Alternate chromosome integer start position for interchromosomal data.

altchromend

Alternate chromosome integer end position for interchromosomal data.

assembly

Default genome assembly as a string or a assembly object. Default value is assembly = "hg38".

resolution

A numeric specifying the width of each pixel. "auto" will attempt to choose a resolution in basepairs based on the size of the region.

res_scale

A character value specifying the resolution scale. Default value is res_scale = "BP". Options are:

  • "BP": Base pairs.

  • "FRAG": Fragments.

zrange

A numeric vector of length 2 specifying the range of interaction scores, where extreme values will be set to the max or min.

norm

Character value specifying hic data normalization method. This value must be found in the .hic file. Default value is norm = "KR".

matrix

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.

params

An optional pgParams object containing relevant function parameters.

quiet

A logical indicating whether or not to print messages.

Value

Returns a 3-column dataframe in sparse upper triangular format with the following columns: chrom, altchrom, counts.

See Also

straw

Examples

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 region `chr22:20000000-47500000` at 100 Kb resolution
hicData10Kb <- readHic(file = hicFile, chrom = "22",
                        chromstart = 20000000, chromend = 47500000,
                        assembly = "hg19",
                        resolution = 100000)                     


PhanstielLab/BentoBox documentation built on June 30, 2024, 12:50 p.m.