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('has2AYPnZ7KtABo0') at 2025-10-27 08:27:50 UTC
→ notebook imports: bionty==1.8.1 lamindb==1.14a1
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='Nv48yAceNSh80000', version=None, is_latest=True, key='scrna.ipynb', description='scRNA-seq', type='notebook', hash='diKyw8FQzIEzSXX1CFj-dw', reference=None, reference_type=None, branch_id=1, space_id=1, created_by_id=1, created_at=2025-10-27 08:26:50 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 | is_latest | is_locked | created_at | branch_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | ||||||||||||||||||||
| 1 | 5eX4ns5uIaSOGS0I0000 | datasets/conde22.h5ad | None | .h5ad | dataset | AnnData | 57612943 | t_YJQpYrAyAGhs7Ir68zKj | None | 1648 | None | True | False | 2025-10-27 08:27:22.118000+00:00 | 1 | 1 | 1 | 1 | 3 | 1 |
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 | is_latest | is_locked | created_at | branch_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | ||||||||||||||||||||
| 1 | 5eX4ns5uIaSOGS0I0000 | datasets/conde22.h5ad | None | .h5ad | dataset | AnnData | 57612943 | t_YJQpYrAyAGhs7Ir68zKj | None | 1648 | None | True | False | 2025-10-27 08:27:22.118000+00:00 | 1 | 1 | 1 | 1 | 3 | 1 |
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: 5eX4ns5uIaSOGS0I0000 run: N23Vfey (scrna.ipynb) │ kind: dataset otype: AnnData │ hash: t_YJQpYrAyAGhs7Ir68zKj size: 54.9 MB │ branch: main space: all │ created_at: 2025-10-27 08:27:22 UTC created_by: testuser1 │ n_observations: 1648 ├── storage/path: │ /home/runner/work/lamin-usecases/lamin-usecases/docs/test-scrna/.lamindb/5eX4ns5uIaSOGS0I0000.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 kill… │ │ tissue bionty.Tissue blood, bone marrow, caecum, duodenum, i… │ │ donor str │ └── var.T (36283 bionty.Gene.ense… └── Labels └── .tissues bionty.Tissue blood, thoracic lymph node, spleen, lun… .cell_types bionty.CellType classical monocyte, T follicular helper… .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: (0001) | description: 10x reference adata, trusted cell type annotation ├── uid: qLkNeyek9ytE6NGr0001 run: x1mZbdk (scrna2.ipynb) │ kind: dataset otype: AnnData │ hash: GK721a-L-fGDI8kXefKMtA size: 837.2 KB │ branch: main space: all │ created_at: 2025-10-27 08:27:44 UTC created_by: testuser1 │ n_observations: 70 ├── storage/path: │ /home/runner/work/lamin-usecases/lamin-usecases/docs/test-scrna/.lamindb/qLkNeyek9ytE6NGr0001.h5ad ├── Dataset features │ ├── var (754 bionty.Gene) │ │ HES4 float │ │ TNFRSF4 float │ │ SSU72 float │ │ PARK7 float │ │ RBP7 float │ │ SRM float │ │ MAD2L2 float │ │ AGTRAP float │ │ TNFRSF1B float │ │ EFHD2 float │ │ NECAP2 float │ │ HP1BP3 float │ │ C1QA float │ │ C1QB float │ │ HNRNPR float │ │ GALE float │ │ STMN1 float │ │ CD52 float │ │ FGR float │ │ ATP5IF1 float │ └── obs (2) │ cell_type bionty.CellType B cell, CD19-positive, CD14-positive mo… │ cell_type_untrusted bionty.CellType B cell, CD19-positive, CD14-positive mo… └── Labels └── .cell_types bionty.CellType CD8-positive, alpha-beta memory T cell,…
artifact2.view_lineage()