pylimma.top_treat

pylimma.top_treat(fit, coef=0, sort_by='p', resort_by=None, **kwargs)[source]

Top-ranked genes after a treat() fit.

Thin wrapper around pylimma.top_table() that enforces the two guardrails R limma’s topTreat enforces: coef must be a single coefficient, and sort_by="b" / resort_by="b" are rejected because treat() does not produce a B-statistic.

Parameters:
  • fit (MArrayLM, AnnData, or dict) – Fit object produced by treat().

  • coef (int or str, default 0) – Single coefficient index or name. Lists are not allowed; if a sequence is supplied only the first element is used and a warning is emitted.

  • sort_by (str, default "p") – Column to sort by. Passing "b" raises ValueError.

  • resort_by (str, optional) – Secondary sort column. Passing "b" raises ValueError.

  • **kwargs – Forwarded to pylimma.top_table().

Returns:

Ranked-gene table, same schema as top_table() minus the b column (which treat() does not compute).

Return type:

pandas.DataFrame

Notes

R limma’s own topTreat source comments that the function “may become deprecated soon as topTable() takes over”; pylimma keeps it for direct R-to-pylimma call-site compatibility.