Skip to content

Commit

Permalink
Merge pull request #22 from tece-lab/res
Browse files Browse the repository at this point in the history
Res
  • Loading branch information
Neves-P authored Jul 10, 2022
2 parents f547a65 + 4cbc523 commit c8857a8
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 19 deletions.
10 changes: 6 additions & 4 deletions R/default_params_doc.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@
#' clade in the empirical data
#' @param ylim4 maximum of the plot of the rank of the largest clade.
#' @param title title of the plot.
#' @param res Sets the maximum number of species for which a probability must
#' be computed, must be larger than the size of the largest clade.
#' @param ddmodel Sets the model of diversity-dependence:
#' * `ddmodel = 0`: no diversity dependence
#' * `ddmodel = 1`: linear dependence in speciation rate
Expand Down Expand Up @@ -182,6 +180,10 @@
#' of a numeric which is used to detect whether multiple data set from the
#' same data source is being run. This is the case, for example, when fitting
#' a DAISIE model to a posterior distribution of data.
#' @param res A numeric determining the resolution of the likelihood
#' calculations, it sets the limit for the maximum number of species for
#' which a probability must be computed, which must be larger than the size
#' of the largest clade.
#'
#' @return Nothing
#' @keywords internal
Expand Down Expand Up @@ -212,7 +214,6 @@ default_params_doc <- function(model,
sumstats,
ylim4,
title,
res,
ddmodel,
verbose,
island_ontogeny,
Expand All @@ -223,6 +224,7 @@ default_params_doc <- function(model,
x_I, # nolint
mainland_n,
low_rates,
rep_index) {
rep_index,
res) {
# Nothing
}
3 changes: 3 additions & 0 deletions R/run_daisie_ml.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ run_daisie_ml <- function(daisie_data,
results_dir = NULL,
low_rates = FALSE,
rep_index = "NULL",
res = 100,
test = FALSE) {
if (test) {
seed <- array_index
Expand Down Expand Up @@ -81,8 +82,10 @@ run_daisie_ml <- function(daisie_data,
idparsopt = idparsopt,
parsfix = parsfix,
idparsfix = idparsfix,
res = res,
ddmodel = ddmodel,
cond = cond,
methode = methode,
optimmethod = optimmethod,
CS_version = cs_version
)
Expand Down
2 changes: 1 addition & 1 deletion R/setup_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ setup_model <- function(model,
} else {
lac <- stats::runif(1, min = 0, max = 0.1)
mu <- stats::runif(1, min = 0, max = 0.1)
k <- stats::runif(1, min = 100, max = 200)
k <- stats::runif(1, min = 250, max = 500)
gam <- stats::runif(1, min = 1e-5, max = 0.1)
laa <- stats::runif(1, min = 0, max = 0.1)
sd <- stats::runif(1, min = 0.1, max = 1)
Expand Down
16 changes: 15 additions & 1 deletion bash/submit_run_daisie_ml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
# model. If left unspecified defaults to the lsodes method.
# optimmethod - The optimization algorithm used to maximize the likelihood. If
# left unspecified, the default subplex algorithm is used.
# low_rates - A boolean determining whether to sample the initial parameter
# estimates from the standard distribution (FALSE, default) or whether to sample
# from a restricted distribution in which the upper bound of the initial
# parameter estimates are lower
# rep_index - A numeric or NULL which determines whether the data being read is
# a single data set (i.e. a single replicate), set by NULL which is default, or
# one of several data sets, in which case the data set to choice is set by
# rep_index
# res - A numeric determining the resolution of the likelihood calculations, it
# sets the limit for the maximum number of species for which a probability
# must be computed, which must be larger than the size of the largest clade

################################################################################
##### Before running make sure install_DAISIEutils.sh has been run ####
# Example:
Expand All @@ -61,6 +73,7 @@ methode=${6-lsodes}
optimmethod=${7-subplex}
low_rates=${8-FALSE}
rep_index=${9-NULL}
res=${10-100}
seed=${SLURM_ARRAY_TASK_ID}

ml R
Expand All @@ -73,4 +86,5 @@ Rscript DAISIEutils/scripts/run_daisie_ml.R ${data} \
${methode} \
${optimmethod} \
${low_rates} \
${rep_index}
${rep_index} \
${res}
20 changes: 17 additions & 3 deletions bash/submit_run_daisie_ml_long.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,18 @@
# model. If left unspecified defaults to the lsodes method.
# optimmethod - The optimization algorithm used to maximize the likelihood. If
# left unspecified, the default subplex algorithm is used.
# low_rates - A logical, TRUE resulting in a model parametrisation with lower
# rates.
# low_rates - A boolean determining whether to sample the initial parameter
# estimates from the standard distribution (FALSE, default) or whether to sample
# from a restricted distribution in which the upper bound of the initial
# parameter estimates are lower
# rep_index - A numeric or NULL which determines whether the data being read is
# a single data set (i.e. a single replicate), set by NULL which is default, or
# one of several data sets, in which case the data set to choice is set by
# rep_index
# res - A numeric determining the resolution of the likelihood calculations, it
# sets the limit for the maximum number of species for which a probability
# must be computed, which must be larger than the size of the largest clade

################################################################################
##### Before running make sure install_DAISIEutils.sh has been run ####
# Example:
Expand All @@ -61,6 +71,8 @@ results_dir=${5-NULL}
methode=${6-lsodes}
optimmethod=${7-subplex}
low_rates=${8-FALSE}
rep_index=${9-NULL}
res=${10-100}
seed=${SLURM_ARRAY_TASK_ID}

ml R
Expand All @@ -72,4 +84,6 @@ Rscript DAISIEutils/scripts/run_daisie_ml.R ${data} \
${results_dir} \
${methode} \
${optimmethod} \
${low_rates}
${low_rates} \
${rep_index} \
${res}
12 changes: 7 additions & 5 deletions man/default_params_doc.Rd

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

6 changes: 6 additions & 0 deletions man/run_daisie_ml.Rd

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

6 changes: 4 additions & 2 deletions man/setup_std_pars2.Rd

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

9 changes: 6 additions & 3 deletions scripts/run_daisie_ml.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ if (identical(args[6], "NULL")) {
methode = args[7],
optimmethod = args[8],
low_rates = as.logical(args[9]),
rep_index = args[10]
rep_index = args[10],
res = as.numeric(args[11])
)
} else if (identical(args[6], "NA")){
DAISIEutils::run_daisie_ml(
Expand All @@ -33,7 +34,8 @@ if (identical(args[6], "NULL")) {
methode = args[7],
optimmethod = args[8],
low_rates = as.logical(args[9]),
rep_index = args[10]
rep_index = args[10],
res = as.numeric(args[11])
)
} else {
DAISIEutils::run_daisie_ml(
Expand All @@ -46,6 +48,7 @@ if (identical(args[6], "NULL")) {
methode = args[7],
optimmethod = args[8],
low_rates = as.logical(args[9]),
rep_index = args[10]
rep_index = args[10],
res = as.numeric(args[11])
)
}

0 comments on commit c8857a8

Please sign in to comment.