SKILL.md
Version Compatibility
Reference examples tested with: anndata 0.10+, numpy 1.26+, pandas 2.2+, scanpy 1.10+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Single-Cell Splicing Analysis
Analyze alternative splicing at single-cell resolution.
Tool Selection
| Tool | Approach | Strengths |
|---|---|---|
| BRIE2 | Probabilistic PSI | Handles sparsity, regulatory features |
| leafcutter2 | Intron clustering | NMD detection, novel junctions |
Note: Avoid Whippet.jl (Julia 1.6.7 only, incompatible with Julia 1.9+)
BRIE2 Analysis
Goal: Estimate per-cell PSI values for splicing events with uncertainty quantification.
Approach: Prepare splicing events from annotation, count reads per cell barcode, then fit a Bayesian variational inference model for probabilistic PSI estimation.
"Analyze splicing in single-cell data" -> Estimate per-cell inclusion levels for splicing events with uncertainty.
- Python: BRIE2 (probabilistic PSI, handles sparsity)
- Python/R: leafcutter2 (intron clustering, NMD detection)
import brie
import scanpy as sc
import anndata as ad
# Load single-cell data
adata = sc.read_h5ad('scrnaseq.h5ad')
# Prepare splicing events from annotation
# BRIE2 uses pre-defined splicing events
brie.preprocessing.get_events(
gtf_file='annotation.gtf',
out_file='splicing_events.gff3'
)
# Count reads for splicing events from BAM files
# Requires cell barcodes and UMIs
brie.preprocessing.count(
bam_file='possorted_genome_bam.bam',
gff_file='splicing_events.gff3',
out_dir='brie_counts/',
cell_file='barcodes.tsv' # Filtered cell barcodes
)
# Load BRIE count data
adata_splice = brie.read_h5ad('brie_counts/brie_count.h5ad')
# Run BRIE2 model for PSI estimation
# Uses variational inference for probabilistic estimates
brie.fit(
adata_splice,
layer='raw',
n_epochs=400,
batch_size=512
)
# PSI estimates stored in adata_splice.layers['Psi']
# Uncertainty in adata_splice.layers['Psi_var']
