Brick_load_matrix {HiCBricks} | R Documentation

## Load a NxM dimensional matrix into the Brick store.

### Description

Load a NxM dimensional matrix into the Brick store.

### Usage

    Brick_load_matrix(Brick = NULL, chr1 = NULL, chr2 = NULL,
        matrix.file = NULL, delim = " ", exec = 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.
`chr1` | Required. A character vector of length 1 specifying the chromosome corresponding to the rows of the matrix
`chr2` | Required. A character vector of length 1 specifying the chromosome corresponding to the columns 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.
`exec` | Required. A string specifying the program to use for reading the file. Use cat for txt files, for bz2 files use bzcat and for gz files zcat.
`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 read, in each chunk.
`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(Brick = "test.hdf")
    Brick_load_matrix(Brick = Brick.file, chr1 = "chr19", chr2 = "chr19",
    matrix.file = Matrix.file, delim = " ", exec = "cat",
    remove.prior = TRUE)

[Package HiCBricks version 1.0.0 Index]