R/chr_functions.R

Defines functions chr2chrom chrom2chr chrLoad

Documented in chr2chrom chrLoad chrom2chr

chrLoad <- function(genome = "hg19") {
  if(is.null(genome)) stop("Please provide a genome build (by example : 'hg19') !")
  try(data(genome))
}

chrom2chr <- function(cs = NULL, chromvalues=NULL) {
  if (is.null(cs)) stop("Please provide a 'cs' object !")
  if (is.null(chromvalues)) stop("Please provide a vector of Chrom values !")
  if(any(!is.character(chromvalues))) stop("the vector of Chrom values should only contain character data !")
  return(unlist(cs$chrom2chr[chromvalues]))
}

chr2chrom <- function(cs = NULL, chrvalues=NULL) {
  if (is.null(cs)) stop("Please provide a 'cs' object !")
  if (is.null(chrvalues)) stop("Please provide a vector of Chr (numeric) values !")
  if(any(!is.numeric(chrvalues))) stop("the vector of Chr values should only contain numeric data !")
  return(unlist(cs$chr2chrom[chrvalues]))
}
aoumess/chromosomes documentation built on Dec. 19, 2021, 3:41 a.m.