R/distance_func.R

Defines functions distance_func

Documented in distance_func

#' Helper function used to create (log2) distance type feature space
#'
#' @param binned_data_center_gr A GRanges object of width 1
#' @param annot_data_center_gr A GRanges object of width 1
#'
#' @return A vector of log2 distances to the nearest overlap
#'
#' @import IRanges GenomicRanges
#'
distance_func <- function(binned_data_center_gr, annot_data_center_gr) {

    # distance from center of genomic bin to nearest genomic region of interest
    dist <- mcols(distanceToNearest(binned_data_center_gr, annot_data_center_gr))$distance

    return(dist)
}

Try the preciseTAD package in your browser

Any scripts or data that you put into this service are public.

preciseTAD documentation built on Nov. 8, 2020, 6:51 p.m.