readHiC {TopDom} | R Documentation |
Reads Hi-C Contact Data from File
Description
Reads Hi-C Contact Data from File
Usage
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 |
... |
Arguments passed to |
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:
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
Examples
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)