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('CwFa92Rr1z7hl66O') at 2026-09-15 10:22:26 UTC
→ notebook imports: bionty==2.5.0 lamindb-core==2.10.0
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='UoOVHpTu0nb20000', key='scrna.ipynb', description='scRNA-seq [](https://github.com/laminlabs/lamin-usecases/blob/main/docs/scrna.md)', kind='notebook', hash='XZDU_wTxDk-GxtsPHOQowg', reference=None, reference_type=None, environment=None, plan=None, branch_id=1, created_on_id=1, space_id=1, run_id=None, created_by_id=1, created_at=2026-09-15 10:21:52 UTC, is_locked=False, version_tag=None, is_latest=True)
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 | ... | is_latest | is_locked | created_at | branch_id | created_on_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||||||||||
| 1 | HTGXwid9pyyEQinC0000 | datasets/conde22.h5ad | None | .h5ad | dataset | AnnData | 57612943 | oHb_G_zCRDhZTJpW_Z5_sm | None | 1648 | ... | True | False | 2026-09-15 10:22:14.412000+00:00 | 1 | 1 | 1 | 1 | 1 | 3 | 1 |
1 rows × 22 columns
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 | ... | is_latest | is_locked | created_at | branch_id | created_on_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||||||||||
| 1 | HTGXwid9pyyEQinC0000 | datasets/conde22.h5ad | None | .h5ad | dataset | AnnData | 57612943 | oHb_G_zCRDhZTJpW_Z5_sm | None | 1648 | ... | True | False | 2026-09-15 10:22:14.412000+00:00 | 1 | 1 | 1 | 1 | 1 | 3 | 1 |
1 rows × 22 columns
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: HTGXwid9pyyEQinC0000 run: eKc7Fj5 (scrna.ipynb) │ kind: dataset otype: AnnData │ hash: oHb_G_zCRDhZTJpW_Z5_sm size: 54.9 MB │ branch: main space: all │ created_at: 2026-09-15 10:22:14 UTC created_by: testuser1 │ n_observations: 1648 schema: anndata_ensembl_gene_ids_and_valid_features_in_obs ├── storage/path: │ /home/runner/work/lamin-usecases/lamin-usecases/docs/test-scrna/.lamindb/HTGXwid9pyyEQinC0000.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 (35445 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: RvVJz54867uQLkyu0000 run: kz6qa6k (scrna2.ipynb) │ kind: dataset otype: AnnData │ hash: _2aSBNP8ijapYv9NWandtw size: 835.8 KB │ branch: main space: all │ created_at: 2026-09-15 10:22:23 UTC created_by: testuser1 │ n_observations: 70 schema: anndata_ensembl_gene_ids_and_valid_features_in_obs ├── storage/path: │ /home/runner/work/lamin-usecases/lamin-usecases/docs/test-scrna/.lamindb/RvVJz54867uQLkyu0000.h5ad ├── Dataset features │ ├── obs (1) │ │ cell_type bionty.CellType B cell, CD19-positive, CD14-positive m… │ └── var.T (754 bionty.Gene.ensem… │ AGTRAP num │ APH1A num │ ARMH1 num │ ATP5IF1 num │ C1QA num │ C1QB num │ C1orf162 num │ CAP1 num │ CD160 num │ CD2 num │ CD52 num │ CD53 num │ CTSS num │ DENND2D num │ EFHD2 num │ EIF3I num │ FGR num │ GALE num │ GBP2 num │ HES4 num │ HNRNPR num │ HP1BP3 num │ JAK1 num │ KYAT3 num │ LCK num │ MAD2L2 num │ MAGOH num │ MARCKSL1 num │ MEAF6 num │ MRPL9 num │ MRPS21 num │ NDUFS5 num │ NECAP2 num │ PARK7 num │ PRDX1 num │ PSMB2 num │ RBP7 num │ RHOC num │ S100A10 num │ SCP2 num │ SESN2 num │ SFPQ num │ SMAP2 num │ SRM num │ SSU72 num │ STMN1 num │ TMEM69 num │ TNFRSF1B num │ TNFRSF4 num │ TXNIP num └── Labels └── .cell_types bionty.CellType CD8-positive, alpha-beta memory T cell…
artifact2.view_lineage()