Run Monte Carlo simulations for one or more patients
Usage
runSim(
Lmatrix,
Rmatrix,
Cmatrix,
LRmatrix,
cells,
communication_type,
pats = "all",
N = 10000,
itNo = 100,
av = 20,
output_folder = NULL,
file.name = NULL,
norm = FALSE,
patient_idx = NULL,
ncores = 1
)Arguments
- Lmatrix
Cell-by-ligand compatibility matrix.
- Rmatrix
Cell-by-receptor compatibility matrix.
- Cmatrix
Patient-by-cell-type abundance matrix.
- LRmatrix
Ligand-receptor-by-patient tensor.
- cells
Character vector of cell-type names.
- communication_type
Feature family to simulate (
"D","W","TT","CT", or"GSCC"), or a character vector of several of these. When more than one is given, every requested type is extracted from the same simulated graphs (viacountAllTypes()) instead of re-simulating a fresh set of graphs per type, and one.outfile per type is written (file names suffixed with the type, e.g.<file.name>_D.out). With a single type, output naming is unchanged from previous versions (<file.name>.out, no suffix).- pats
Number of patients to process, or
"all".- N
Number of cells per graph.
- itNo
Number of Monte Carlo iterations.
- av
Target average degree.
- output_folder
Directory used to write the
.outfiles.- file.name
Output filename stem.
- norm
Logical; if
TRUE, use a uniformized LR baseline.- patient_idx
Optional single patient index to simulate.
- ncores
Number of cores to compute patients on in parallel, via
parallel::makeCluster()+doParallel::registerDoParallel()+foreach::foreach(...) %dopar% {...}(the same backend used throughoutpipeML), so it works identically on Windows/macOS/Unix.ncores = 1(the default) runs sequentially vialapply()and skips cluster setup entirely. Patients are independent of each other, so this parallelizes near-linearly. File writing always happens sequentially afterward, in patient order, to keep the on-disk format unchanged. Because cluster workers are separate R processes (not forks), each one loads the installedRaCInGpackage rather than inheriting the calling session's state – if you are iterating on package source viasource()instead oflibrary(RaCInG), reinstall the package first so workers see your latest changes.