readHiC: Reads Hi-C Contact Data from File

Description Usage Arguments Value Format of HiC contact-matrix file See Also Examples

View source: R/readHiC.R

Description

Reads Hi-C Contact Data from File

Usage

1
2
3
4
5
6
7
readHiC(
  file,
  chr = NULL,
  binSize = NULL,
  ...,
  debug = getOption("TopDom.debug", FALSE)
)

Arguments

file

The pathname of a normalize Hi-C contact matrix file stored as a whitespace-delimited file. See below for details. Also a gzip-compressed file can be used.

chr, binSize

If the file contains a count matrix without bin annotation, the latter is created from these parameters.

debug

If TRUE, debug output is produced.

...

Arguments passed to utils::read.table() as-is.

Value

A list with elements bins (an N-by-4 data.frame) and counts (N-by-N matrix).

Format of HiC contact-matrix file

The contact-matrix file should be a whitespace-delimited text file with neither row names nor column names. The content should be a N-by-(3+N) table where the first three columns correspond to chr (string), from.coord (integer position), and to.coord (integer position). These column defines the genomic location of the N Hi-C bins (in order). The last N columns should contain normalized contact counts (float) such that element (r,3+c) in this table corresponds to count (r,c) in the normalized contact matrix.

If an N-by-(4+N) table, then the first column is assumed to contain an id (integer), and everything else as above.

Example:

1
2
3
4
5
  chr10       0   40000  0 0 0 0 ...
  chr10   40000   80000  0 0 0 0 ...
  chr10   80000  120000  0 0 0 0 ...
  chr10  120000  160000  0 0 0 0 ...
  ...

See Also

TopDom.

Examples

1
2
3
4
5
6
7
8
path <- system.file("exdata", package = "TopDom", mustWork = TRUE)

## Original count data
chr <- "chr19"
pathname <- file.path(path, sprintf("nij.%s.gz", chr))
data <- readHiC(pathname, chr = chr, binSize = 40e3)
print(data)
str(data)

TopDom documentation built on May 6, 2021, 9:07 a.m.