Skip to content

Commit

Permalink
Add a deprecation message
Browse files Browse the repository at this point in the history
  • Loading branch information
bodkan committed Jul 20, 2022
1 parent 252e6df commit adf4e0d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
18 changes: 15 additions & 3 deletions R/compilation.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ compile_model <- function(populations, generation_time, path = NULL, resolution
simulation_length = NULL, direction = NULL,
slim_script = NULL, description = "", sim_length = NULL) {
if (is.null(simulation_length) && !is.null(sim_length)) {
message("Argument `sim_length` will soon be deprecated in favor of `simulation_length`.")
warning("Argument `sim_length` will soon be deprecated in favor of `simulation_length`.", call. = FALSE)
simulation_length <- sim_length
}

Expand Down Expand Up @@ -316,6 +316,7 @@ read_model <- function(path) {
#' will be saved (most likely for use with \code{animate_model}).
#' @param slim_path Optional way to specify path to an appropriate SLiM binary (this is useful
#' if the \code{slim} binary is not on the \code{$PATH}).
#' @param sampling Deprecated in favor of \code{samples}.
#'
#' @return A tree-sequence object loaded via Python-R reticulate interface function \code{ts_load}
#' (internally represented by the Python object \code{tskit.trees.TreeSequence})
Expand Down Expand Up @@ -359,7 +360,7 @@ slim <- function(
model, sequence_length, recombination_rate, samples = NULL, output = NULL,
burnin = 0, max_attempts = 1, spatial = !is.null(model$world), coalescent_only = TRUE,
method = c("batch", "gui"), random_seed = NULL, verbose = FALSE, load = TRUE,
locations = NULL, slim_path = NULL
locations = NULL, slim_path = NULL, sampling = NULL
) {
method <- match.arg(method)

Expand All @@ -382,6 +383,11 @@ slim <- function(
if (!is.numeric(recombination_rate) | recombination_rate < 0)
stop("Recombination rate must be a numeric value", call. = FALSE)

if (!is.null(sampling) && is.null(samples)) {
warning("Argument `sampling` will soon be deprecated in favor of `samples`.", call. = FALSE)
samples <- sampling
}

# verify checksums of serialized model configuration files
checksums <- readr::read_tsv(file.path(model_dir, "checksums.tsv"), progress = FALSE,
col_types = "cc")
Expand Down Expand Up @@ -523,6 +529,7 @@ slim <- function(
#' file is written to a custom location to be loaded at a later point.
#' @param verbose Write the output log to the console (default \code{FALSE})?
#' @param debug Write msprime's debug log to the console (default \code{FALSE})?
#' @param sampling Deprecated in favor of \code{samples}.
#'
#' @return A tree-sequence object loaded via Python-R reticulate interface function \code{ts_load}
#' (internally represented by the Python object \code{tskit.trees.TreeSequence})
Expand Down Expand Up @@ -563,7 +570,7 @@ slim <- function(
#' @export
msprime <- function(model, sequence_length, recombination_rate, samples = NULL,
output = NULL, random_seed = NULL,
load = TRUE, verbose = FALSE, debug = FALSE) {
load = TRUE, verbose = FALSE, debug = FALSE, sampling = NULL) {
if (is.null(output) & !load)
warning("No custom tree-sequence output path is given but loading a tree sequence from\n",
"a temporary file after the simulation has been prevented", call. = FALSE)
Expand All @@ -580,6 +587,11 @@ msprime <- function(model, sequence_length, recombination_rate, samples = NULL,
if (!is.numeric(recombination_rate) | recombination_rate < 0)
stop("Recombination rate must be a numeric value", call. = FALSE)

if (!is.null(sampling) && is.null(samples)) {
warning("Argument `sampling` will soon be deprecated in favor of `samples`.", call. = FALSE)
samples <- sampling
}

# verify checksums of serialized model configuration files
checksums <- readr::read_tsv(file.path(model_dir, "checksums.tsv"), progress = FALSE,
col_types = "cc")
Expand Down
5 changes: 4 additions & 1 deletion docs/reference/msprime.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/msprime.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/slim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit adf4e0d

Please sign in to comment.