alterlab-ieu/alterlab-academic-skills/alterlab-geniml
Claude Code and agent skill by alterlab-ieu/alterlab-academic-skills
- community
Checking that the SKILL.md file is still in the repository.
Machine learning on genomic interval data (BED files) with the geniml Python package — region embeddings (Region2Vec), joint region+metadata embeddings (BEDspace/StarSpace), single-cell ATAC-seq embeddings (scEmbed), consensus peak sets / universes (build-universe), tokenization, BEDshift randomization, and BBClient/BEDbase caching. Use when training or using region/cell embeddings, clustering scATAC-seq, building a tokenization universe from BED collections, or any ML/feature-learning task over genomic regions. NOT for plain interval arithmetic (overlap/intersect/merge counts) — that is gtars, not geniml. Part of the AlterLab Academic Skills suite.
Install
npx vskill@latest install alterlab-ieu/alterlab-academic-skills/alterlab-genimlSKILL.md
The same SKILL.md was published earlier as alterlab-ieu/alterlab-academic-skills/alterlab-geniml.
Geniml: Genomic Interval Machine Learning
Overview
Geniml is a Python package for building machine learning models on genomic interval data from BED files. It provides unsupervised methods for learning embeddings of genomic regions, single cells, and metadata labels, enabling similarity searches, clustering, and downstream ML tasks.
When to Use This Skill
Use this skill for ML over genomic intervals: training or applying Region2Vec / scEmbed / BEDspace embeddings, building consensus universes for tokenization, clustering scATAC-seq cells from region tokens, or BEDshift null models and BBClient caching.
Does NOT Trigger
| Scenario | Use Instead | |
|---|---|---|
| Plain interval arithmetic — overlaps, jaccard, IGD, uniwig tracks, refget digests | alterlab-gtars | |
| Standard scRNA-seq QC → clustering → marker pipeline | alterlab-scanpy | |
| Deep generative single-cell integration (scVI / MultiVI / PeakVI) | alterlab-scvi-tools | |
| Normalized coverage tracks, TSS heatmaps from BAM | alterlab-deeptools |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-gtars) 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.
Installation
Verified against geniml 0.8.4 (still the current release as of 2026-09; it resolves gtars 0.10). Install with uv (prefer uv run --with for one-off runs so nothing leaks into the project env):
scEmbed and scATAC-seq examples also need scanpy: uv pip install scanpy. Universe building (build-universe) and hard tokenization shell out to external binaries — uniwig (coverage tracks) and bedtools — so install those separately.
Development version: uv pip install git+https://github.com/databio/geniml.git
Import paths (verified gotcha)
geniml's subpackage __init__.py files do not re-export their internals, so the obvious short imports fail with ImportError. Import from the concrete module instead:
| Want | Wrong (fails) | Correct (verified) | |
|---|---|---|---|
| Hard tokenization | from geniml.tokenization import hard_tokenization | from geniml.tokenization.main import hard_tokenization_main | |
| Region2Vec (legacy fn) | from geniml.region2vec import region2vec | from geniml.region2vec.main_legacy import region2vec | |
| Region2Vec (model class) | — | from geniml.region2vec.main import Region2VecExModel | |
| scEmbed | from geniml.scembed import ScEmbed | from geniml.scembed.main import ScEmbed | |
| Token dataset | from geniml.io import tokenize_cells (does not exist) | from geniml.region2vec.utils import Region2VecDataset | |
| Tokenizer | — | from gtars.tokenizers import Tokenizer |
Tokenizing cells is handled internally by ScEmbed via a gtars Tokenizer; there is no geniml.io.tokenize_cells function.
Core Capabilities
Geniml provides five primary capabilities, each detailed in dedicated reference files:
1. Region2Vec: Genomic Region Embeddings
Train unsupervised embeddings of genomic regions using word2vec-style learning.
Use for: Dimensionality reduction of BED files, region similarity analysis, feature vectors for downstream ML.
Workflow:
- Tokenize BED files using a universe reference
- Train Region2Vec model on tokens
- Generate embeddings for regions
Reference: See references/region2vec.md for detailed workflow, parameters, and examples.
2. BEDspace: Joint Region and Metadata Embeddings
Train shared embeddings for region sets and metadata labels using StarSpace.
Use for: Metadata-aware searches, cross-modal queries (region→label or label→region), joint analysis of genomic content and experimental conditions.
Workflow:
- Preprocess regions and metadata
- Train BEDspace model
- Compute distances
- Query across regions and labels
Reference: See references/bedspace.md for detailed workflow, search types, and examples.
3. scEmbed: Single-Cell Chromatin Accessibility Embeddings
Train Region2Vec models on single-cell ATAC-seq data for cell-level embeddings.
Use for: scATAC-seq clustering, cell-type annotation, dimensionality reduction of single cells, integration with scanpy workflows.
Workflow:
- Prepare AnnData with peak coordinates
- Pre-tokenize cells
- Train scEmbed model
- Generate cell embeddings
- Cluster and visualize with scanpy
Reference: See references/scembed.md for detailed workflow, parameters, and examples.
4. Consensus Peaks: Universe Building
Build reference peak sets (universes) from BED file collections using multiple statistical methods.
Use for: Creating tokenization references, standardizing regions across datasets, defining consensus features with statistical rigor.
Workflow:
- Combine BED files
- Generate coverage tracks
- Build universe using CC, CCF, ML, or HMM method
Methods:
- CC (Coverage Cutoff): Simple threshold-based
- CCF (Coverage Cutoff Flexible): Confidence intervals for boundaries
- ML (Maximum Likelihood): Probabilistic modeling of positions
- HMM (Hidden Markov Model): Complex state modeling
Reference: See references/consensus_peaks.md for method comparison, parameters, and examples.
5. Utilities: Supporting Tools
Additional tools for caching, randomization, evaluation, and search.
Available utilities:
- BBClient: BED file caching for repeated access
- BEDshift: Randomization preserving genomic context
- Evaluation: Metrics for embedding quality (silhouette, Davies-Bouldin, etc.)
- Tokenization: Region tokenization utilities (hard, soft, universe-based)
- Text2BedNN: Neural search backends for genomic queries
Reference: See references/utilities.md for detailed usage of each utility.
Common Workflows
Basic Region Embedding Pipeline
scATAC-seq Analysis Pipeline
Universe Building and Evaluation
CLI Reference
Geniml provides command-line interfaces for major operations:
When to Use Which Tool
| You have / want | Tool | |
|---|---|---|
| Bulk region sets (ChIP/ATAC-seq), unsupervised embeddings, no metadata | Region2Vec | |
| Region sets plus metadata labels; cross-modal label↔region search | BEDspace | |
| scATAC-seq cells to cluster/annotate (scanpy integration) | scEmbed | |
| A consensus peak set / tokenization reference from many BEDs | build-universe | |
| Cache remote BEDs, null models, embedding metrics | Utilities (BBClient/BEDshift/eval) | |
| Plain interval overlap/intersection/merge counts, no ML | gtars — not geniml |
Best Practices
General Guidelines
- Universe quality is critical: Invest time in building comprehensive, well-constructed universes
- Tokenization validation: Check coverage (>80% ideal) before training
- Parameter tuning: Experiment with embedding dimensions, learning rates, and training epochs
- Evaluation: Always validate embeddings with multiple metrics and visualizations
- Documentation: Record parameters and random seeds for reproducibility
Performance Considerations
- Pre-tokenization: For scEmbed, always pre-tokenize cells for faster training
- Memory management: Large datasets may require batch processing or downsampling
- Computational resources: ML/HMM universe methods are computationally intensive
- Model caching: Use BBClient to avoid repeated downloads
Integration Patterns
- With scanpy: scEmbed embeddings integrate seamlessly as
adata.obsmentries - With BEDbase: Use BBClient for accessing remote BED repositories
- With Hugging Face: Export trained models for sharing and reproducibility
- With R: Use reticulate for R integration (see utilities reference)
Related Projects
Geniml is part of the BEDbase ecosystem:
- BEDbase: Unified platform for genomic regions
- BEDboss: Processing pipeline for BED files
- Gtars: Genomic tools and utilities
- BBClient: Client for BEDbase repositories
Additional Resources
- Documentation: https://docs.bedbase.org/geniml/ (also reachable at https://geniml.databio.org)
- GitHub: https://github.com/databio/geniml
- Pre-trained models: Available on Hugging Face (databio organization)
Troubleshooting
`ImportError` on `from geniml.X import ...`: the subpackage __init__ doesn't re-export it — import from the concrete module (see the Import paths table above).
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/domain-specific/alterlab-geniml/SKILL.md
Popularity
- Repository stars
- 66
- Repository forks
- 13
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alterlab-ieu/alterlab-academic-skills/alterlab-geniml)