Skill Tracer
Skills › Scientific Agent Skills › lamindb › integrations.md

integrations.md

137 lines · skills/lamindb/references/integrations.md at 5f2bc03

Open on GitHub
1# Workflow and storage integrations
2
3The common contract is to load a registered input within a tracked execution,
4run the scientific tool, and save the output with its schema and external run
5identifiers. An available tutorial does not mean every external service call is
6automatically tracked. Cloud/service examples below are source-verified patterns,
7not authenticated end-to-end tests.
8

Workflow and storage integrations

The common contract is to load a registered input within a tracked execution, run the scientific tool, and save the output with its schema and external run identifiers. An available tutorial does not mean every external service call is automatically tracked. Cloud/service examples below are source-verified patterns, not authenticated end-to-end tests.

Raw lines 1 to 8
9## Nextflow
11Prefer the official `nf-lamin` plugin to hand-injected Python strings. Current
12upstream compatibility guidance lists **nf-lamin 0.9.0**, LaminDB >=2.0, and
13Nextflow >=25.10.0. Review the plugin configuration for input/output registration,
14storage access, and your executor before deployment.
16Illustrative `lamin.config`, using a preconfigured Nextflow secret:
18```groovy
19plugins {
20 id 'nf-lamin@0.9.0'
22lamin {
23 instance = 'your-org/your-instance'
24 api_key = secrets.LAMIN_API_KEY
26```
28Then run the user's pipeline with `nextflow run <pipeline> -c lamin.config`.
29Configure the secret without exposing it in logs or command history. The plugin
30can also read `LAMIN_CURRENT_INSTANCE` and `LAMIN_API_KEY` environment variables.
31Do not interpolate arbitrary input keys into executable Python/Groovy source.
32The placeholder `<pipeline>` is not a literal runnable pipeline name.
34Sources: [nf-lamin](https://docs.lamin.ai/nf-lamin),
35[Nextflow integration](https://docs.lamin.ai/nextflow).

Nextflow

Prefer the official nf-lamin plugin to hand-injected Python strings. Current upstream compatibility guidance lists nf-lamin 0.9.0, LaminDB >=2.0, and Nextflow >=25.10.0. Review the plugin configuration for input/output registration, storage access, and your executor before deployment.

Illustrative lamin.config, using a preconfigured Nextflow secret:

plugins {
    id 'nf-lamin@0.9.0'
}
lamin {
    instance = 'your-org/your-instance'
    api_key = secrets.LAMIN_API_KEY
}

Then run the user's pipeline with nextflow run <pipeline> -c lamin.config. Configure the secret without exposing it in logs or command history. The plugin can also read LAMIN_CURRENT_INSTANCE and LAMIN_API_KEY environment variables. Do not interpolate arbitrary input keys into executable Python/Groovy source. The placeholder <pipeline> is not a literal runnable pipeline name.

Sources: nf-lamin, Nextflow integration.

Raw lines 9 to 36
37## Snakemake, Redun, and Python workflows
39Use a saved Python script with `ln.track()`/`ln.finish()` at process boundaries,
40or a `@ln.flow()` entry point with `@ln.step()` functions as described in
41[core concepts](core-concepts.md). The executor must inherit the intended instance
42and credentials. Register an external input explicitly if the rule/task only
43receives a filesystem path. Avoid assuming a nested step has an active parent
44run or that a cached scheduler result means a new Lamin run executed.
46Use the official [Snakemake](https://docs.lamin.ai/snakemake) and
47[Redun](https://docs.lamin.ai/redun) examples to configure scheduler-specific
48lifecycle behavior. These integrations were reviewed as documentation; no live
49scheduler was launched in this refresh.

Snakemake, Redun, and Python workflows

Use a saved Python script with ln.track()/ln.finish() at process boundaries, or a @ln.flow() entry point with @ln.step() functions as described in core concepts. The executor must inherit the intended instance and credentials. Register an external input explicitly if the rule/task only receives a filesystem path. Avoid assuming a nested step has an active parent run or that a cached scheduler result means a new Lamin run executed.

Use the official Snakemake and Redun examples to configure scheduler-specific lifecycle behavior. These integrations were reviewed as documentation; no live scheduler was launched in this refresh.

Raw lines 37 to 50
51## W&B, MLflow, model training, and Lightning
53Persist model/checkpoint files with `Artifact`, then attach the external run ID
54as a **defined feature**. This local example is executed without calling either
55service; replace the sample IDs only with actual successful run identifiers:
57```python
58import lamindb as ln
60ln.Feature(name="wandb_run_id", dtype=str).save()
61ln.Feature(name="mlflow_run_id", dtype=str).save()
62# Existing model bytes from a completed, trusted training run:
63model_artifact = ln.Artifact("model.bin", key="models/model.bin").save()
64model_artifact.features.set_values({"wandb_run_id": "example-local-run"})
65```
67Upstream also provides `ln.examples.wandb.save_wandb_features()` and
68`ln.examples.mlflow.save_mlflow_features()` to register broader feature sets.
69Use each service's own lifecycle and upload API separately; a Lamin annotation
70does not upload an artifact to that service. Preserve real metrics, split
71provenance, hyperparameters, and model/code versions. Do not demonstrate invented
72accuracy values as if they were measured.
74Hugging Face/scVI training follows the same pattern: load the appropriate object,
75train with that library's versioned API, save model files and derived AnnData,
76then register those files. A pandas DataFrame is not automatically a compatible
77Transformers training Dataset. Only load trusted pickle/joblib models. Lightning
78has dedicated helpers under `lamindb.integrations.lightning`; consult its API and
79the selected Lightning release instead of inventing callback names.
81Sources: [Lamin integrations API](https://docs.lamin.ai/lamindb.integrations),
82[W&B feature helper](https://github.com/laminlabs/lamindb/blob/2.10.0/lamindb/examples/wandb/__init__.py),
83[MLflow feature helper](https://github.com/laminlabs/lamindb/blob/2.10.0/lamindb/examples/mlflow/__init__.py).

W&B, MLflow, model training, and Lightning

Persist model/checkpoint files with Artifact, then attach the external run ID as a defined feature. This local example is executed without calling either service; replace the sample IDs only with actual successful run identifiers:

import lamindb as ln

ln.Feature(name="wandb_run_id", dtype=str).save()
ln.Feature(name="mlflow_run_id", dtype=str).save()
# Existing model bytes from a completed, trusted training run:
model_artifact = ln.Artifact("model.bin", key="models/model.bin").save()
model_artifact.features.set_values({"wandb_run_id": "example-local-run"})

Upstream also provides ln.examples.wandb.save_wandb_features() and ln.examples.mlflow.save_mlflow_features() to register broader feature sets. Use each service's own lifecycle and upload API separately; a Lamin annotation does not upload an artifact to that service. Preserve real metrics, split provenance, hyperparameters, and model/code versions. Do not demonstrate invented accuracy values as if they were measured.

Hugging Face/scVI training follows the same pattern: load the appropriate object, train with that library's versioned API, save model files and derived AnnData, then register those files. A pandas DataFrame is not automatically a compatible Transformers training Dataset. Only load trusted pickle/joblib models. Lightning has dedicated helpers under lamindb.integrations.lightning; consult its API and the selected Lightning release instead of inventing callback names.

Sources: Lamin integrations API, W&B feature helper, MLflow feature helper.

Raw lines 51 to 84
85## DuckDB and large arrays
87For an existing local or cached Parquet artifact, use a bound path, not string
88interpolation into SQL. This query is illustrative; install/test DuckDB for the
89project before using it on study data:
91```python
92import duckdb
94path = str(artifact.cache())
95with duckdb.connect() as connection:
96 counts = connection.execute(
97 "SELECT condition, count(*) AS n FROM read_parquet(?) GROUP BY condition",
98 [path],
99 ).df()
100ln.Artifact.from_dataframe(counts, key="analysis/condition_counts.parquet").save()
101```
103Caching downloads the complete file. For true streaming use the format-specific
104`Artifact.open()` accessors in [data management](data-management.md).
105TileDB-SOMA needs a valid experiment layout, compatible AnnData/SOMA versions,
106and a schema describing `obs`/measurements. Creating a generic `RNA` collection
107does not build that layout. Optional SOMA/MuData/SpatialData backends were not
108executed here; use current [array guidance](https://docs.lamin.ai/arrays).

DuckDB and large arrays

For an existing local or cached Parquet artifact, use a bound path, not string interpolation into SQL. This query is illustrative; install/test DuckDB for the project before using it on study data:

import duckdb

path = str(artifact.cache())
with duckdb.connect() as connection:
    counts = connection.execute(
        "SELECT condition, count(*) AS n FROM read_parquet(?) GROUP BY condition",
        [path],
    ).df()
ln.Artifact.from_dataframe(counts, key="analysis/condition_counts.parquet").save()

Caching downloads the complete file. For true streaming use the format-specific Artifact.open() accessors in data management. TileDB-SOMA needs a valid experiment layout, compatible AnnData/SOMA versions, and a schema describing obs/measurements. Creating a generic RNA collection does not build that layout. Optional SOMA/MuData/SpatialData backends were not executed here; use current array guidance.

Raw lines 85 to 109
110## Visualization, storage, and external metadata
112Vitessce configuration depends on its dataset wrappers, schema, file types, and
113serving URLs. `VitessceConfig.from_object(adata)` is not a documented Lamin
114integration. Use the official [Vitessce integration](https://docs.lamin.ai/vitessce)
115for a supported configuration and ensure a receiving viewer can resolve every
116URL; merely saving the JSON does not make private data accessible.
118For S3/GCS/custom endpoints see [setup](setup-deployment.md). HTTP/Hugging Face
119paths are source locations whose cache/access behavior depends on the supported
120filesystem and credentials; registration does not guarantee zero-copy streaming.
121For REST/database ingestion, use that service's verified request and pagination
122contract, retrieve the complete intended dataset, validate with a Schema, and
123save provenance with secrets removed. This skill defines no generic REST
124endpoint or universal JSON response schema.

Visualization, storage, and external metadata

Vitessce configuration depends on its dataset wrappers, schema, file types, and serving URLs. VitessceConfig.from_object(adata) is not a documented Lamin integration. Use the official Vitessce integration for a supported configuration and ensure a receiving viewer can resolve every URL; merely saving the JSON does not make private data accessible.

For S3/GCS/custom endpoints see setup. HTTP/Hugging Face paths are source locations whose cache/access behavior depends on the supported filesystem and credentials; registration does not guarantee zero-copy streaming. For REST/database ingestion, use that service's verified request and pagination contract, retrieve the complete intended dataset, validate with a Schema, and save provenance with secrets removed. This skill defines no generic REST endpoint or universal JSON response schema.

Raw lines 110 to 125
126## Schema modules
128`bionty` supplies biological registries. `pertdb` supplies perturbations and
129related compounds/targets; the official full LaminDB install includes it, but
130mount it deliberately (`--modules bionty,pertdb`) for a new relevant instance.
131`Record` can represent lab samples/protocols without a fabricated `wetlab`
132package API. Clinical/Benchling schemas depend on the actual configured module
133or integration; no generic `clinical.Patient(patient_id=...)` contract or
134enterprise plan entitlement is assumed.
136Sources: [pertdb API](https://docs.lamin.ai/pertdb),
137[DuckDB Python API](https://duckdb.org/docs/stable/clients/python/dbapi).

Schema modules

bionty supplies biological registries. pertdb supplies perturbations and related compounds/targets; the official full LaminDB install includes it, but mount it deliberately (--modules bionty,pertdb) for a new relevant instance. Record can represent lab samples/protocols without a fabricated wetlab package API. Clinical/Benchling schemas depend on the actual configured module or integration; no generic clinical.Patient(patient_id=...) contract or enterprise plan entitlement is assumed.

Sources: pertdb API, DuckDB Python API.

Raw lines 126 to 137