regvelo.tools.compute_TF_regulon

regvelo.tools.compute_TF_regulon(adata, rgv_model, cluster_key, TF, TERMINAL_STATES, threshold=0.4, n_states=7, n_samples=50, n_cells=30, solver='direct')[source]

Scan each candidate TF’s regulon (targets and regulators) and save scores.

For every TF in TF, extracts the inferred GRN weights from the trained model, identifies that TF’s targets and regulators above threshold (by absolute weight), and runs rgv.tl.regulation_scanning for both edge sets, returning the per-edge coefficient tables keyed by TF.

Parameters:
  • adata (anndata.AnnData) – AnnData used to train rgv_model. Must contain uns["skeleton"] (the prior-GRN adjacency) whose row/column labels name targets/regulators.

  • rgv_model (str) – Path to a saved, trained RegVelo model directory (as produced by REGVELOVI.save). Loaded via REGVELOVI.load(rgv_model, adata) to access the inferred GRN, and passed as-is to rgv.tl.regulation_scanning.

  • cluster_key (str) – adata.obs column used as the cluster label during scanning

  • TF (str or list of str) – Candidate transcription factor(s) to scan.

  • TERMINAL_STATES (list of str) – Terminal-state labels passed to rgv.tl.regulation_scanning.

  • threshold (float, optional) – Absolute GRN-weight cutoff for retaining an edge as a target/regulator. Default 0.4.

  • n_states (int, optional) – Number of macrostates used by regulation_scanning. Default 7.

  • n_samples (int, optional) – Number of samples drawn per scan. Default 50.

  • n_cells (int, optional) – Number of cells per macrostate, passed to rgv.tl.regulation_scanning. Default 30.

  • solver (str, optional) – Linear solver passed to rgv.tl.regulation_scanning. Default "direct".

Returns:

: coef_targets, coef_regulators: dict of str to DataFrame

Per-TF target and regulator coefficient tables, keyed by TF, to be passed as the coef_targets / coef_regulators arguments of regvelo.pl.plot_TF_regulon().