Nothing
# Generated by devforge. Do not edit.
# Edit the specs under inst/params/ and run devforge::forge_params().
# parameter checkers -----------------------------------------------------------
#' Check cluster params
#'
#' @description Checkmate extension for the output of [params_clusters()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkClustersParams <- function(x) {
res <- check_list_shape(x, "n_clusters")
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
n_clusters = "I1(1,)"
),
label = "cluster params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert cluster params
#'
#' @inheritParams checkClustersParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertClustersParams <- checkmate::makeAssertionFunction(checkClustersParams)
#' Check density params
#'
#' @description Checkmate extension for the output of [params_densmap()] and
#' [params_densne()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkDensParams <- function(x) {
res <- check_list_shape(x, c("lambda", "frac", "var_shift"))
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
lambda = "N1[0,)",
frac = "N1[0,1]",
var_shift = "N1[0,)"
),
label = "density params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert density params
#'
#' @inheritParams checkDensParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertDensParams <- checkmate::makeAssertionFunction(checkDensParams)
#' Check diffusion maps params
#'
#' @description Checkmate extension for the output of [params_diffusion_maps()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkDiffusionMapsParams <- function(x) {
res <- check_list_shape(
x,
c(
"bandwidth_scale",
"thresh",
"graph_symmetry",
"alpha_norm",
"t_max",
"t_custom",
"n_landmarks",
"landmark_method",
"n_svd"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
bandwidth_scale = "N1(0,)",
thresh = "N1[0,)",
alpha_norm = "N1[0,1]",
t_max = "I1[1,)",
t_custom = c("I1[1,)", "0"),
n_landmarks = c("I1[1,)", "0"),
n_svd = c("I1[1,)", "0")
),
label = "diffusion maps params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
graph_symmetry = c("additive", "multiplicative", "mnn", "none"),
landmark_method = c("spectral", "random", "density")
),
label = "diffusion maps params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert diffusion maps params
#'
#' @inheritParams checkDiffusionMapsParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertDiffusionMapsParams <- checkmate::makeAssertionFunction(
checkDiffusionMapsParams
)
#' Check DREAMS params
#'
#' @description Checkmate extension for the output of [params_dreams()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkDreamsParams <- function(x) {
res <- check_list_shape(x, "lambda")
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
lambda = "N1[0,1]"
),
label = "DREAMS params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert DREAMS params
#'
#' @inheritParams checkDreamsParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertDreamsParams <- checkmate::makeAssertionFunction(checkDreamsParams)
#' Check EVoC params
#'
#' @description Checkmate extension for the output of [params_evoc()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkEvocParams <- function(x) {
res <- check_list_shape(
x,
c(
"noise_level",
"n_epochs",
"embedding_dim",
"neighbour_scale",
"symmetrise",
"min_samples",
"base_min_cluster_size",
"approx_n_clusters",
"min_similarity_threshold",
"max_layers"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
noise_level = "N1[0,1]",
n_epochs = "I1[1,)",
embedding_dim = c("I1[2,)", "0"),
neighbour_scale = "N1(0,)",
symmetrise = "B1",
min_samples = "I1[1,)",
base_min_cluster_size = "I1[2,)",
approx_n_clusters = c("I1[2,)", "0"),
min_similarity_threshold = "N1[0,1]",
max_layers = "I1[1,)"
),
label = "EVoC params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert EVoC params
#'
#' @inheritParams checkEvocParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertEvocParams <- checkmate::makeAssertionFunction(checkEvocParams)
#' Check ForceAtlas2 params
#'
#' @description Checkmate extension for the output of [params_fa2()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkFa2Params <- function(x) {
res <- check_list_shape(
x,
c(
"local_connectivity",
"bandwidth",
"n_epochs",
"scaling_ratio",
"gravity",
"strong_gravity",
"lin_log",
"dissuade_hubs",
"edge_weight_influence",
"jitter_tolerance",
"theta",
"init",
"randomised"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
local_connectivity = "N1",
bandwidth = "N1",
n_epochs = "I1[1,)",
scaling_ratio = "N1(0,)",
gravity = "N1[0,)",
strong_gravity = "B1",
lin_log = "B1",
dissuade_hubs = "B1",
edge_weight_influence = "N1[0,)",
jitter_tolerance = "N1(0,)",
theta = "N1[0,)",
randomised = "B1"
),
label = "ForceAtlas2 params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
init = c("spectral", "pca", "random")
),
label = "ForceAtlas2 params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert ForceAtlas2 params
#'
#' @inheritParams checkFa2Params
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertFa2Params <- checkmate::makeAssertionFunction(checkFa2Params)
#' Check hierarchical cluster params
#'
#' @description Checkmate extension for the output of [params_hierarchical()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkHierarchicalParams <- function(x) {
res <- check_list_shape(
x,
c(
"n_supergroups",
"n_subclusts",
"supergroup_spread",
"subcluster_spread",
"point_std"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
n_supergroups = "I1(1,)",
n_subclusts = "I1(1,)",
supergroup_spread = "N1(0,)",
subcluster_spread = "N1(0,)",
point_std = "N1(0,)"
),
label = "hierarchical cluster params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert hierarchical cluster params
#'
#' @inheritParams checkHierarchicalParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertHierarchicalParams <- checkmate::makeAssertionFunction(
checkHierarchicalParams
)
#' Check k-means params
#'
#' @description Checkmate extension for the output of [params_kmeans()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkKmeansParams <- function(x) {
res <- check_list_shape(
x,
c(
"metric",
"max_iters",
"batch_size",
"drift_threshold",
"lr_alpha",
"init",
"use_hamerly",
"use_gemm"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
max_iters = "I1[1,)",
batch_size = "I1[1,)",
drift_threshold = "N1",
lr_alpha = "N1",
use_hamerly = c("B1", "0"),
use_gemm = c("B1", "0")
),
label = "k-means params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
metric = c("euclidean", "cosine"),
init = c("parallel", "random")
),
label = "k-means params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert k-means params
#'
#' @inheritParams checkKmeansParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertKmeansParams <- checkmate::makeAssertionFunction(checkKmeansParams)
#' Check nearest neighbour params
#'
#' @description Checkmate extension for the output of [params_nn()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkNnParams <- function(x) {
res <- check_list_shape(
x,
c(
"dist_metric",
"n_tree",
"search_budget",
"m",
"ef_construction",
"ef_search",
"diversify_prob",
"delta",
"ef_budget",
"extract_knn",
"bt_budget",
"n_list",
"n_probes"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
n_tree = "I1",
search_budget = c("I1", "0"),
m = "I1",
ef_construction = "I1",
ef_search = "I1",
diversify_prob = "N1",
delta = "N1",
ef_budget = c("I1", "0"),
extract_knn = "B1",
bt_budget = "N1",
n_list = c("I1", "0"),
n_probes = c("I1", "0")
),
label = "nearest neighbour params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
dist_metric = c("euclidean", "cosine")
),
label = "nearest neighbour params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert nearest neighbour params
#'
#' @inheritParams checkNnParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertNnParams <- checkmate::makeAssertionFunction(checkNnParams)
#' Check PaCMAP params
#'
#' @description Checkmate extension for the output of [params_pacmap()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkPacmapParams <- function(x) {
res <- check_list_shape(
x,
c(
"n_near",
"n_mid_near",
"n_further",
"mn_candidate_start",
"mn_candidate_end",
"init",
"optimiser",
"lr",
"n_epochs",
"beta1",
"beta2",
"eps",
"phase1_end",
"phase2_end"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
n_near = "I1",
n_mid_near = "I1",
n_further = "I1",
mn_candidate_start = "I1",
mn_candidate_end = "I1",
lr = "N1",
n_epochs = c("I1[1,)", "0"),
beta1 = "N1",
beta2 = "N1",
eps = "N1",
phase1_end = c("I1[1,)", "0"),
phase2_end = c("I1[1,)", "0")
),
label = "PaCMAP params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
init = c("pca", "random"),
optimiser = c("adam_parallel", "adam")
),
label = "PaCMAP params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert PaCMAP params
#'
#' @inheritParams checkPacmapParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertPacmapParams <- checkmate::makeAssertionFunction(checkPacmapParams)
#' Check PHATE params
#'
#' @description Checkmate extension for the output of [params_phate()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkPhateParams <- function(x) {
res <- check_list_shape(
x,
c(
"decay",
"bandwidth_scale",
"t_max",
"t_custom",
"gamma",
"n_landmarks",
"landmark_method",
"n_svd",
"mds_method",
"graph_symmetry"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
decay = "N1(0,)",
bandwidth_scale = c("N1(0,)", "0"),
t_max = "I1[1,)",
t_custom = c("I1[1,)", "0"),
gamma = "N1",
n_landmarks = c("I1[1,)", "0"),
n_svd = c("I1[1,)", "0")
),
label = "PHATE params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
landmark_method = c("spectral", "random", "density"),
mds_method = c("sgd_dense", "classic"),
graph_symmetry = c("additive", "multiplicative", "mnn", "none")
),
label = "PHATE params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert PHATE params
#'
#' @inheritParams checkPhateParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertPhateParams <- checkmate::makeAssertionFunction(checkPhateParams)
#' Check swiss roll params
#'
#' @description Checkmate extension for the output of [params_swiss_roll()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkSwissRollParams <- function(x) {
res <- check_list_shape(x, "noise")
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
noise = "N1(0,)"
),
label = "swiss roll params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert swiss roll params
#'
#' @inheritParams checkSwissRollParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertSwissRollParams <- checkmate::makeAssertionFunction(checkSwissRollParams)
#' Check biased swiss roll params
#'
#' @description Checkmate extension for the output of
#' [params_swiss_roll_biased()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkSwissRollBiasedParams <- function(x) {
res <- check_list_shape(x, c("noise", "bias"))
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
noise = "N1(0,)",
bias = "N1(0,)"
),
label = "biased swiss roll params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert biased swiss roll params
#'
#' @inheritParams checkSwissRollBiasedParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertSwissRollBiasedParams <- checkmate::makeAssertionFunction(
checkSwissRollBiasedParams
)
#' Check trajectory params
#'
#' @description Checkmate extension for the output of [params_trajectory()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkTrajectoryParams <- function(x) {
res <- check_list_shape(x, c("topology", "cell_trajectories", "noise"))
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
noise = "N1(0,)"
),
label = "trajectory params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
topology = c("bifurcation", "linear", "combination")
),
label = "trajectory params"
)
if (!isTRUE(res)) {
return(res)
}
if (!is.null(x$cell_trajectories)) {
res <- checkCellTrajectories(x$cell_trajectories)
if (!isTRUE(res)) {
return(res)
}
}
return(TRUE)
}
#' Assert trajectory params
#'
#' @inheritParams checkTrajectoryParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertTrajectoryParams <- checkmate::makeAssertionFunction(
checkTrajectoryParams
)
#' Check t-SNE params
#'
#' @description Checkmate extension for the output of [params_tsne()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkTsneParams <- function(x) {
res <- check_list_shape(
x,
c(
"lr",
"n_epochs",
"early_exag_iter",
"early_exag_factor",
"late_exag_factor",
"theta",
"n_interp_points",
"max_depth",
"init",
"randomised"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
lr = c("N1", "0"),
n_epochs = "I1[1,)",
early_exag_iter = "I1[1,)",
early_exag_factor = "N1",
late_exag_factor = c("N1", "0"),
theta = "N1[0,1]",
n_interp_points = "I1[1,)",
max_depth = "I1[1,)",
randomised = "B1"
),
label = "t-SNE params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
init = c("pca", "spectral", "random")
),
label = "t-SNE params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert t-SNE params
#'
#' @inheritParams checkTsneParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertTsneParams <- checkmate::makeAssertionFunction(checkTsneParams)
#' Check UMAP params
#'
#' @description Checkmate extension for the output of [params_umap()].
#'
#' @param x The object to check.
#'
#' @returns `TRUE` if the check was successful, otherwise a
#' checkmate-style error string.
#'
#' @keywords internal
checkUmapParams <- function(x) {
res <- check_list_shape(
x,
c(
"local_connectivity",
"bandwidth",
"mix_weight",
"lr",
"n_epochs",
"neg_sample_rate",
"gamma",
"optimiser",
"init",
"randomised"
)
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_qtest_rules(
x,
list(
local_connectivity = "N1",
bandwidth = "N1",
mix_weight = "N1",
lr = "N1",
n_epochs = c("I1[1,)", "0"),
neg_sample_rate = "I1",
gamma = "N1",
randomised = "B1"
),
label = "UMAP params"
)
if (!isTRUE(res)) {
return(res)
}
res <- apply_choice_rules(
x,
list(
optimiser = c("adam_parallel", "sgd", "adam"),
init = c("spectral", "pca", "random")
),
label = "UMAP params"
)
if (!isTRUE(res)) {
return(res)
}
return(TRUE)
}
#' Assert UMAP params
#'
#' @inheritParams checkUmapParams
#' @param .var.name Name of the checked object to print in assertions.
#' @param add Collection to store assertion messages. See
#' [checkmate::makeAssertCollection()].
#'
#' @returns Invisibly returns the checked object if the assertion is
#' successful.
#'
#' @keywords internal
assertUmapParams <- checkmate::makeAssertionFunction(checkUmapParams)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.