% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/04_calculation.R
\name{batch_calc_gsea}
\alias{batch_calc_gsea}
\title{Batch Parallel GSEA Calculation}
\usage{
batch_calc_gsea(
  gsea_env,
  custom_series_name = "Auto_Analysis",
  output_dir = tempdir(),
  workers = 2,
  bidirectional = TRUE,
  minGSSize = 10,
  maxGSSize = 500,
  pvalueCutoff = 1,
  seed = 123,
  force = FALSE,
  use_progress = FALSE,
  chunk_size = NULL
)
}
\arguments{
\item{gsea_env}{GseaEnv object}

\item{custom_series_name}{String. Analysis series name}

\item{output_dir}{String. Output directory for results, default "./GSEA_Output"}

\item{workers}{Number of parallel cores. Default 4}

\item{bidirectional}{Logical. Whether to automatically generate reverse contrasts, default TRUE}

\item{minGSSize}{Minimum gene set size, default 10}

\item{maxGSSize}{Maximum gene set size, default 500}

\item{pvalueCutoff}{P-value threshold, default 1}

\item{seed}{Integer or NULL. Base random seed for per-contrast GSEA
permutation, default 123. Each contrast derives its own deterministic
seed from the base seed and the contrast id, so results are reproducible
across runs and independent of `workers`/`chunk_size`. On
clusterProfiler <= 4.20.x (where the `seed` argument of `GSEA()` is
silently dropped) reproducibility is guaranteed by seeding the worker R
RNG via `withr::local_seed()`; on clusterProfiler >= 4.21.x the derived
seed is also forwarded to `clusterProfiler::GSEA(seed = ...)`. Set to
NULL to restore native (non-reproducible) engine sampling.}

\item{force}{Logical. Whether to force recalculation, default FALSE}

\item{use_progress}{Logical. Whether to show progress bar, default TRUE}

\item{chunk_size}{Integer. Number of tasks per worker per chunk, default NULL (auto)}
}
\value{
GseaRes object
}
\description{
Consumes a standard GseaEnv object and performs efficient parallel GSEA calculation.
}
\examples{
# Build a GseaEnv from pre-computed inputs shipped with the package
data(preprocessed_limma, package = "GSEAlens")

precomp <- preprocessed_limma
data(gsea_pathwaysets_toy, package = "GSEAlens")

pathways <- gsea_pathwaysets_toy
gsea_env <- setup_gsea_env(
  fit = precomp$fit,
  pathway_obj = pathways,
  expr_data = precomp$gsea_limma_voom_data
)
# Run batch GSEA (writes to a temporary directory; ~20s on the toy set)
gsea_res <- batch_calc_gsea(gsea_env, workers = 2, output_dir = tempdir())
}
