R/is_samtools_installed.R

Defines functions is_samtools_installed

is_samtools_installed <- function() {
  # test if a valid samtools version is installed
  tryCatch({
    sys_out <-
      system("samtools help", intern = TRUE)
  }, error = function(e)
    stop(
      "It seems like you don't have samtools installed locally on your machine or the PATH variable to the samtools program is not set correctly. Please install samtools (http://www.htslib.org/download/) before running this command.",
      call. = FALSE
    ))
  
  if (any(stringr::str_detect(sys_out[2], "samtools")))
    return(TRUE)
  
}
HajkD/metablastr documentation built on Sept. 14, 2023, 5:26 p.m.