Infers gene regulatory networks (GRNs) from expression matrices using arboreto's GRNBoost2 and GENIE3 algorithms with Dask-distributed computation. For bulk or single-cell RNA-seq transcriptomics.
Arboreto is a computational library for inferring gene regulatory networks (GRNs) from gene expression data using parallelized algorithms that scale from single machines to multi-node clusters.
Core capability: Identify which transcription factors (TFs) regulate which target genes based on expression patterns across observations (cells, samples, conditions).
Use this skill when the user wants to:
| Scenario | Use Instead |
|---|---|
| Differential expression between conditions (counts → padj) | alterlab-pydeseq2 |
| Clustering, UMAP, or QC of a single-cell dataset | alterlab-scanpy |
| Deep-learning latent space / batch integration of scRNA-seq | alterlab-scvi-tools |
| Generic graph analysis or centrality on an existing network | alterlab-networkx |
| Tuning the Dask cluster itself rather than running GRN inference | alterlab-dask |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-pydeseq2) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Install arboreto:
uv pip install arboreto
Arboreto 0.1.6 is from 2021 and its internals use dask.delayed plus
dask.dataframe.from_delayed. Those APIs still exist in current dask, but if a run fails
inside dask rather than inside arboreto, pin dask/distributed to a matching pair in an
isolated env (pySCENIC's pins are a good reference) rather than editing arboreto.
Basic GRN inference:
import pandas as pd
from arboreto.algo import grnboost2
if __name__ == '__main__':
# Load expression data (genes as columns)
expression_matrix = pd.read_csv('expression_data.tsv', sep='\t')
# Infer regulatory network
network = grnboost2(expression_data=expression_matrix)
# Save results (TF, target, importance)
network.to_csv('network.tsv', sep='\t', index=False, header=False)
Wrap the entry point in if __name__ == '__main__': — Dask spawns worker processes that
re-import the module, so unguarded top-level code runs again in every worker.
For standard GRN inference workflows including:
See: references/basic_inference.md
Use the ready-to-run script: scripts/basic_grn_inference.py for standard inference tasks:
python scripts/basic_grn_inference.py expression_data.tsv output_network.tsv --tf-file tfs.txt --seed 777
Arboreto provides two algorithms:
GRNBoost2 (Recommended):
GENIE3:
Quick comparison:
from arboreto.algo import grnboost2, genie3
# Fast, recommended
network_grnboost = grnboost2(expression_data=matrix)
# Classic algorithm
network_genie3 = genie3(expression_data=matrix)
For detailed algorithm comparison, parameters, and selection guidance: references/algorithms.md
Scale inference from local multi-core to cluster environments:
Local (default) - Uses all available cores automatically:
network = grnboost2(expression_data=matrix)
Custom local client - Control resources:
from distributed import LocalCluster, Client
local_cluster = LocalCluster(n_workers=10, memory_limit='8GB')
client = Client(local_cluster)
network = grnboost2(expression_data=matrix, client_or_address=client)
client.close()
local_cluster.close()
Cluster computing - Connect to remote Dask scheduler:
from distributed import Client
client = Client('tcp://scheduler:8786')
network = grnboost2(expression_data=matrix, client_or_address=client)
For cluster setup, performance optimization, and large-scale workflows: references/distributed_computing.md
uv pip install arboreto
Dependencies: scipy, scikit-learn, numpy, pandas, dask, distributed
import pandas as pd
from arboreto.algo import grnboost2
if __name__ == '__main__':
# Load single-cell expression matrix (cells x genes)
sc_data = pd.read_csv('scrna_counts.tsv', sep='\t')
# Infer cell-type-specific regulatory network
network = grnboost2(expression_data=sc_data, seed=42)
# importance is unbounded (not a 0-1 probability); keep the top links
# per target rather than applying an absolute threshold.
top_links = network.sort_values('importance', ascending=False).groupby('target').head(10)
top_links.to_csv('grn_top_links.tsv', sep='\t', index=False)
from arboreto.utils import load_tf_names
from arboreto.algo import grnboost2
if __name__ == '__main__':
# Load data
expression_data = pd.read_csv('rnaseq_tpm.tsv', sep='\t')
tf_names = load_tf_names('human_tfs.txt')
# Infer with TF restriction
network = grnboost2(
expression_data=expression_data,
tf_names=tf_names,
seed=123
)
network.to_csv('tf_target_network.tsv', sep='\t', index=False)
from arboreto.algo import grnboost2
if __name__ == '__main__':
# Infer networks for different conditions
conditions = ['control', 'treatment_24h', 'treatment_48h']
for condition in conditions:
data = pd.read_csv(f'{condition}_expression.tsv', sep='\t')
network = grnboost2(expression_data=data, seed=42)
network.to_csv(f'{condition}_network.tsv', sep='\t', index=False)
Arboreto returns a DataFrame with regulatory links:
| Column | Description |
|---|---|
TF | Transcription factor (regulator) |
target | Target gene |
importance | Regulatory importance score (higher = stronger) |
Filtering strategy: importance is an unbounded relative score (derived from tree feature importances), not a probability or correlation — do not apply absolute cutoffs like > 0.5. Prefer:
Arboreto is a core component of the SCENIC pipeline for single-cell regulatory network analysis:
# Step 1: Use arboreto for GRN inference
from arboreto.algo import grnboost2
network = grnboost2(expression_data=sc_data, tf_names=tf_list)
# Step 2: Use pySCENIC for regulon identification and activity scoring
# (See pySCENIC documentation for downstream analysis)
Always set a seed for reproducible results:
network = grnboost2(expression_data=matrix, seed=777)
GRNBoost2 is stochastic, so a single seed pins one run but does not establish robustness. For a consensus network, run several seeds and keep links that recur, averaging their importance:
import pandas as pd
from distributed import LocalCluster, Client
from arboreto.algo import grnboost2
if __name__ == '__main__':
client = Client(LocalCluster())
seeds = [42, 123, 777]
networks = [
grnboost2(expression_data=matrix, client_or_address=client, seed=s)
for s in seeds
]
client.close()
# Consensus: keep edges present in every run, average their importance
combined = pd.concat(networks)
consensus = (combined.groupby(['TF', 'target'])
.agg(importance=('importance', 'mean'), n_runs=('importance', 'size'))
.reset_index())
consensus = consensus[consensus['n_runs'] == len(seeds)]
Memory errors: Reduce dataset size by filtering low-variance genes or use distributed computing
Slow performance: Use GRNBoost2 instead of GENIE3, enable distributed client, filter TF list
Dask errors: Ensure if __name__ == '__main__': guard is present in scripts
Empty results: Check data format (genes as columns), verify TF names match gene names
references/basic_inference.md — input preparation, running inference, output formatreferences/algorithms.md — GRNBoost2 vs GENIE3 parameters and selection guidancereferences/distributed_computing.md — cluster setup and large-scale workflowsscripts/basic_grn_inference.py — runnable CLI wrapper for a standard GRNBoost2 runPart of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)evals/fixtures/expression.tsv (opens in a new tab)evals/fixtures/tfs.txt (opens in a new tab)references/algorithms.md (opens in a new tab)references/basic_inference.md (opens in a new tab)references/distributed_computing.md (opens in a new tab)scripts/basic_grn_inference.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Not loaded · from alterlab-writing-tools
Claude Code won't load this skill
It ships in alterlab-writing-tools at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Generated from the plugin's indexed repository (alterlab-ieu/alterlab-academic-skills) — no native marketplace selected
npx claudepluginhub p/alterlab-ieu-alterlab-writing-tools241 skills in this plugin
/alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(rng=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite./alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job