Trains and applies ML models on genomic interval data (BED files) using the geniml Python package. Covers Region2Vec, scEmbed, BEDspace embeddings, consensus universe building, tokenization, and BEDshift randomization. For scATAC-seq clustering, region similarity, and feature learning — not for interval arithmetic.
Ships in alterlab-domain-specific. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
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.
| 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.
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):
uv pip install 'geniml[ml]' # [ml] pulls torch/gensim; needed for region2vec/scembed
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
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.
Geniml provides five primary capabilities, each detailed in dedicated reference files:
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:
Reference: See references/region2vec.md for detailed workflow, parameters, and examples.
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:
Reference: See references/bedspace.md for detailed workflow, search types, and examples.
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:
Reference: See references/scembed.md for detailed workflow, parameters, and examples.
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:
Methods:
Reference: See references/consensus_peaks.md for method comparison, parameters, and examples.
Additional tools for caching, randomization, evaluation, and search.
Available utilities:
Reference: See references/utilities.md for detailed usage of each utility.
from geniml.tokenization.main import hard_tokenization_main
from geniml.region2vec.main_legacy import region2vec
# Step 1: Tokenize BED files against a universe.
# `fraction` (default 1e-9) is the minimum overlap fraction for a hit — NOT a p-value.
# Requires the `bedtools` binary on PATH.
hard_tokenization_main(
src_folder='bed_files/',
dst_folder='tokens/',
universe_file='universe.bed',
fraction=1e-9,
)
# Step 2: Train Region2Vec (word2vec-style over the token "sentences")
region2vec(
token_folder='tokens/',
save_dir='model/',
num_shufflings=1000, # this is also the number of training epochs
embedding_dim=100,
context_win_size=5, # half-window; CLI flag is --context-len
)
import scanpy as sc
from geniml.scembed.main import ScEmbed
from geniml.region2vec.utils import Region2VecDataset
from gtars.tokenizers import Tokenizer
# Step 1: Load AnnData. Peaks must live in adata.var with chr/start/end.
adata = sc.read_h5ad('scatac_data.h5ad')
# Step 2: Build a model bound to a universe tokenizer (gtars).
model = ScEmbed(tokenizer=Tokenizer('universe.bed'))
# Step 3: Train on pre-tokenized cells (a parquet of .gtok tokens).
# Embedding size / negative samples are passed via gensim_params, e.g.
# gensim_params={'vector_size': 100, 'negative': 5}
dataset = Region2VecDataset('tokens.parquet', convert_to_str=True)
model.train(dataset, epochs=100, min_count=1)
# Step 4: Generate cell embeddings and store them.
adata.obsm['scembed_X'] = model.encode(adata, pooling='mean')
# Step 5: Cluster with scanpy
sc.pp.neighbors(adata, use_rep='scembed_X')
sc.tl.leiden(adata)
sc.tl.umap(adata)
# Generate coverage
cat bed_files/*.bed > combined.bed
uniwig -m 25 combined.bed chrom.sizes coverage/
# Build universe with coverage cutoff (top-level command is `build-universe`)
geniml build-universe cc \
--coverage-folder coverage/ \
--output-file universe.bed \
--cutoff 5 \
--merge 100 \
--filter-size 50
# Assess universe quality (command is `assess-universe`)
geniml assess-universe --help # see flags; varies by metric
Geniml provides command-line interfaces for major operations:
# Region2Vec training (--context-len is the half-window; there is no --window-size)
geniml region2vec --token-folder tokens/ --save-dir model/ --num-shuffle 1000 --embed-dim 100
# BEDspace preprocessing
geniml bedspace preprocess --input regions/ --metadata labels.csv --universe universe.bed --output preprocessed/
# BEDspace training (StarSpace must be installed separately)
geniml bedspace train --input preprocessed.txt --output model/ --dim 100
# BEDspace search — the query is POSITIONAL (last arg), not a -q flag
geniml bedspace search -t r2l -d distances.pkl -n 10 query.bed
# Universe building (top-level command is `build-universe`; --output-file, not --output)
geniml build-universe cc --coverage-folder coverage/ --output-file universe.bed --cutoff 5
# BEDshift randomization (-b bedfile, -g refgenie genome OR -l chrom sizes; perturbations
# are rates: -d drop, -a add, -s shift, -c cut, -m merge; -r repeat, -o output)
geniml bedshift -b peaks.bed -g hg38 -s 0.3 -r 100 -o randomized.bed
| 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 |
adata.obsm entriesGeniml is part of the BEDbase ecosystem:
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).
"Tokenization coverage too low":
fraction (e.g. 1e-6 instead of 1e-9) — note this is an overlap fraction, not a p-value"Training not converging":
init_lr / gensim params, ~0.01-0.05)num_shufflings for region2vec; epochs for scEmbed)"Out of memory errors":
embedding_dim"StarSpace not found" (BEDspace):
bedspace train/distances at it with -s / --path-to-starsapce (note: the geniml CLI flag is literally misspelled "starsapce")For detailed troubleshooting and method-specific issues, consult the appropriate reference file.
Part of the AlterLab Academic Skills suite.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
genomic-intervals, bed-files, region-embeddings, scatac-seq, region2vec, scembed
/alterlab-domain-specific:alterlab-genimlfrom alterlab-domain-specific
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-domain-specific18 skills in this plugin
/alterlab-adaptyvPrepares and validates Adaptyv Bio Foundry protein-testing submissions with no account — optimizes and pre-screens sequences locally (NetSolP/SoluProt heuristics, SolubleMPNN, ESM), assembles the experiment payload, and validates it offline against the Foundry's own type/method/sequence rules so it is ready and correct before it costs anything. Submitting to the Foundry, browsing the target catalog, tracking status and retrieving results run through the Foundry API with the user's own ADAPTYV_API_KEY (experiments cost money and take weeks). Use when designing proteins for wet-lab validation (binding/affinity, expression, thermostability, fluorescence), preparing or validating a Foundry submission, pre-screening sequences, or tracking an Adaptyv experiment. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite./alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite./alterlab-astropyProcesses astronomy and astrophysics data with the Astropy Python library — celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, and world coordinate systems (WCS). Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or general astronomical data analysis. Part of the AlterLab Academic Skills suite./alterlab-cirqBuilds, simulates, and runs quantum circuits with Cirq, Google Quantum AI's framework for NISQ hardware, noise-aware low-level circuit design, and noise characterization. Use when targeting Google Quantum AI processors or their Quantum Virtual Machine models (Willow, Sycamore-class Rainbow/Weber), IonQ/AQT/Pasqal via Cirq plugins, designing noise-aware NISQ circuits, or running characterization experiments (randomized benchmarking, XEB). For IBM Quantum hardware and Qiskit Runtime prefer alterlab-qiskit; for gradient-trained quantum ML and hybrid quantum-classical models prefer alterlab-pennylane; for open-system Lindblad/master-equation dynamics prefer alterlab-qutip. Part of the AlterLab Academic Skills suite./alterlab-digital-humanitiesApplies computational methods to humanities research — text mining and NLP (LDA/BERTopic topic modeling, sentiment, named entity recognition with spaCy/NLTK), corpus linguistics (concordance, collocation, keyness), digital archives (Dublin Core, TEI XML), GIS for history, network analysis, stylometry and authorship attribution, OCR (Tesseract, Kraken, Transkribus), and data visualization (Gephi, Palladio). Use when distant-reading a literary corpus, mapping historical events or trade networks, attributing disputed authorship, digitizing historical documents, or building digital scholarly editions. Part of the AlterLab Academic Skills suite./alterlab-fluidsimRuns computational fluid dynamics simulations with the FluidSim Python framework using pseudospectral FFT methods, with HPC support and output analysis. Use when simulating Navier-Stokes equations (2D/3D), shallow water equations, or stratified flows, or when analyzing turbulence, vortex dynamics, or geophysical flows. 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