Query artifacts .md .md

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")
Hide code cell output
→ connected lamindb: testuser1/test-scrna
→ created Transform('agayZTonayqA0000', key='scrna3.ipynb'), started new Run('dHP5gTCXxIniYUsc') at 2026-10-03 08:36:40 UTC

Query artifacts by provenance metadata

Query the transform, e.g., by key:

transform = ln.Transform.get(key="scrna.ipynb")
transform
Hide code cell output
Transform(uid='p6pdxR5h1UE90000', key='scrna.ipynb', description='scRNA-seq [![.md](https://img.shields.io/badge/source-green)](https://github.com/laminlabs/lamin-usecases/blob/main/docs/scrna.md)', kind='notebook', hash='Q-BNvPG_Hm7JidJIvZ0N7A', 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-10-03 08:35:15 UTC, is_locked=False, version_tag=None, is_latest=True)

Query the artifact:

ln.Artifact.filter(transform=transform).to_dataframe()
Hide 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 CJ1crjZlimjXKmuW0000 datasets/conde22.h5ad None .h5ad dataset AnnData 57612943 oHb_G_zCRDhZTJpW_Z5_sm None 1648 ... True False 2026-10-03 08:36:26.419000+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()
Hide 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 CJ1crjZlimjXKmuW0000 datasets/conde22.h5ad None .h5ad dataset AnnData 57612943 oHb_G_zCRDhZTJpW_Z5_sm None 1648 ... True False 2026-10-03 08:36:26.419000+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()
Hide code cell output
Artifact: datasets/conde22.h5ad (0000)
├── uid: CJ1crjZlimjXKmuW0000            run: ebVI3Np (scrna.ipynb)                                
│   kind: dataset                        otype: AnnData                                            
│   hash: oHb_G_zCRDhZTJpW_Z5_sm         size: 54.9 MB                                             
│   branch: main                         space: all                                                
│   created_at: 2026-10-03 08:36:26 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/CJ1crjZlimjXKmuW0000.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()
Hide code cell output
_images/6a7711d6f244d714bb73de86f7fbf65f1327dbed9140f53e600deb0a8bbcc488.svg
artifact2.describe()
Hide code cell output
Artifact: scrna/dataset2.h5ad (0000)
|   description: 10x reference adata, trusted cell type annotation
├── uid: XsrjSXlB8fQdMM790000            run: otiWJtI (scrna2.ipynb)                               
│   kind: dataset                        otype: AnnData                                            
│   hash: _2aSBNP8ijapYv9NWandtw         size: 835.8 KB                                            
│   branch: main                         space: all                                                
│   created_at: 2026-10-03 08:36:37 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/XsrjSXlB8fQdMM790000.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()
Hide code cell output
_images/122eeec82b214c087e70415c2fc222d249c107b6b3eed0827e711896f55df5f3.svg