R/run_rstructBio.R

Defines functions .onAttach .check_install run_rstructBio

Documented in run_rstructBio

#' Function to run rstructBio shinyApp
#' @description This function initiates rstructBio GUI
#' @export
#' @examples 
#' # Run rstructBio package
#' # run_rstructBio() 
run_rstructBio <- function(){
  app_path <- .check_install()
  return(shiny::runApp(app_path))
}

.check_install <- function(){
  to_install <- system.file("shinyApp/load_install_pkgs.R",
                            package = "rstructBio")

  cat("\n\n")
  cat("|----------------------------------------------------------------|\n")
  cat("|      **** Welcome to rstructBio version", paste0(utils::packageVersion("rstructBio"),
                                                            " ****             |\n"))
  cat("|----------------------------------------------------------------|\n")
  cat("|      Looking for additional rstructBio dependencies            |\n")
  cat("|                                                                |\n")
  cat("|----------------------------------------------------------------|\n\n\n")

  rtools_inst <- devtools::has_devel()
  if(!rtools_inst){
    if(Sys.info()["sysname"] == "Windows"){
      cat("If you have troubles while running ntbox please install Rtools:\n\n")
      cat("https://cran.r-project.org/bin/windows/Rtools/")
    }
    if(Sys.info()["sysname"] == "Darwin"){
      cat("If you have troubles while running ntbox please install Command Line Tools:\n\n")
      cat("Open terminal and type:\n")
      cat("xcode-select --install")
    }

  }

  app_path <- system.file("shinyApp",package = "rstructBio")
  return(app_path)
}

.onAttach <- function(libname, pkgname) {
  tv <- utils::packageVersion("rstructBio")
  m <- paste0("This is version ", tv, " of the \"rstructBio\" package, for testing only\n")
  packageStartupMessage(m)
}
patauchi/rstructBio documentation built on Sept. 11, 2020, 5:33 p.m.