arboreto
LeonChaoX/qinyan-academic-skills/skills/05-生物信息与基因组学/arboreto/SKILL.md
Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.
- Installs packages
What's in it
- Arboreto
- Overview
- Quick Start
- Core Capabilities
- 1. Basic GRN Inference
- 2. Algorithm Selection
- 3. Distributed Computing
- Installation
- Common Use Cases
- Single-Cell RNA-seq Analysis
- Bulk RNA-seq with TF Filtering
- Comparative Analysis (Multiple Conditions)
- Output Interpretation
- Integration with pySCENIC
- Reproducibility
- Troubleshooting
---
name: arboreto
description: Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.
license: BSD-3-Clause license
metadata:
skill-author: K-Dense Inc.
---
# Arboreto
## Overview
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).
## Quick Start
Install arboreto:
```bash
uv pip install arboreto
```
Basic GRN inference:
```python
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)
```
**Critical**: Always use `if __name__ == '__main__':` guard because Dask spawns new processes.
## Core Capabilities
### 1. Basic GRN Inference
For standard GRN inference workflows including:
- Input data preparation (Pandas DataFrame or NumPy array)
- Running inference with GRNBoost2 or GENIE3
- Filtering by transcription factors
- Output format and interpretation
**See**: `references/basic_inference.md`
**Use the ready-to-run script**: `scripts/basic_grn_inference.py` for standard inference tasks:
```bash
python scripts/basic_grn_inference.py expression_data.tsv output_network.tsv --tf-file tfs.txt --seed 777
```
### 2. Algorithm Selection
Arboreto provides two algorithms:
**GRNBoost2 (Recommended)**:
- Fast gradient boosting-based inference
- Optimized for large datasets (10k+ observations)
- Default choice for most analyses
**GENIE3**:
- Random Forest-based inference
- Original multiple regression approach
- Use for comparison or validation
Quick comparison:
```python
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`
### 3. Distributed Computing
Scale inference from local multi-core to cluster environments:
**Local (default)** - Uses all available cores automatically:
```python
network = grnboost2(expression_data=matrix)
```
**Custom local client** - Control resources:
```python
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:
```python
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`
## Installation
```bash
uv pip install arboreto
```
**Dependencies**: scipy, scikit-learn, numpy, pandas, dask, distributed
## Common Use Cases
### Single-Cell RNA-seq Analysis
```python
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)
# Filter high-confidence links
high_confidence = network[network['importance'] > 0.5]
high_confidence.to_csv('grn_high_confidence.tsv', sep='\t', index=False)
```
### Bulk RNA-seq with TF Filtering
```python
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)
```
### Comparative Analysis (Multiple Conditions)
```python
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)
```
## Output Interpretation
Arboreto returns a DataFrame with regulatory links:
| Column | Description |
|--------|-------------|
| `TF` | Transcription factor (regulator) |
| `target` | Target gene |
| `importance` | Regulatory importance score (higher = stronger) |
**Filtering strategy**:
- Top N links per target gene
- Importance threshold (e.g., > 0.5)
- Statistical significance testing (permutation tests)
## Integration with pySCENIC
Arboreto is a core component of the SCENIC pipeline for single-cell regulatory network analysis:
```python
# 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)
```
## Reproducibility
Always set a seed for reproducible results:
```python
network = grnboost2(expression_data=matrix, seed=777)
```
Run multiple seeds for robustness analysis:
```python
from distributed import LocalCluster, Client
if __name__ == '__main__':
client = Client(LocalCluster())
seeds = [42, 123, 777]
networks = []
for seed in seeds:
net = grnboost2(expression_data=matrix, client_or_address=client, seed=seed)
networks.append(net)
# Combine networks and filter consensus links
consensus = analyze_consensus(networks)
```
## Troubleshooting
**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
More agent context in LeonChaoX/qinyan-academic-skills
186 other files this repository gives its agents, the first 60 shown.
Skill
- bgpt-paper-searchskills/01-论文检索与文献管理/bgpt-paper-search/SKILL.md
- biorxiv-databaseskills/01-论文检索与文献管理/biorxiv-database/SKILL.md
- citation-managementskills/01-论文检索与文献管理/citation-management/SKILL.md
- literature-reviewskills/01-论文检索与文献管理/literature-review/SKILL.md
- openalex-databaseskills/01-论文检索与文献管理/openalex-database/SKILL.md
- parallel-webskills/01-论文检索与文献管理/parallel-web/SKILL.md
- perplexity-searchskills/01-论文检索与文献管理/perplexity-search/SKILL.md
- pubmed-databaseskills/01-论文检索与文献管理/pubmed-database/SKILL.md
- pyzoteroskills/01-论文检索与文献管理/pyzotero/SKILL.md
- research-lookupskills/01-论文检索与文献管理/research-lookup/SKILL.md
- medical-imaging-reviewskills/02-科学写作与学术交流/medical-imaging-review/SKILL.md
- paper-2-webskills/02-科学写作与学术交流/paper-2-web/SKILL.md
- peer-reviewskills/02-科学写作与学术交流/peer-review/SKILL.md
- research-proposalskills/02-科学写作与学术交流/research-proposal/SKILL.md
- scientific-writingskills/02-科学写作与学术交流/scientific-writing/SKILL.md
- venue-templatesskills/02-科学写作与学术交流/venue-templates/SKILL.md
- generate-imageskills/03-学术演示与可视化/generate-image/SKILL.md
- infographicsskills/03-学术演示与可视化/infographics/SKILL.md
- latex-postersskills/03-学术演示与可视化/latex-posters/SKILL.md
- markdown-mermaid-writingskills/03-学术演示与可视化/markdown-mermaid-writing/SKILL.md
- paper-slide-deckskills/03-学术演示与可视化/paper-slide-deck/SKILL.md
- pptx-postersskills/03-学术演示与可视化/pptx-posters/SKILL.md
- scientific-schematicsskills/03-学术演示与可视化/scientific-schematics/SKILL.md
- scientific-slidesskills/03-学术演示与可视化/scientific-slides/SKILL.md
- scientific-visualizationskills/03-学术演示与可视化/scientific-visualization/SKILL.md
- consciousness-councilskills/04-研究方法与科学思维/consciousness-council/SKILL.md
- dhdna-profilerskills/04-研究方法与科学思维/dhdna-profiler/SKILL.md
- hypothesis-generationskills/04-研究方法与科学思维/hypothesis-generation/SKILL.md
- nsfc-proposalskills/04-研究方法与科学思维/nsfc-proposal/SKILL.md
- nssfc-proposalskills/04-研究方法与科学思维/nssfc-proposal/SKILL.md
- research-grantsskills/04-研究方法与科学思维/research-grants/SKILL.md
- scholar-evaluationskills/04-研究方法与科学思维/scholar-evaluation/SKILL.md
- scientific-brainstormingskills/04-研究方法与科学思维/scientific-brainstorming/SKILL.md
- scientific-critical-thinkingskills/04-研究方法与科学思维/scientific-critical-thinking/SKILL.md
- what-if-oracleskills/04-研究方法与科学思维/what-if-oracle/SKILL.md
- anndataskills/05-生物信息与基因组学/anndata/SKILL.md
- biopythonskills/05-生物信息与基因组学/biopython/SKILL.md
- bioservicesskills/05-生物信息与基因组学/bioservices/SKILL.md
- cellxgene-censusskills/05-生物信息与基因组学/cellxgene-census/SKILL.md
- deeptoolsskills/05-生物信息与基因组学/deeptools/SKILL.md
- etetoolkitskills/05-生物信息与基因组学/etetoolkit/SKILL.md
- flowioskills/05-生物信息与基因组学/flowio/SKILL.md
- genimlskills/05-生物信息与基因组学/geniml/SKILL.md
- ggetskills/05-生物信息与基因组学/gget/SKILL.md
- gtarsskills/05-生物信息与基因组学/gtars/SKILL.md
- lamindbskills/05-生物信息与基因组学/lamindb/SKILL.md
- phylogeneticsskills/05-生物信息与基因组学/phylogenetics/SKILL.md
- pydeseq2skills/05-生物信息与基因组学/pydeseq2/SKILL.md
- pysamskills/05-生物信息与基因组学/pysam/SKILL.md
- scanpyskills/05-生物信息与基因组学/scanpy/SKILL.md
- scikit-bioskills/05-生物信息与基因组学/scikit-bio/SKILL.md
- scveloskills/05-生物信息与基因组学/scvelo/SKILL.md
- scvi-toolsskills/05-生物信息与基因组学/scvi-tools/SKILL.md
- tiledbvcfskills/05-生物信息与基因组学/tiledbvcf/SKILL.md
- zarr-pythonskills/05-生物信息与基因组学/zarr-python/SKILL.md
- datamolskills/06-化学信息与药物发现/datamol/SKILL.md
- deepchemskills/06-化学信息与药物发现/deepchem/SKILL.md
- diffdockskills/06-化学信息与药物发现/diffdock/SKILL.md
- matchmsskills/06-化学信息与药物发现/matchms/SKILL.md
- medchemskills/06-化学信息与药物发现/medchem/SKILL.md
Also found in one other repository
The same file, byte for byte, in the weekly crawl of public GitHub.
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

