Brick_load_cis_matrix_till_distance {HiCBricks}R Documentation

Load a NxN dimensional sub-distance cis matrix into the Brick store.

Description

Load a NxN dimensional sub-distance cis matrix into the Brick store.

Usage

Brick_load_cis_matrix_till_distance(Brick, chr, matrix.file, delim = " ",
    distance, remove.prior = FALSE, num.rows = 2000, is.sparse = FALSE,
    sparsity.bins = 100)

Arguments

Brick

Required. A string specifying the path to the Brick store created with CreateBrick.

chr

Required. A character vector of length 1 specifying the chromosome corresponding to the rows and cols of the matrix

matrix.file

Required. A character vector of length 1 specifying the name of the file to load as a matrix into the Brick store.

delim

Optional. Default " " The delimiter of the matrix file.

distance

Required. Default NULL. For very high-resolution matrices, read times can become extremely slow and it does not make sense to load the entire matrix into the data structure, as after a certain distance, the matrix will become extremely sparse. This ensures that only interactions upto a certain distance from the main diagonal will be loaded into the data structure.

remove.prior

Optional. Default FALSE If a matrix was loaded before, it will not be replaced. Use remove.prior to override and replace the existing matrix.

num.rows

Optional. Default 2000 Number of rows to insert per write operation in the HDF file.

is.sparse

Optional. Default FALSE If true, designates the matrix as being a sparse matrix, and computes the sparsity.index. The sparsity index measures the proportion of non-zero rows or columns at a certain distance from the diagonal (100) in cis interaction matrices.

sparsity.bins

Optional. Default 100 With regards to computing the sparsity.index, this parameter decides the number of bins to scan from the diagonal.

Value

Returns TRUE if all went well.

Examples


Bintable.path <- system.file("extdata",
"Bintable_40kb.txt", package = "HiCBricks")
Chromosomes <- "chr19"
Path_to_cached_file <- CreateBrick(ChromNames = Chromosomes,
BinTable = Bintable.path, bin.delim = " ",
Output.Filename = file.path(tempdir(),"test.hdf"), exec = "cat",
remove.existing = TRUE)

Test.mat <- matrix(runif(800*800),nrow = 800, ncol = 800)
Matrix.file <- file.path(tempdir(),"Test_matrix.txt")
write.table(x = Test.mat, file = Matrix.file, sep = " ", quote = FALSE,
row.names = FALSE, col.names = FALSE)
Brick_load_cis_matrix_till_distance(Brick = Path_to_cached_file, 
chr = "chr19", matrix.file = Matrix.file, delim = " ", 
distance = 200, remove.prior = TRUE)


[Package HiCBricks version 1.2.0 Index]