Brick_load_data_from_mcool {HiCBricks} | R Documentation

## Load a NxN dimensional matrix into the Brick store from an mcool file.

### Description

Read an mcool contact matrix coming out of 4D nucleome projects into a Brick store.

### Usage

    Brick_load_data_from_mcool(Brick, mcool, chr1, chr2, binsize = NULL,
        cooler.batch.size = 1e+06, matrix.chunk = 2000,
        dont.look.for.chr2 = FALSE, remove.prior = FALSE,
        norm.factor = "Iterative-Correction")

### Arguments

`Brick` | Required. A string specifying the path to the Brick store created with CreateBrick.
`mcool` | Required. Path to an mcool file.
`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
`binsize` | Optional. The binsize to select from an mcool file.
`cooler.batch.size` | Optional. Default 1000000. The number of values to read per iteration through a mcool file.
`matrix.chunk` | Optional. Default 2000. The nxn matrix square to fill per iteration in a mcool file.
`dont.look.for.chr2` | Required. At startup, the function will attempt to search for the first occurence of a chr2 contact value. This is done to avoid the reading of all chr1 values for every chunk processed. If chr1 and chr2 are equivalent, consider setting it to FALSE.
`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.
`norm.factor` | Optional. Default "Iterative-Correction". The normalization factor to use for normalization from an mcool file. norm.factor currently accepts one of "Iterative-Correction", "Knight-Ruitz", "Vanilla-coverage", "Vanilla-coverage-square-root" and NULL. If NULL, the function will load only counts from the mcool file.

### Value

Returns TRUE if all went well.

### See Also

`CreateBrick_from_mcool` to create matrix from an mcool file, `Brick_list_mcool_resolutions` to list available resolutions in an mcool file, `Brick_list_mcool_normalisations` to list available normalisation factors in the mcool file.

### Examples

    ## Not run:

    require(curl)
    curl_download(url = paste("https://data.4dnucleome.org/"
    "files-processed/4DNFI7JNCNFB/"
    "@download/4DNFI7JNCNFB.mcool",sep = ""),
    destfile = file.path(tempdir(),"H1-hESC-HiC-4DNFI7JNCNFB.mcool"))

    Output.brick <- file.path(tempdir(),
     "H1-hESC-HiC-4DNFI7JNCNFB-10000-ICE-normalised-chr1.brick")
    mcool <- file.path(tempdir(),"H1-hESC-HiC-4DNFI7JNCNFB.mcool")

    CreateBrick_from_mcool(Brick = Output.brick,
    mcool = mcool,
    binsize = 10000,
    chrs = "chr1")

    Brick_load_data_from_mcool(Brick = Output.brick, mcool = mcool,
    chr1 = "chr1", chr2 = "chr1", binsize = 10000,
    cooler.batch.size = 1000000, matrix.chunk = 2000,
    dont.look.for.chr2 = TRUE, remove.prior = TRUE,
    norm.factor = "Iterative-Correction")

    ## End(Not run)

[Package HiCBricks version 1.2.0 Index]