full2sparse: Transfrom a full Hi-C contact matrix to a sparse upper...

View source: R/matrix_transformations.R

full2sparseR Documentation

Transfrom a full Hi-C contact matrix to a sparse upper triangular matrix

Description

Transfrom a full Hi-C contact matrix to a sparse upper triangular matrix

Usage

full2sparse(mat)

Arguments

mat

A matrix. Must have column names equal to the start location for each bin. i.e. for a 6x6 Hi-C matrix where the first region starts at 0 kb and the final region starts at 500KB and the resolution is 100kb, the column names of the matrix should be as follows: colnames(mat) = c(0, 100000, 200000, 300000, 400000, 500000)

Value

A sparse upper triangular matrix.

Examples

m <- matrix(1:100, 10, 10)
colnames(m) <- 1:10
sparse <- full2sparse(m)
sparse


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