R/docker_pull_pwiz.R

Defines functions docker_pull_pwiz

Documented in docker_pull_pwiz

#' @title docker_pull_pwiz
#' @description Pull docker pwiz image
#' @docType methods
#' @author Xiaotao Shen
#' \email{shenxt1990@@outlook.com}
#' @param force Force to install pwiz
#' @return docker pwiz image
#' @export

docker_pull_pwiz <- function(force = FALSE) {
  ###check docker is available or not
  if (!stevedore::docker_available(verbose = FALSE)) {
    stop("Please install docker first (https://www.docker.com/get-started).\n")
  }
  
  ##construct an object with which we can talk with the docker server
  docker <- stevedore::docker_client()
  ###what images we have had in docker
  images <- docker$image$list()
  
  ###check if we have pwiz image or not
  pwiz_available <-
    any(
      unlist(images$repo_tags) ==
        "chambm/pwiz-skyline-i-agree-to-the-vendor-licenses:latest"
    )
  
  ###if force is true
  if (force) {
    docker$image$pull('chambm/pwiz-skyline-i-agree-to-the-vendor-licenses')
    message("Done.")
  } else{
    if (pwiz_available) {
      message("You have installed pwiz.")
    } else{
      docker$image$pull('chambm/pwiz-skyline-i-agree-to-the-vendor-licenses')
      message("Done.")
    }
    
  }
}
tidymass/massconverter documentation built on Sept. 25, 2022, 1:53 p.m.