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, chr1, chr2, matrix.file, delim = " ", exec,
        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 = 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_matrix(Brick = Path_to_cached_file, chr1 = "chr19",
    chr2 = "chr19", matrix.file = Matrix.file, delim = " ", exec = "cat",
    remove.prior = TRUE)

[Package HiCBricks version 1.2.0 Index]