pylimma.roast

pylimma.roast(y, index=None, design=None, contrast=None, geneid=None, set_statistic='mean', gene_weights=None, var_prior=None, df_prior=None, nrot=1999, approx_zscore=True, legacy=False, rng=None, **lmfit_kwargs)[source]

Rotation gene-set test (single set).

Port of R limma’s roast.default. When index is a dict/list of sets, dispatches to mroast().

Parameters:
  • y (ndarray, EList, AnnData, or DataFrame) – Expression data.

  • index (array_like of int, dict, or list of array_like, optional) – Set members (0-based indices). A dict or list of arrays is treated as multiple sets and routed to mroast().

  • design (array_like, optional) – Design matrix. Defaults to y.design if available.

  • contrast (int or array_like, optional) – Column index (0-based) or contrast vector. Defaults to the last column of design.

  • geneid (str or array_like, optional) – Optional gene identifier vector (or column name in y.genes).

  • set_statistic ({"mean", "floormean", "mean50", "msq"}, default "mean") – Summary statistic of the moderated z-scores.

  • gene_weights (array_like, optional) – Per-gene weights.

  • var_prior (float, optional) – Hyperparameters. If either is None, both are estimated by squeeze_var().

  • df_prior (float, optional) – Hyperparameters. If either is None, both are estimated by squeeze_var().

  • nrot (int, default 1999) – Number of rotations.

  • approx_zscore (bool, default True) – Use an approximation for the z-score transform.

  • legacy (bool, default False) – If True, use zscore_t(..., method="hill") for all z-score computations (matches R’s pre-2019 behaviour).

  • rng (int, numpy.random.Generator, or None) – Random-number stream. Deterministic outputs match R; Monte-Carlo p-values use this stream.

Returns:

{"p_value": DataFrame(Active.Prop, P.Value), "ngenes_in_set": int}.

Return type:

dict