#' @title Read Binner
#'
#' @description
#' Description
#'
#' @param f_tmp_dir Project enviorment option
#' @param f_tmp_file Project enviorment option
#' @param f_Chromosome Project enviorment option
#' @param ge_hit_df Project enviorment option
#' @param ge_bin_overlaps Project enviorment option
#' @param ge_bin_size Project enviorment option
#'
#' @return
#' Return
#'
#' @seealso \code{genomic_count}
#' @seealso \code{peak_linker}
#'
#' @importFrom data.table :=
#' @export
rd_binner <- function(
f_tmp_dir,
f_tmp_file,
f_Chromosome,
ge_hit_df,
ge_bin_overlaps,
ge_bin_size
) {
depth_file <- data.table::fread(
paste0(f_tmp_dir, f_tmp_file, "_cv_chr", f_Chromosome, ".txt"),
col.names = c('Chr', 'bp', 'rd')
)
out_val <- tibble::as_tibble(ge_hit_df[ge_hit_df$Chr == f_Chromosome, "Chr"])
tmp_ls <- list()
for ( over in 1:ge_bin_overlaps ) {
#
step_size <- ge_bin_size * ( (over - 1) / ge_bin_overlaps )
depth_file[, Positions := CopperGenomicFunctions::slid_win( (depth_file[, .(bp)] + step_size), ge_bin_size ) - step_size]
tmp_ls[[over]] <- stats::aggregate(rd ~ Positions, data = depth_file, FUN = mean)
}
tmp_mean <- CopperGenomicFunctions::concat_ls(tmp_ls)
out_val[, 2:3] <- tmp_mean[match(ge_hit_df[ge_hit_df$Chr == f_Chromosome, ]$Positions, tmp_mean$Positions), ]
return(out_val)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.