R/listResolutions.R

Defines functions listResolutions

Documented in listResolutions

#' List the available resolutions
#' @description List the resolutions available in the file.
#' @param file character(1). File name of .hic or .cool/.mcool/.scool
#' @param format character(1). File format, "hic" or "cool".
#' @importFrom rhdf5 H5Fopen h5ls
#' @importFrom strawr readHicBpResolutions
#' @export
#' @examples
#' hicfile <- system.file("extdata", "test_chr22.hic", package="trackViewer")
#' listResolutions(hicfile)
#' coolfile <- system.file("extdata", "test.mcool", package="trackViewer")
#' listResolutions(coolfile, format="cool")
listResolutions <- function(file, format=c("hic", "cool")){
  format <- match.arg(format)
  guessFormat(file, format)
  if(format=="hic"){
    readHicBpResolutions(fname=file)
  }else{
    coolfile <- checkCoolFile(file)
    coolfileRootName <- coolfileRootName(coolfile)
    h5ls(coolfile&coolfileRootName, recursive = FALSE)$name
  }
}
jianhong/trackViewer documentation built on June 23, 2024, 7:18 p.m.