Brick_get_matrix_within_coords {HiCBricks} | R Documentation

## Return a matrix subset between two regions.

### Description

`Brick_get_matrix_within_coords` will fetch a matrix subset after creating an overlap operation between both regions and the bintable associated to the Brick store. This function calls `Brick_get_matrix`.

### Usage

    Brick_get_matrix_within_coords(Brick = NULL, x.coords = NULL,
        y.coords = NULL, force = FALSE, FUN = NULL)

### Arguments

`Brick` | Required. A string specifying the path to the Brick store created with CreateBrick.
`x.coords` | Required. A string specifying the region to subset on the rows. It takes the form chr:start:end. An overlap operation with the associated bintable will be done to identify the bins to subset on the row
`y.coords` | Required. A string specifying the region to subset on the rows. It takes the form chr:start:end. An overlap operation with the associated bintable will be done to identify the bins to subset on the column
`force` | Optional. Default FALSE If true, will force the retrieval operation when matrix contains loaded data until a certain distance.
`FUN` | Optional. If provided a data transformation with FUN will be applied before the matrix is returned.

### Value

Returns a matrix of dimension x.coords binned length by y.coords binned length. This may differ based on FUN.

### See Also

`Brick_get_matrix` to get matrix by using matrix coordinates, `Brick_get_values_by_distance` to get values separated at a certain distance, `Brick_fetch_row_vector` to get values in a certain row/col and subset them, `Brick_get_vector_values` to get values using matrix coordinates.

### Examples

    Brick.file <- system.file("extdata", "test.hdf", package = "HiCBricks")
    Brick_get_matrix_within_coords(Brick = Brick.file,
    x.coords = "chr19:40000:2000000",
    y.coords = "chr19:40000:2000000")

    Brick_get_matrix_within_coords(Brick = Brick.file,
    x.coords = "chr19:40000:2000000",
    y.coords = "chr19:40000:2000000",
    FUN = mean)

    Brick_get_matrix_within_coords(Brick = Brick.file,
    x.coords = "chr19:40000:2000000",
    y.coords = "chr19:40000:2000000",
    FUN = median)

[Package HiCBricks version 1.0.0 Index]