cooler2sparse: Transform a .cool file to a sparse upper triangular matrix...

View source: R/matrix_transformations.R

cooler2sparseR Documentation

Transform a .cool file to a sparse upper triangular matrix for input into hic_loess

Description

Transform a .cool file to a sparse upper triangular matrix for input into hic_loess

Usage

cooler2sparse(cooler)

Arguments

cooler

The plain text file from a .cool file loaded into an R data.frame object. See vignette for more details.

Details

The .cool format is linked a database of Hi-C experiments and allows access to many sets of Hi-C data which can be found at the Index of Coolers ftp://cooler.csail.mit.edu/coolers. Once a .cool file is dumped into a contact matrix in plain text it can be read into R. This function provides a method for converting the .cool matrix into a sparse upper triangular matrix ready to be entered into hic_loess.

Value

A Sparse upper triangular matrix or a list of sparse upper triangular matrices. If the .cool file contains data for more than one chromosome The function will split the data up into a list of matrices, one per chromosome.

Examples

data('cooler')
sparse <- cooler2sparse(cooler)
head(sparse)

dozmorovlab/HiCcompare documentation built on June 30, 2023, 3:09 a.m.