Brick_get_values_by_distance {HiCBricks}R Documentation

Return values separated by a certain distance.

Description

Brick_get_values_by_distance can fetch values with or without transformation or subsetted by a certain distance. Please note, this module is not an iterable module.

Usage

Brick_get_values_by_distance(Brick, chr, distance,
    constrain.region = NULL, batch.size = 500, FUN = NULL)

Arguments

Brick

Required. A string specifying the path to the Brick store created with CreateBrick.

chr

Required. A string specifying the chromosome for the cis Hi-C matrix from which values will be retrieved at a certain distance.

distance

Required. 0 based. Fetch values separated by distance.

constrain.region

Optional. A character vector of length 1 with the form chr:start:end specifying the region for which the distance values must be retrieved.

batch.size

Optional. Default 500 A numeric vector of length 1 specifying the size of the chunk to retrieve for diagonal selection.

FUN

Optional. If provided a data transformation with FUN will be applied before values are returned.

Value

Returns a numeric vector of length N depending on the presence of constrain.region, FUN and distance from the main diagonal.

See Also

Brick_get_matrix_within_coords to get matrix by using matrix coordinates, 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, Brick_get_matrix to get matrix by using matrix coordinates.

Examples

Brick.file <- system.file("extdata", "test.hdf", package = "HiCBricks")
Brick_get_values_by_distance(Brick = Brick.file, chr = "chr19",
distance = 0)

Failsafe_median <- function(x){
     x[is.nan(x) | is.infinite(x) | is.na(x)] <- 0
     return(median(x))
}

Brick.file <- system.file("extdata", "test.hdf", package = "HiCBricks")
Brick_get_values_by_distance(Brick = Brick.file, chr = "chr19",
distance = 4, FUN = Failsafe_median)


[Package HiCBricks version 1.2.0 Index]