| name | gcell-causal |
| description | Causal network analysis using gcell. Use this skill when users ask about:
- Inferring causal relationships from expression data
- LiNGAM causal discovery algorithm
- Regulatory network construction
- Visualizing causal/regulatory networks
Triggers: causal network, LiNGAM, causal inference, regulatory network, causal discovery, gene regulatory network
|
Causal Network Analysis
LiNGAM Causal Discovery
LiNGAM (Linear Non-Gaussian Acyclic Model) infers causal structure from observational data by exploiting non-Gaussianity.
from gcell.utils.lingam import run_lingam
import pandas as pd
expression_df = pd.DataFrame(...)
causal_matrix = run_lingam(expression_df)
Interpreting Results
import numpy as np
threshold = 0.1
edges = np.where(np.abs(causal_matrix) > threshold)
for i, j in zip(edges[0], edges[1]):
gene_from = expression_df.columns[j]
gene_to = expression_df.columns[i]
effect = causal_matrix[i, j]
print(f"{gene_from} -> {gene_to}: {effect:.3f}")
Network Visualization
from gcell.utils.causal_lib import visualize_network
visualize_network(causal_matrix, top_edges=50)
Building Gene Regulatory Networks
tf_genes = ['STAT3', 'MYC', 'TP53', 'GATA1']
target_genes = ['BCL2', 'CCND1', 'BAX', 'MDM2']
all_genes = tf_genes + target_genes
expr_subset = expression_df[all_genes]
grn_matrix = run_lingam(expr_subset)
visualize_network(grn_matrix, top_edges=30)
Combining with Cell Type Analysis
from gcell.cell.celltype import GETDemoLoader
loader = GETDemoLoader()
ct = loader.load_celltype('Monocyte')
gbm = ct.get_gene_by_motif()
Key Functions
| Function | Purpose |
|---|
run_lingam() | Infer causal structure from data |
visualize_network() | Plot causal/regulatory network |
Tips
- LiNGAM assumes: linear relationships, non-Gaussian noise, acyclic graph
- More samples improve causal discovery accuracy
- Consider subsetting to relevant genes to reduce computational cost
- Validate inferred edges with known biology