Query & integrate data¶
import lamindb as ln
import bionty as bt
ln.track("wukchS8V976U0000")
→ connected lamindb: testuser1/test-facs
→ created Transform('wukchS8V976U0000', key='facs3.ipynb'), started new Run('gXH1uGMjFQhyKib3') at 2026-01-18 17:17:21 UTC
→ notebook imports: bionty==2.0.0 lamindb==2.0.0
Inspect the CellMarker registry
¶
Inspect your aggregated cell marker registry as a DataFrame:
bt.CellMarker.to_dataframe().head()
Show code cell output
| uid | abbr | synonyms | description | name | gene_symbol | ncbi_gene_id | uniprotkb_id | is_locked | created_at | branch_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-01-18 17:17:14.948000+00:00 | 1 | 1 | 3 | 2 | NaN | 1 |
| 40 | 31nZfqQo8yZgeb | None | None | CD103 | ITGAE | 3682 | P38570 | False | 2026-01-18 17:17:14.935000+00:00 | 1 | 1 | 3 | 2 | 45.0 | 1 | |
| 39 | 1iLDs6cZIpxjB6 | None | None | CD69 | CD69 | 969 | Q07108 | False | 2026-01-18 17:17:14.935000+00:00 | 1 | 1 | 3 | 2 | 45.0 | 1 | |
| 38 | 525YfNUB967zee | None | None | CD49B | ITGA2 | 3673 | P17301 | False | 2026-01-18 17:17:14.935000+00:00 | 1 | 1 | 3 | 2 | 45.0 | 1 | |
| 37 | 3IPMBjs68Vy1oM | None | None | CXCR4 | CXCR4 | 7852 | P61073 | False | 2026-01-18 17:17:14.935000+00:00 | 1 | 1 | 3 | 2 | 45.0 | 1 |
Search for a marker (synonyms aware):
bt.CellMarker.search("PD-1").to_dataframe().head(2)
Show code cell output
| uid | abbr | synonyms | description | name | gene_symbol | ncbi_gene_id | uniprotkb_id | is_locked | created_at | branch_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-01-18 17:17:01.345000+00:00 | 1 | 1 | 3 | 1 | 45 | 1 |
Look up markers with auto-complete:
markers = bt.CellMarker.lookup()
markers.cd8
Show 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, space_id=1, created_by_id=3, run_id=1, source_id=45, organism_id=1, created_at=2026-01-18 17:17:01 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()
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 | ||||||||||||||||||||
| 2 | jZkvd5cVhxal8es50000 | None | Oetjen18_t1 | .h5ad | dataset | AnnData | 46546520 | BkQOx3xp3OR4FoOq4CsuJA | None | 241552 | None | True | False | 2026-01-18 17:17:15.485000+00:00 | 1 | 1 | 3 | 2 | 3 | 3 |
| 1 | esSUKWduJilr54EX0000 | None | Alpert19 | .h5ad | dataset | AnnData | 33450144 | pQFB5xL-IDMLc9WgaYGJlg | None | 166537 | None | True | False | 2026-01-18 17:17:05.183000+00:00 | 1 | 1 | 3 | 1 | 3 | 3 |
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")
Show code cell output
['Cd4', 'CD8', 'CD3', 'CD27', 'Ccr7', 'CD45RA']