R/utilities.R

Defines functions prepareTxDb

#' @importFrom txdbmaker makeTxDbFromGFF
prepareTxDb <- function(gtf, param='gtf', ...){
  txdb <- NULL
  if(is(gtf, "TxDb")){
    txdb <- gtf
  }else{
    if(is.character(gtf)){
      gtf <- gtf[1]
      suppressWarnings(suppressMessages(txdb <- makeTxDbFromGFF(gtf, ...)))
    }
  }
  if(!is(txdb, "TxDb")){
    stop("Can not determine annotations from ", param, " parameter.")
  }
  return(txdb)
}
jianhong/ribosomeProfilingQC documentation built on Nov. 3, 2024, 6:33 p.m.