Analyze the collection and save a result¶
import lamindb as ln
import bionty as bt
ln.track("zzJzdgJ763Dy0000")
→ connected lamindb: testuser1/test-facs
→ created Transform('zzJzdgJ763Dy0000'), started new Run('WFzf7ANh...') at 2025-07-14 06:44:10 UTC
→ notebook imports: bionty==1.6.0 lamindb==1.8.0 scanpy==1.11.3
ln.Collection.df()
collection = ln.Collection.get(key="My versioned cytometry collection", version="2")
adata = collection.load(join="inner")
The AnnData
has the reference to the individual files in the .obs
annotations:
adata.obs.artifact_uid.cat.categories
By default, the intersection of features is used:
adata.var.index
Let us create a plot:
markers = bt.CellMarker.lookup()
import scanpy as sc
sc.pp.pca(adata)
sc.pl.pca(adata, color=markers.cd8.name, save="_cd8")
artifact = ln.Artifact("./figures/pca_cd8.pdf", description="My result on CD8").save()
artifact.view_lineage()
Given the image is part of the notebook, there isn’t an actual need to save it and you can also rely on the report that you’ll create when saving the notebook:
ln.finish()
# clean up test instance
!rm -r test-flow
!lamin delete --force test-facs