facs3/4 Jupyter Notebook lamindata

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('1Y4BdZan40xkSA80') at 2025-10-30 19:02:32 UTC
 notebook imports: bionty==1.8.1 lamindb==1.15a1

Inspect the CellMarker registry

Inspect your aggregated cell marker registry as a DataFrame:

bt.CellMarker.to_dataframe().head()
Hide code cell output
uid name synonyms description 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 67ZpJGSKNFyE CD14|19 None None None None None False 2025-10-30 19:02:26.322000+00:00 1 1 1 2 NaN 1
40 31nZfqQo8yZg CD103 None ITGAE 3682 P38570 False 2025-10-30 19:02:26.311000+00:00 1 1 1 2 12.0 1
39 1iLDs6cZIpxj CD69 None CD69 969 Q07108 False 2025-10-30 19:02:26.311000+00:00 1 1 1 2 12.0 1
38 525YfNUB967z CD49B None ITGA2 3673 P17301 False 2025-10-30 19:02:26.311000+00:00 1 1 1 2 12.0 1
37 3IPMBjs68Vy1 CXCR4 None CXCR4 7852 P61073 False 2025-10-30 19:02:26.311000+00:00 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 name synonyms description 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 33vFR1q26vnM PD1 PID1|PD-1|PD 1 None PDCD1 5133 A0A0M3M0G7 False 2025-10-30 19:02:14.305000+00:00 1 1 1 1 12 1

Look up markers with auto-complete:

markers = bt.CellMarker.lookup()
markers.cd8
Hide code cell output
CellMarker(uid='1xRpnOHIkdyE', name='CD8', synonyms='', description=None, gene_symbol='CD8A', ncbi_gene_id='925', uniprotkb_id='P01732', branch_id=1, space_id=1, created_by_id=1, run_id=1, source_id=12, organism_id=1, created_at=2025-10-30 19:02:14 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.FeatureSet.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 version is_latest is_locked created_at branch_id space_id storage_id run_id schema_id created_by_id
id
2 CNYtRlJCCNsU1Ln50000 None Oetjen18_t1 .h5ad dataset AnnData 46546520 BkQOx3xp3OR4FoOq4CsuJA None 241552 None True False 2025-10-30 19:02:26.849000+00:00 1 1 1 2 None 1
1 ETOh6WcbRg6ggd8P0000 None Alpert19 .h5ad dataset AnnData 33450144 pQFB5xL-IDMLc9WgaYGJlg None 166537 None True False 2025-10-30 19:02:17.726000+00:00 1 1 1 1 None 1

Access registries:

features = ln.Feature.lookup()

Find shared cell markers between two files:

artifacts = ln.Artifact.filter(feature_sets__in=panels_with_cd8).list()
Hide code cell output
/tmp/ipykernel_3948/1674707202.py:1: DeprecationWarning: Use to_list instead of list, list will be removed in the future.
  artifacts = ln.Artifact.filter(feature_sets__in=panels_with_cd8).list()
shared_markers = artifacts[0].features["var"] & artifacts[1].features["var"]
shared_markers.list("name")
Hide code cell output
/tmp/ipykernel_3948/1629185003.py:1: DeprecationWarning: Use slots[slot].members instead of __getitem__, __getitem__ will be removed in the future.
  shared_markers = artifacts[0].features["var"] & artifacts[1].features["var"]
/tmp/ipykernel_3948/1629185003.py:2: DeprecationWarning: Use to_list instead of list, list will be removed in the future.
  shared_markers.list("name")
['Cd4', 'CD8', 'CD3', 'CD27', 'Ccr7', 'CD45RA']