#' hm
#'
#' This function draws heatmap of HiC data so that we can visually compares the imputation results.
#'
#' @param datvec A vector of upper triangular mamtrix.
#' @param n Number of bins.
#' @param title The title of the heatmap.
#'
#' @return Heatmap of the matrix.
#' @export
#'
#' @examples.
#' data("K562_1_true")
#' hm(K562_1_true[,1], 61, title="Expected")
hm <- function(datvec, n, title="Heatmap") {
library(plsgenomics)
normmatrix <- function(matr) {
maxvalue <- max(matr[upper.tri(matr)])
minvalue <- min(matr[upper.tri(matr)])
normmatr <- (matr-minvalue)/(maxvalue-minvalue)
return(normmatr)
}
mat <- matrix(0, n, n)
mat[upper.tri(mat, diag=FALSE)] <- datvec
return(matrix.heatmap(normmatrix(mat), main=title))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.