Query & integrate data .md .md

import lamindb as ln
import bionty as bt

ln.track("wukchS8V976U0000")
Hide code cell output
 connected lamindb: testuser1/test-facs
 created Transform('wukchS8V976U0000', key='facs3.ipynb'), started new Run('SdKhKjPymYcwVGTt') at 2026-02-24 14:53:51 UTC
 notebook imports: bionty==2.2.1 lamindb==2.2.1

Inspect the CellMarker registry

Inspect your aggregated cell marker registry as a DataFrame:

bt.CellMarker.to_dataframe().head()
Hide code cell output
uid abbr synonyms description name gene_symbol ncbi_gene_id uniprotkb_id is_locked created_at branch_id created_on_id space_id created_by_id run_id source_id organism_id
id
41 67ZpJGSKNFyEAq None None None CD14|19 None None None False 2026-02-24 14:53:46.392000+00:00 1 1 1 1 2 NaN 1
40 31nZfqQo8yZgeb None None CD103 ITGAE 3682 P38570 False 2026-02-24 14:53:46.378000+00:00 1 1 1 1 2 12.0 1
39 1iLDs6cZIpxjB6 None None CD69 CD69 969 Q07108 False 2026-02-24 14:53:46.378000+00:00 1 1 1 1 2 12.0 1
38 525YfNUB967zee None None CD49B ITGA2 3673 P17301 False 2026-02-24 14:53:46.378000+00:00 1 1 1 1 2 12.0 1
37 3IPMBjs68Vy1oM None None CXCR4 CXCR4 7852 P61073 False 2026-02-24 14:53:46.378000+00:00 1 1 1 1 2 12.0 1

Search for a marker (synonyms aware):

bt.CellMarker.search("PD-1").to_dataframe().head(2)
Hide code cell output
uid abbr synonyms description name gene_symbol ncbi_gene_id uniprotkb_id is_locked created_at branch_id created_on_id space_id created_by_id run_id source_id organism_id
id
29 33vFR1q26vnMbS None PID1|PD-1|PD 1 None PD1 PDCD1 5133 A0A0M3M0G7 False 2026-02-24 14:53:34.294000+00:00 1 1 1 1 1 12 1

Look up markers with auto-complete:

markers = bt.CellMarker.lookup()
markers.cd8
Hide code cell output
CellMarker(uid='1xRpnOHIkdyEXB', abbr=None, synonyms='', description=None, name='CD8', gene_symbol='CD8A', ncbi_gene_id='925', uniprotkb_id='P01732', branch_id=1, created_on_id=1, space_id=1, created_by_id=1, run_id=1, source_id=12, organism_id=1, created_at=2026-02-24 14:53:34 UTC, is_locked=False)

Query artifacts by markers

Query panels and collections based on markers, e.g., which collections have 'CD8' in the flow panel:

panels_with_cd8 = ln.Schema.filter(cell_markers=markers.cd8).all()
ln.Artifact.filter(feature_sets__in=panels_with_cd8).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
2 QDBjHCqE0E4oCdtf0000 None Oetjen18_t1 .h5ad dataset AnnData 46546520 BkQOx3xp3OR4FoOq4CsuJA None 241552 ... True False 2026-02-24 14:53:47.033000+00:00 1 1 1 1 2 3 1
1 ww96sdC4PfernY5y0000 None Alpert19 .h5ad dataset AnnData 33450144 pQFB5xL-IDMLc9WgaYGJlg None 166537 ... True False 2026-02-24 14:53:37.750000+00:00 1 1 1 1 1 3 1

2 rows × 21 columns

Access registries:

features = ln.Feature.lookup()

Find shared cell markers between two files:

artifacts = ln.Artifact.filter(feature_sets__in=panels_with_cd8).to_list()
shared_markers = (
    artifacts[0].features.slots["var.T"].members
    & artifacts[1].features.slots["var.T"].members
)
shared_markers.to_list("name")
Hide code cell output
['Cd4', 'CD8', 'CD3', 'CD27', 'Ccr7', 'CD45RA']