-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from pawelqs/develop
Develop
- Loading branch information
Showing
29 changed files
with
581 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ tests/testthat/Rplots.pdf | |
inst/develop_file* | ||
|
||
inst/doc | ||
Rplots.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: cevomod | ||
Title: Cancer Evolution Models | ||
Version: 2.2.0 | ||
Version: 2.3.0 | ||
Authors@R: | ||
person("Paweł", "Kuś", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0002-4367-9821")) | ||
|
@@ -31,7 +31,8 @@ Suggests: | |
tidyverse, | ||
vdiffr, | ||
readthis, | ||
rsample | ||
rsample, | ||
processx | ||
Config/testthat/edition: 3 | ||
VignetteBuilder: knitr | ||
Imports: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
settings_dir <- tools::R_user_dir("cevomod", which = "config") | ||
settings_file <- file.path(settings_dir, "settings.rds") | ||
|
||
default_settings <- list( | ||
containers_dir = NULL | ||
) | ||
|
||
|
||
get_settings <- function() { | ||
if (file.exists(settings_file)) { | ||
readRDS(settings_file) | ||
} else { | ||
default_settings | ||
} | ||
} | ||
|
||
|
||
#' Get/Set the containers directory | ||
#' @param dir Path for containers | ||
#' @export | ||
set_containers_dir <- function(dir) { | ||
settings <- get_settings() | ||
settings$containers_dir <- dir | ||
|
||
if(!dir.exists(settings_dir)) { | ||
dir.create(settings_dir) | ||
} | ||
write_rds(settings, settings_file) | ||
} | ||
|
||
|
||
#' @rdname set_containers_dir | ||
#' @export | ||
get_containers_dir <- function() { | ||
get_settings()$containers_dir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#' Build the CliP Apptainer container | ||
#' | ||
#' CliP.sif is saved to | ||
#' - out_dir, if provided | ||
#' - if out_dir is NULL but the containers_dir was set using the [set_containers_dir()], | ||
#' image will be saved to the set containers_dir. | ||
#' - if out_dir is NULL and the containers_dir was not set, image will | ||
#' be saved to the current working dir. | ||
#' @param out_dir Path | ||
#' @param force Force build in image exists | ||
#' @export | ||
build_clip_container <- function(out_dir = NULL, force = FALSE) { | ||
if (!is_apptainer_installed()) { | ||
stop("Apptainer needs to be installed to build the containers") | ||
} | ||
|
||
if (is.null(out_dir) & !is.null(get_containers_dir())) { | ||
out_dir <- get_containers_dir() | ||
} else { | ||
out_dir <- "." | ||
} | ||
|
||
sif_file <- file.path(out_dir, "CliP.sif") |> | ||
str_replace("//", "/") | ||
|
||
if (!file.exists(sif_file) | force) { | ||
def_file <- system.file("CliP.def", package = "cevomod") | ||
command <- str_c("apptainer build", sif_file, def_file, sep = " ") | ||
system(command) | ||
} else { | ||
msg(sif_file, " exists. Set force = TRUE to overwrite it") | ||
} | ||
} | ||
|
||
|
||
is_apptainer_installed <- function() { | ||
rlang::check_installed("processx", reason = "to interact with system") | ||
x <- processx::run("apptainer", args = "--version") | ||
x$status == 0 | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.