Query artifacts¶
Here, we’ll query artifacts and inspect their metadata.
This guide can be skipped if you are only interested in how to leverage the overall collection.
import lamindb as ln
import bionty as bt
ln.track("agayZTonayqA")
Show code cell output
→ connected lamindb: testuser1/test-scrna
→ created Transform('agayZTonayqA0000', key='scrna3.ipynb'), started new Run('juzvaZqWbMGHkEHl') at 2026-01-27 17:32:38 UTC
→ notebook imports: bionty==2.1.0 lamindb==2.0.1
Query artifacts by provenance metadata¶
Query the transform, e.g., by key:
transform = ln.Transform.get(key="scrna.ipynb")
transform
Show code cell output
Transform(uid='nNa3XkxK4lxS0000', version_tag=None, is_latest=True, key='scrna.ipynb', description='scRNA-seq', kind='notebook', hash='RVtPxu74W2GKiKERdix-Rg', reference=None, reference_type=None, environment=None, branch_id=1, space_id=1, created_by_id=3, created_at=2026-01-27 17:31:57 UTC, is_locked=False)
Query the artifact:
ln.Artifact.filter(transform=transform).to_dataframe()
Show code cell output
| uid | key | description | suffix | kind | otype | size | hash | n_files | n_observations | version_tag | is_latest | is_locked | created_at | branch_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | ||||||||||||||||||||
| 1 | RZp8Xk9F17AOSXdT0000 | datasets/conde22.h5ad | None | .h5ad | dataset | AnnData | 57612943 | oHb_G_zCRDhZTJpW_Z5_sm | None | 1648 | None | True | False | 2026-01-27 17:32:23.135000+00:00 | 1 | 1 | 3 | 1 | 3 | 3 |
Query artifacts by biological metadata¶
tissues = bt.Tissue.lookup()
query = ln.Artifact.filter(
tissues=tissues.blood,
)
query.to_dataframe()
Show code cell output
| uid | key | description | suffix | kind | otype | size | hash | n_files | n_observations | version_tag | is_latest | is_locked | created_at | branch_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | ||||||||||||||||||||
| 1 | RZp8Xk9F17AOSXdT0000 | datasets/conde22.h5ad | None | .h5ad | dataset | AnnData | 57612943 | oHb_G_zCRDhZTJpW_Z5_sm | None | 1648 | None | True | False | 2026-01-27 17:32:23.135000+00:00 | 1 | 1 | 3 | 1 | 3 | 3 |
Inspect artifact metadata¶
Query all artifacts that measured the “cell_type” feature:
query_set = ln.Artifact.filter(feature_sets__features__name="cell_type").all()
artifact1, artifact2 = query_set[0], query_set[1]
artifact1.describe()
Show code cell output
Artifact: datasets/conde22.h5ad (0000) ├── uid: RZp8Xk9F17AOSXdT0000 run: deaO2td (scrna.ipynb) │ kind: dataset otype: AnnData │ hash: oHb_G_zCRDhZTJpW_Z5_sm size: 54.9 MB │ branch: main space: all │ created_at: 2026-01-27 17:32:23 UTC created_by: testuser1 │ n_observations: 1648 ├── storage/path: │ /home/runner/work/lamin-usecases/lamin-usecases/docs/test-scrna/.lamindb/RZp8Xk9F17AOSXdT0000.h5ad ├── Dataset features │ ├── obs (4) │ │ assay bionty.ExperimentalFactor 10x 3' v3, 10x 5' v1, 10x 5' v2 │ │ cell_type bionty.CellType CD16-negative, CD56-bright natural kil… │ │ donor str │ │ tissue bionty.Tissue blood, bone marrow, caecum, duodenum, … │ └── var.T (35459 bionty.Gene.ens… └── Labels └── .tissues bionty.Tissue blood, thoracic lymph node, spleen, lu… .cell_types bionty.CellType classical monocyte, T follicular helpe… .experimental_factors bionty.ExperimentalFactor 10x 3' v3, 10x 5' v2, 10x 5' v1
artifact1.view_lineage()
Show code cell output
artifact2.describe()
Show code cell output
Artifact: scrna/dataset2.h5ad (0000) | description: 10x reference adata, trusted cell type annotation ├── uid: zhJzVEdVjvLdR8Ul0000 run: 7MMoNat (scrna2.ipynb) │ kind: dataset otype: AnnData │ hash: -Finjf36qwZVQLR1AzouyA size: 835.8 KB │ branch: main space: all │ created_at: 2026-01-27 17:32:33 UTC created_by: testuser1 │ n_observations: 70 ├── storage/path: │ /home/runner/work/lamin-usecases/lamin-usecases/docs/test-scrna/.lamindb/zhJzVEdVjvLdR8Ul0000.h5ad ├── Dataset features │ ├── obs (1) │ │ cell_type bionty.CellType B cell, CD19-positive, CD14-positive m… │ └── var.T (754 bionty.Gene.ensem… │ AGTRAP num │ ATP5IF1 num │ C1QA num │ C1QB num │ CD52 num │ EFHD2 num │ FGR num │ GALE num │ HES4 num │ HNRNPR num │ HP1BP3 num │ MAD2L2 num │ NECAP2 num │ PARK7 num │ RBP7 num │ SRM num │ SSU72 num │ STMN1 num │ TNFRSF1B num │ TNFRSF4 num └── Labels └── .cell_types bionty.CellType CD8-positive, alpha-beta memory T cell…
artifact2.view_lineage()