hic_bin: Bins HiC Reads in a Data Frame into Chromosome-Pair Count...

Description Usage Arguments Value Author(s) Examples

View source: R/hic_bin.R

Description

Bins HiC Reads in a Data Frame into Chromosome-Pair Count Matrices

Usage

1
2
3
4
5
6
hic_bin(
  data,
  bin_size,
  intra_only = FALSE,
  known_chrs = c(1:22, "X", "Y", "M")
)

Arguments

data

An N-by-K data.frame with characters columns chr_a, chr_b, and numeric columns start_a, end_a, start_b, and end_b.

bin_size

(integer) The bin size (in basepairs).

intra_only

(logical) If TRUE, only intra-chromosome pairs are binned.

known_chrs

(character vector) The names of the L chromosomes to bin over.

Value

If intra_only = FALSE, an L-by-L list matrix where each element (i, j) in turn holds an integer matrix of binned counts for chromosome pair (i, j). If intra_only = TRUE, an L list where each element i in turn holds an integer matrix of binned counts for intra-chromosome pair (i, i).

Author(s)

Henrik Bengtsson adopted from a script by Adam Olshen who proposed to use base::table(chr_a, chr_b) for efficient two-dimensional binning.

Examples

1
2
3
4
5
6
7
8
9
pathname <- system.file("compiledData", "human,HAP1,unique,chr=22.rds", package = "TopDomStudy")
reads <- read_rds(pathname)
print(reads)

binned <- hic_bin(reads, bin_size = 100000, intra_only = TRUE)
str(binned)

image(log2(binned[[1]]), axes = FALSE)
box()

HenrikBengtsson/TopDomStudy documentation built on May 14, 2021, 1:49 p.m.