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 = NULL, chr = NULL,
        matrix.file = NULL, delim = " ", distance = NULL,
        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 = "test.hdf", exec = "cat",
    remove.existing = TRUE)

    Test.mat <- matrix(NA,nrow = 800, ncol = 800)
    Row <- row(Test.mat)
    Col <- col(Test.mat)
    Dist <- Col - Row
    Matrix.file <- "Test_matrix.txt"
    write.table(x = Dist, file = Matrix.file, sep = " ", quote = FALSE,
    row.names = FALSE, col.names = FALSE)
    Brick.file <- Brick_path_to_file("test.hdf")
    Brick_load_cis_matrix_till_distance(Brick = Brick.file, chr = "chr19",
    matrix.file = Matrix.file, delim = " ", distance = 200, remove.prior = TRUE)

[Package HiCBricks version 1.0.0 Index]