Read sig_fit_bootstrap for more option setting.

sig_fit_bootstrap_batch(
  catalogue_matrix,
  methods = c("QP"),
  n = 100L,
  min_count = 1L,
  p_val_thresholds = c(0.05),
  use_parallel = FALSE,
  seed = 123456L,
  job_id = NULL,
  result_dir = tempdir(),
  ...
)

Arguments

catalogue_matrix

a numeric matrix V with row representing components and columns representing samples, typically you can get nmf_matrix from sig_tally() and transpose it by t().

methods

a subset of c("NNLS", "QP", "SA").

n

the number of bootstrap replicates.

min_count

minimal exposure in a sample, default is 1. Any patient has total exposure less than this value will be filtered out.

p_val_thresholds

a vector of relative exposure threshold for calculating p values.

use_parallel

if TRUE, use parallel computation based on furrr package. It can also be an integer for specifying cores.

seed

random seed to reproduce the result.

job_id

a job ID, default is NULL, can be a string. When not NULL, all bootstrapped results will be saved to local machine location defined by result_dir. This is very useful for running more than 10 times for more than 100 samples.

result_dir

see above, default is temp directory defined by R.

...

other common parameters passing to sig_fit_bootstrap, including sig, sig_index, sig_db, db_type, mode, auto_reduce etc.

Value

a list of data.table.

See also

Examples

W <- matrix(c(1, 2, 3, 4, 5, 6), ncol = 2)
colnames(W) <- c("sig1", "sig2")
W <- apply(W, 2, function(x) x / sum(x))

H <- matrix(c(2, 5, 3, 6, 1, 9, 1, 2), ncol = 4)
colnames(H) <- paste0("samp", 1:4)

V <- W %*% H
V

if (requireNamespace("quadprog")) {
  z10 <- sig_fit_bootstrap_batch(V, sig = W, n = 10)
  z10
}