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 = NA,
        chr = NA,
        resolution = NA,
        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 Create_many_Brick.
`chr` | Required. A character vector of length 1 specifying the chromosome corresponding to the rows and cols of the matrix
`resolution` | Optional. Default NA When an object of class BrickContainer is provided, resolution defines the resolution on which the function is executed
`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(file.path("extdata", "Bintable_100kb.bins"),
    package = "HiCBricks")

    out_dir <- file.path(tempdir(), "matrix_load_dist_test")
    dir.create(out_dir)

    My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path,
      bin_delim = " ", output_directory = out_dir, file_prefix = "Test",
      experiment_name = "Vignette Test", resolution = 100000,
      remove_existing = TRUE)

    Matrix_file <- system.file(file.path("extdata",
    "Sexton2012_yaffetanay_CisTrans_100000_corrected_chr2L.txt.gz"),
    package = "HiCBricks")

    Brick_load_cis_matrix_till_distance(Brick = My_BrickContainer,
    chr = "chr2L", resolution = 100000, matrix_file = Matrix_file,
    delim = " ", distance = 30, remove_prior = TRUE)

[Package HiCBricks version 1.6.0 Index]