Query & integrate data露
import lamindb as ln
import bionty as bt
馃挕 connected lamindb: testuser1/test-facs
ln.settings.transform.stem_uid = "wukchS8V976U"
ln.settings.transform.version = "0"
ln.track()
馃挕 notebook imports: bionty==0.44.2 lamindb==0.74.1
馃挕 saved: Transform(uid='wukchS8V976U6K79', version='0', name='Query & integrate data', key='facs3', type='notebook', created_by_id=1, updated_at='2024-07-21 16:22:40 UTC')
馃挕 saved: Run(uid='ovkHDVqnZ8K01cDGpFmw', transform_id=3, created_by_id=1)
Run(uid='ovkHDVqnZ8K01cDGpFmw', started_at='2024-07-21 16:22:40 UTC', is_consecutive=True, transform_id=3, created_by_id=1)
Inspect the CellMarker registry 露
Inspect your aggregated cell marker registry as a DataFrame
:
bt.CellMarker.df().head()
uid | name | synonyms | gene_symbol | ncbi_gene_id | uniprotkb_id | organism_id | public_source_id | run_id | created_by_id | updated_at | |
---|---|---|---|---|---|---|---|---|---|---|---|
id | |||||||||||
41 | 7SyRazPQeCqG | CD14/19 | None | None | None | None | 1 | NaN | 2 | 1 | 2024-07-21 16:22:33.869391+00:00 |
40 | 6ASIQ7GR2c39 | CD103 | ITGAE | 3682 | P38570 | 1 | 26.0 | 2 | 1 | 2024-07-21 16:22:33.858296+00:00 | |
39 | 7OES2NXy0W6C | CD69 | CD69 | 969 | Q07108 | 1 | 26.0 | 2 | 1 | 2024-07-21 16:22:33.858188+00:00 | |
38 | 4Y0JkNLWc8tl | CD49B | ITGA2 | 3673 | P17301 | 1 | 26.0 | 2 | 1 | 2024-07-21 16:22:33.858079+00:00 | |
37 | 2ddvD3rZZ38f | CXCR4 | CXCR4 | 7852 | P61073 | 1 | 26.0 | 2 | 1 | 2024-07-21 16:22:33.857967+00:00 |
Search for a marker (synonyms aware):
bt.CellMarker.search("PD-1").df().head(2)
uid | name | synonyms | gene_symbol | ncbi_gene_id | uniprotkb_id | organism_id | public_source_id | run_id | created_by_id | updated_at | |
---|---|---|---|---|---|---|---|---|---|---|---|
id | |||||||||||
29 | 6c7MomnrsfYu | PD1 | PID1|PD-1|PD 1 | PDCD1 | 5133 | A0A0M3M0G7 | 1 | 26 | 1 | 1 | 2024-07-21 16:22:16.951941+00:00 |
Look up markers with auto-complete:
markers = bt.CellMarker.lookup()
markers.cd8
CellMarker(uid='5YxpB5QNiCWr', name='CD8', synonyms='', gene_symbol='CD8A', ncbi_gene_id='925', uniprotkb_id='P01732', created_by_id=1, run_id=1, organism_id=1, public_source_id=26, updated_at='2024-07-21 16:22:16 UTC')
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).df()
uid | version | description | key | suffix | type | accessor | size | hash | hash_type | n_objects | n_observations | visibility | key_is_virtual | storage_id | transform_id | run_id | created_by_id | updated_at | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | |||||||||||||||||||
1 | mJPPuOTvfOhrNG5ZyMOF | None | Alpert19 | None | .h5ad | dataset | AnnData | 33374864 | QNP1c3p6scaAwPo9AW8fLw | md5 | None | 166537 | 1 | True | 1 | 1 | 1 | 1 | 2024-07-21 16:22:22.949385+00:00 |
2 | phRI7RyREhUvjab79x5B | None | Oetjen18_t1 | None | .h5ad | dataset | AnnData | 46506448 | WbPHGIMM_5GT68rC8ZydHA | md5 | None | 241552 | 1 | True | 1 | 2 | 2 | 1 | 2024-07-21 16:22:34.476103+00:00 |
Access registries:
features = ln.Feature.lookup()
Find shared cell markers between two files:
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")
['Cd4', 'CD8', 'CD3', 'CD27', 'Ccr7', 'CD45RA']