LaminDB
Overview
LaminDB is an open-source data framework for biology designed to make data queryable, traceable, reproducible, and FAIR (Findable, Accessible, Interoperable, Reusable). It provides a unified platform that combines lakehouse architecture, lineage tracking, feature stores, biological ontologies, LIMS (Laboratory Information Management System), and ELN (Electronic Lab Notebook) capabilities through a single Python API.
Core Value Proposition:
- Queryability: Search and filter datasets by metadata, features, and ontology terms
- Traceability: Automatic lineage tracking from raw data through analysis to results
- Reproducibility: Version control for data, code, and environment
- FAIR Compliance: Standardized annotations using biological ontologies
When to Use This Skill
Use this skill when:
- Managing biological datasets: scRNA-seq, bulk RNA-seq, spatial transcriptomics, flow cytometry, multi-modal data, EHR data
- Tracking computational workflows: Notebooks, scripts, pipeline execution (Nextflow, Snakemake, Redun)
- Curating and validating data: Schema validation, standardization, ontology-based annotation
- Working with biological ontologies: Genes, proteins, cell types, tissues, diseases, pathways (via Bionty)
- Building data lakehouses: Unified query interface across multiple datasets
- Ensuring reproducibility: Automatic versioning, lineage tracking, environment capture
- Integrating ML pipelines: Connecting with Weights & Biases, MLflow, HuggingFace, scVI-tools
- Deploying data infrastructure: Setting up local or cloud-based data management systems
- Collaborating on datasets: Sharing curated, annotated data with standardized metadata
Core Capabilities
LaminDB provides six interconnected capability areas, each documented in detail in the references folder.
1. Core Concepts and Data Lineage
Core entities:
- Artifacts: Versioned datasets (DataFrame, AnnData, Parquet, Zarr, etc.)
- Records: Experimental entities (samples, perturbations, instruments)
- Runs & Transforms: Computational lineage tracking (what code produced what data)
- Features: Typed metadata fields for annotation and querying
Key workflows:
- Create and version artifacts from files or Python objects
- Track notebook/script execution with
ln.track() and ln.finish()
- Annotate artifacts with typed features
- Visualize data lineage graphs with
artifact.view_lineage()
- Query by provenance (find all outputs from specific code/inputs)
Reference: references/core-concepts.md - Read this for detailed information on artifacts, records, runs, transforms, features, versioning, and lineage tracking.
2. Data Management and Querying
Query capabilities:
- Registry exploration and lookup with auto-complete
- Single record retrieval with
get(), one(), one_or_none()
- Filtering with comparison operators (
__gt, __lte, __contains, __startswith)
- Feature-based queries (query by annotated metadata)
- Cross-registry traversal with double-underscore syntax
- Full-text search across registries
- Advanced logical queries with Q objects (AND, OR, NOT)
- Streaming large datasets without loading into memory
Key workflows:
- Browse artifacts with filters and ordering
- Query by features, creation date, creator, size, etc.
- Stream large files in chunks or with array slicing
- Organize data with hierarchical keys
- Group artifacts into collections
Reference: references/data-management.md - Read this for comprehensive query patterns, filtering examples, streaming strategies, and data organization best practices.
3. Annotation and Validation
Curation process:
- Validation: Confirm datasets match desired schemas
- Standardization: Fix typos, map synonyms to canonical terms
- Annotation: Link datasets to metadata entities for queryability
Schema types:
- Flexible schemas: Validate only known columns, allow additional metadata
- Minimal required schemas: Specify essential columns, permit extras
- Strict schemas: Complete control over structure and values
Supported data types:
- DataFrames (Parquet, CSV)
- AnnData (single-cell genomics)
- MuData (multi-modal)
- SpatialData (spatial transcriptomics)
- TileDB-SOMA (scalable arrays)
Key workflows:
- Define features and schemas for data validation
- Use
DataFrameCurator or AnnDataCurator for validation
- Standardize values with
.cat.standardize()
- Map to ontologies with
.cat.add_ontology()
- Save curated artifacts with schema linkage
- Query validated datasets by features
Reference: references/annotation-validation.md - Read this for detailed curation workflows, schema design patterns, handling validation errors, and best practices.
4. Biological Ontologies
Available ontologies (via Bionty):
- Genes (Ensembl), Proteins (UniProt)
- Cell types (CL), Cell lines (CLO)
- Tissues (Uberon), Diseases (Mondo, DOID)
- Phenotypes (HPO), Pathways (GO)
- Experimental factors (EFO), Developmental stages
- Organisms (NCBItaxon), Drugs (DrugBank)
Key workflows:
- Import public ontologies with
bt.CellType.import_source()
- Search ontologies with keyword or exact matching
- Standardize terms using synonym mapping
- Explore hierarchical relationships (parents, children, ancestors)
- Validate data against ontology terms
- Annotate datasets with ontology records
- Create custom terms and hierarchies
- Handle multi-organism contexts (human, mouse, etc.)
Reference: references/ontologies.md - Read this for comprehensive ontology operations, standardization strategies, hierarchy navigation, and annotation workflows.
5. Integrations
Workflow managers:
- Nextflow: Track pipeline processes and outputs
- Snakemake: Integrate into Snakemake rules
- Redun: Combine with Redun task tracking
MLOps platforms:
- Weights & Biases: Link experiments with data artifacts
- MLflow: Track models and experiments
- HuggingFace: Track model fine-tuning
- scVI-tools: Single-cell analysis workflows
Storage systems:
- Local filesystem, AWS S3, Google Cloud Storage
- S3-compatible (MinIO, Cloudflare R2)
- HTTP/HTTPS endpoints (read-only)
- HuggingFace datasets
Array stores:
- TileDB-SOMA (with cellxgene support)
- DuckDB for SQL queries on Parquet files
Visualization:
- Vitessce for interactive spatial/single-cell visualization
Version control:
- Git integration for source code tracking
Reference: references/integrations.md - Read this for integration patterns, code examples, and troubleshooting for third-party systems.
6. Setup and Deployment
Installation:
- Basic:
uv pip install lamindb
- With extras:
uv pip install 'lamindb[gcp,zarr,fcs]'
- Modules: bionty, wetlab, clinical
Instance types:
- Local SQLite (development)
- Cloud storage + SQLite (small teams)
- Cloud storage + PostgreSQL (production)
Storage options:
- Local filesystem
- AWS S3 with configurable regions and permissions
- Google Cloud Storage
- S3-compatible endpoints (MinIO, Cloudflare R2)
Configuration:
- Cache management for cloud files
- Multi-user system configurations
- Git repository sync
- Environment variables
Deployment patterns:
- Local dev → Cloud production migration
- Multi-region deployments
- Shared storage with personal instances
Reference: references/setup-deployment.md - Read this for detailed installation, configuration, storage setup, database management, security best practices, and troubleshooting.
Common Use Case Workflows
Use Case 1: Single-Cell RNA-seq Analysis with Ontology Validation
import lamindb as ln
import bionty as bt
import anndata as ad
# Start tracking
ln.track(params={"analysis": "scRNA-seq QC and annotation"})
# Import cell type ontology
bt.CellType.import_source()
# Load data
adata = ad.read_h5ad("raw_counts.h5ad")
# Validate and standardize cell types
adata.obs["cell_type"] = bt.CellType.standardize(adata.obs["cell_type"])
# Curate with schema
curator = ln.curators.AnnDataCurator(adata, schema)
curator.validate()
artifact = curator.save_artifact(key="scrna/validated.h5ad")
# Link ontology annotations
cell_types = bt.CellType.from_values(adata.obs.cell_type)
artifact.feature_sets.add_ontology(cell_types)
ln.finish()
Use Case 2: Building a Queryable Data Lakehouse
import lamindb as ln
# Register multiple experiments
for i, file in enumerate(data_files):
artifact = ln.Artifact.from_anndata(
ad.read_h5ad(file),
key=f"scrna/batch_{i}.h5ad",
description=f"scRNA-seq batch {i}"
).save()
# Annotate with features
artifact.features.add_values({
"batch": i,
"tissue": tissues[i],
"condition": conditions[i]
})
# Query across all experiments
immune_datasets = ln.Artifact.filter(
key__startswith="scrna/",
tissue="PBMC",
condition="treated"
).to_dataframe()
# Load specific datasets
for artifact in immune_datasets:
adata = artifact.load()
# Analyze
Use Case 3: ML Pipeline with W&B Integration
import lamindb as ln
import wandb
# Initialize both systems
wandb.init(project="drug-response", name="exp-42")
ln.track(params={"model": "random_forest", "n_estimators": 100})
# Load training data from LaminDB
train_artifact = ln.Artifact.get(key="datasets/train.parquet")
train_data = train_artifact.load()
# Train model
model = train_model(train_data)
# Log to W&B
wandb.log({"accuracy": 0.95})
# Save model in LaminDB with W&B linkage
import joblib
joblib.dump(model, "model.pkl")
model_artifact = ln.Artifact("model.pkl", key="models/exp-42.pkl").save()
model_artifact.features.add_values({"wandb_run_id": wandb.run.id})
ln.finish()
wandb.finish()
Use Case 4: Nextflow Pipeline Integration
# In Nextflow process script
import lamindb as ln
ln.track()
# Load input artifact
input_artifact = ln.Artifact.get(key="raw/batch_${batch_id}.fastq.gz")
input_path = input_artifact.cache()
# Process (alignment, quantification, etc.)
# ... Nextflow process logic ...
# Save output
output_artifact = ln.Artifact(
"counts.csv",
key="processed/batch_${batch_id}_counts.csv"
).save()
ln.finish()
Getting Started Checklist
To start using LaminDB effectively:
Installation & Setup (references/setup-deployment.md)
- Install LaminDB and required extras
- Authenticate with
lamin login
- Initialize instance with
lamin init --storage ...
Learn Core Concepts (references/core-concepts.md)
- Understand Artifacts, Records, Runs, Transforms
- Practice creating and retrieving artifacts
- Implement
ln.track() and ln.finish() in workflows
Master Querying (references/data-management.md)
- Practice filtering and searching registries
- Learn feature-based queries
- Experiment with streaming large files
Set Up Validation (references/annotation-validation.md)
- Define features relevant to research domain
- Create schemas for data types
- Practice curation workflows
Integrate Ontologies (references/ontologies.md)
- Import relevant biological ontologies (genes, cell types, etc.)
- Validate existing annotations
- Standardize metadata with ontology terms
Connect Tools (references/integrations.md)
- Integrate with existing workflow managers
- Link ML platforms for experiment tracking
- Configure cloud storage and compute
Key Principles
Follow these principles when working with LaminDB:
Track everything: Use ln.track() at the start of every analysis for automatic lineage capture
Validate early: Define schemas and validate data before extensive analysis
Use ontologies: Leverage public biological ontologies for standardized annotations
Organize with keys: Structure artifact keys hierarchically (e.g., project/experiment/batch/file.h5ad)
Query metadata first: Filter and search before loading large files
Version, don't duplicate: Use built-in versioning instead of creating new keys for modifications
Annotate with features: Define typed features for queryable metadata
Document thoroughly: Add descriptions to artifacts, schemas, and transforms
Leverage lineage: Use view_lineage() to understand data provenance
Start local, scale cloud: Develop locally with SQLite, deploy to cloud with PostgreSQL
Reference Files
This skill includes comprehensive reference documentation organized by capability:
references/core-concepts.md - Artifacts, records, runs, transforms, features, versioning, lineage
references/data-management.md - Querying, filtering, searching, streaming, organizing data
references/annotation-validation.md - Schema design, curation workflows, validation strategies
references/ontologies.md - Biological ontology management, standardization, hierarchies
references/integrations.md - Workflow managers, MLOps platforms, storage systems, tools
references/setup-deployment.md - Installation, configuration, deployment, troubleshooting
Read the relevant reference file(s) based on the specific LaminDB capability needed for the task at hand.
Additional Resources
1---2name: lamindb3description: LaminDB4---5# LaminDB67## Overview89LaminDB is an open-source data framework for biology designed to make data queryable, traceable, reproducible, and FAIR (Findable, Accessible, Interoperable, Reusable). It provides a unified platform that combines lakehouse architecture, lineage tracking, feature stores, biological ontologies, LIMS (Laboratory Information Management System), and ELN (Electronic Lab Notebook) capabilities through a single Python API.1011**Core Value Proposition:**12- **Queryability**: Search and filter datasets by metadata, features, and ontology terms13- **Traceability**: Automatic lineage tracking from raw data through analysis to results14- **Reproducibility**: Version control for data, code, and environment15- **FAIR Compliance**: Standardized annotations using biological ontologies1617## When to Use This Skill1819Use this skill when:2021- **Managing biological datasets**: scRNA-seq, bulk RNA-seq, spatial transcriptomics, flow cytometry, multi-modal data, EHR data22- **Tracking computational workflows**: Notebooks, scripts, pipeline execution (Nextflow, Snakemake, Redun)23- **Curating and validating data**: Schema validation, standardization, ontology-based annotation24- **Working with biological ontologies**: Genes, proteins, cell types, tissues, diseases, pathways (via Bionty)25- **Building data lakehouses**: Unified query interface across multiple datasets26- **Ensuring reproducibility**: Automatic versioning, lineage tracking, environment capture27- **Integrating ML pipelines**: Connecting with Weights & Biases, MLflow, HuggingFace, scVI-tools28- **Deploying data infrastructure**: Setting up local or cloud-based data management systems29- **Collaborating on datasets**: Sharing curated, annotated data with standardized metadata3031## Core Capabilities3233LaminDB provides six interconnected capability areas, each documented in detail in the references folder.3435### 1. Core Concepts and Data Lineage3637**Core entities:**38- **Artifacts**: Versioned datasets (DataFrame, AnnData, Parquet, Zarr, etc.)39- **Records**: Experimental entities (samples, perturbations, instruments)40- **Runs & Transforms**: Computational lineage tracking (what code produced what data)41- **Features**: Typed metadata fields for annotation and querying4243**Key workflows:**44- Create and version artifacts from files or Python objects45- Track notebook/script execution with `ln.track()` and `ln.finish()`46- Annotate artifacts with typed features47- Visualize data lineage graphs with `artifact.view_lineage()`48- Query by provenance (find all outputs from specific code/inputs)4950**Reference:** `references/core-concepts.md` - Read this for detailed information on artifacts, records, runs, transforms, features, versioning, and lineage tracking.5152### 2. Data Management and Querying5354**Query capabilities:**55- Registry exploration and lookup with auto-complete56- Single record retrieval with `get()`, `one()`, `one_or_none()`57- Filtering with comparison operators (`__gt`, `__lte`, `__contains`, `__startswith`)58- Feature-based queries (query by annotated metadata)59- Cross-registry traversal with double-underscore syntax60- Full-text search across registries61- Advanced logical queries with Q objects (AND, OR, NOT)62- Streaming large datasets without loading into memory6364**Key workflows:**65- Browse artifacts with filters and ordering66- Query by features, creation date, creator, size, etc.67- Stream large files in chunks or with array slicing68- Organize data with hierarchical keys69- Group artifacts into collections7071**Reference:** `references/data-management.md` - Read this for comprehensive query patterns, filtering examples, streaming strategies, and data organization best practices.7273### 3. Annotation and Validation7475**Curation process:**761. **Validation**: Confirm datasets match desired schemas772. **Standardization**: Fix typos, map synonyms to canonical terms783. **Annotation**: Link datasets to metadata entities for queryability7980**Schema types:**81- **Flexible schemas**: Validate only known columns, allow additional metadata82- **Minimal required schemas**: Specify essential columns, permit extras83- **Strict schemas**: Complete control over structure and values8485**Supported data types:**86- DataFrames (Parquet, CSV)87- AnnData (single-cell genomics)88- MuData (multi-modal)89- SpatialData (spatial transcriptomics)90- TileDB-SOMA (scalable arrays)9192**Key workflows:**93- Define features and schemas for data validation94- Use `DataFrameCurator` or `AnnDataCurator` for validation95- Standardize values with `.cat.standardize()`96- Map to ontologies with `.cat.add_ontology()`97- Save curated artifacts with schema linkage98- Query validated datasets by features99100**Reference:** `references/annotation-validation.md` - Read this for detailed curation workflows, schema design patterns, handling validation errors, and best practices.101102### 4. Biological Ontologies103104**Available ontologies (via Bionty):**105- Genes (Ensembl), Proteins (UniProt)106- Cell types (CL), Cell lines (CLO)107- Tissues (Uberon), Diseases (Mondo, DOID)108- Phenotypes (HPO), Pathways (GO)109- Experimental factors (EFO), Developmental stages110- Organisms (NCBItaxon), Drugs (DrugBank)111112**Key workflows:**113- Import public ontologies with `bt.CellType.import_source()`114- Search ontologies with keyword or exact matching115- Standardize terms using synonym mapping116- Explore hierarchical relationships (parents, children, ancestors)117- Validate data against ontology terms118- Annotate datasets with ontology records119- Create custom terms and hierarchies120- Handle multi-organism contexts (human, mouse, etc.)121122**Reference:** `references/ontologies.md` - Read this for comprehensive ontology operations, standardization strategies, hierarchy navigation, and annotation workflows.123124### 5. Integrations125126**Workflow managers:**127- Nextflow: Track pipeline processes and outputs128- Snakemake: Integrate into Snakemake rules129- Redun: Combine with Redun task tracking130131**MLOps platforms:**132- Weights & Biases: Link experiments with data artifacts133- MLflow: Track models and experiments134- HuggingFace: Track model fine-tuning135- scVI-tools: Single-cell analysis workflows136137**Storage systems:**138- Local filesystem, AWS S3, Google Cloud Storage139- S3-compatible (MinIO, Cloudflare R2)140- HTTP/HTTPS endpoints (read-only)141- HuggingFace datasets142143**Array stores:**144- TileDB-SOMA (with cellxgene support)145- DuckDB for SQL queries on Parquet files146147**Visualization:**148- Vitessce for interactive spatial/single-cell visualization149150**Version control:**151- Git integration for source code tracking152153**Reference:** `references/integrations.md` - Read this for integration patterns, code examples, and troubleshooting for third-party systems.154155### 6. Setup and Deployment156157**Installation:**158- Basic: `uv pip install lamindb`159- With extras: `uv pip install 'lamindb[gcp,zarr,fcs]'`160- Modules: bionty, wetlab, clinical161162**Instance types:**163- Local SQLite (development)164- Cloud storage + SQLite (small teams)165- Cloud storage + PostgreSQL (production)166167**Storage options:**168- Local filesystem169- AWS S3 with configurable regions and permissions170- Google Cloud Storage171- S3-compatible endpoints (MinIO, Cloudflare R2)172173**Configuration:**174- Cache management for cloud files175- Multi-user system configurations176- Git repository sync177- Environment variables178179**Deployment patterns:**180- Local dev → Cloud production migration181- Multi-region deployments182- Shared storage with personal instances183184**Reference:** `references/setup-deployment.md` - Read this for detailed installation, configuration, storage setup, database management, security best practices, and troubleshooting.185186## Common Use Case Workflows187188### Use Case 1: Single-Cell RNA-seq Analysis with Ontology Validation189190```python191import lamindb as ln192import bionty as bt193import anndata as ad194195# Start tracking196ln.track(params={"analysis": "scRNA-seq QC and annotation"})197198# Import cell type ontology199bt.CellType.import_source()200201# Load data202adata = ad.read_h5ad("raw_counts.h5ad")203204# Validate and standardize cell types205adata.obs["cell_type"] = bt.CellType.standardize(adata.obs["cell_type"])206207# Curate with schema208curator = ln.curators.AnnDataCurator(adata, schema)209curator.validate()210artifact = curator.save_artifact(key="scrna/validated.h5ad")211212# Link ontology annotations213cell_types = bt.CellType.from_values(adata.obs.cell_type)214artifact.feature_sets.add_ontology(cell_types)215216ln.finish()217```218219### Use Case 2: Building a Queryable Data Lakehouse220221```python222import lamindb as ln223224# Register multiple experiments225for i, file in enumerate(data_files):226 artifact = ln.Artifact.from_anndata(227 ad.read_h5ad(file),228 key=f"scrna/batch_{i}.h5ad",229 description=f"scRNA-seq batch {i}"230 ).save()231232 # Annotate with features233 artifact.features.add_values({234 "batch": i,235 "tissue": tissues[i],236 "condition": conditions[i]237 })238239# Query across all experiments240immune_datasets = ln.Artifact.filter(241 key__startswith="scrna/",242 tissue="PBMC",243 condition="treated"244).to_dataframe()245246# Load specific datasets247for artifact in immune_datasets:248 adata = artifact.load()249 # Analyze250```251252### Use Case 3: ML Pipeline with W&B Integration253254```python255import lamindb as ln256import wandb257258# Initialize both systems259wandb.init(project="drug-response", name="exp-42")260ln.track(params={"model": "random_forest", "n_estimators": 100})261262# Load training data from LaminDB263train_artifact = ln.Artifact.get(key="datasets/train.parquet")264train_data = train_artifact.load()265266# Train model267model = train_model(train_data)268269# Log to W&B270wandb.log({"accuracy": 0.95})271272# Save model in LaminDB with W&B linkage273import joblib274joblib.dump(model, "model.pkl")275model_artifact = ln.Artifact("model.pkl", key="models/exp-42.pkl").save()276model_artifact.features.add_values({"wandb_run_id": wandb.run.id})277278ln.finish()279wandb.finish()280```281282### Use Case 4: Nextflow Pipeline Integration283284```python285# In Nextflow process script286import lamindb as ln287288ln.track()289290# Load input artifact291input_artifact = ln.Artifact.get(key="raw/batch_${batch_id}.fastq.gz")292input_path = input_artifact.cache()293294# Process (alignment, quantification, etc.)295# ... Nextflow process logic ...296297# Save output298output_artifact = ln.Artifact(299 "counts.csv",300 key="processed/batch_${batch_id}_counts.csv"301).save()302303ln.finish()304```305306## Getting Started Checklist307308To start using LaminDB effectively:3093101. **Installation & Setup** (`references/setup-deployment.md`)311 - Install LaminDB and required extras312 - Authenticate with `lamin login`313 - Initialize instance with `lamin init --storage ...`3143152. **Learn Core Concepts** (`references/core-concepts.md`)316 - Understand Artifacts, Records, Runs, Transforms317 - Practice creating and retrieving artifacts318 - Implement `ln.track()` and `ln.finish()` in workflows3193203. **Master Querying** (`references/data-management.md`)321 - Practice filtering and searching registries322 - Learn feature-based queries323 - Experiment with streaming large files3243254. **Set Up Validation** (`references/annotation-validation.md`)326 - Define features relevant to research domain327 - Create schemas for data types328 - Practice curation workflows3293305. **Integrate Ontologies** (`references/ontologies.md`)331 - Import relevant biological ontologies (genes, cell types, etc.)332 - Validate existing annotations333 - Standardize metadata with ontology terms3343356. **Connect Tools** (`references/integrations.md`)336 - Integrate with existing workflow managers337 - Link ML platforms for experiment tracking338 - Configure cloud storage and compute339340## Key Principles341342Follow these principles when working with LaminDB:3433441. **Track everything**: Use `ln.track()` at the start of every analysis for automatic lineage capture3453462. **Validate early**: Define schemas and validate data before extensive analysis3473483. **Use ontologies**: Leverage public biological ontologies for standardized annotations3493504. **Organize with keys**: Structure artifact keys hierarchically (e.g., `project/experiment/batch/file.h5ad`)3513525. **Query metadata first**: Filter and search before loading large files3533546. **Version, don't duplicate**: Use built-in versioning instead of creating new keys for modifications3553567. **Annotate with features**: Define typed features for queryable metadata3573588. **Document thoroughly**: Add descriptions to artifacts, schemas, and transforms3593609. **Leverage lineage**: Use `view_lineage()` to understand data provenance36136210. **Start local, scale cloud**: Develop locally with SQLite, deploy to cloud with PostgreSQL363364## Reference Files365366This skill includes comprehensive reference documentation organized by capability:367368- **`references/core-concepts.md`** - Artifacts, records, runs, transforms, features, versioning, lineage369- **`references/data-management.md`** - Querying, filtering, searching, streaming, organizing data370- **`references/annotation-validation.md`** - Schema design, curation workflows, validation strategies371- **`references/ontologies.md`** - Biological ontology management, standardization, hierarchies372- **`references/integrations.md`** - Workflow managers, MLOps platforms, storage systems, tools373- **`references/setup-deployment.md`** - Installation, configuration, deployment, troubleshooting374375Read the relevant reference file(s) based on the specific LaminDB capability needed for the task at hand.376377## Additional Resources378379- **Official Documentation**: https://docs.lamin.ai380- **API Reference**: https://docs.lamin.ai/api381- **GitHub Repository**: https://github.com/laminlabs/lamindb382- **Tutorial**: https://docs.lamin.ai/tutorial383- **FAQ**: https://docs.lamin.ai/faq