Migrating to the v1 API#
The v1 API review renamed several parameters so that each name means one thing
across the library. Old names no longer pass through silently: a renamed or
removed keyword raises UnknownParameterError (a
TypeError) that names the replacement.
Renamed and Removed Parameters#
Old |
New |
Applies to |
|---|---|---|
|
|
|
|
|
the dimensional plots and their plurals, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
the dimensional plots, |
|
|
|
|
|
|
# before
cl.umap(data, "leiden", use_key="X_umap_harmony", variable_keys=["CD14"])
cl.dotplot(data, markers, "leiden", markers="wilcoxon", threshold=0.5, sort_by="avg_exp")
cl.volcano(data, "0", key="wilcoxon")
# after
cl.umap(data, "leiden", embedding_key="X_umap_harmony", add_keys=["CD14"])
cl.dotplot(
data,
markers,
"leiden",
markers=True,
ranking_key="wilcoxon",
expression_threshold=0.5,
sort_by="mean_expression",
)
cl.volcano(data, "0", ranking_key="wilcoxon")
To keep the old dotplot column names, pass
percentage_column="pct_exp", mean_column="avg_exp".
Private Helpers#
anndata_observations_frame,anndata_variables_frameandanndata_variable_columnsare private. Build frames withbuild_frame().DeferredLayeris private. Add the layer returned by a layer function (cl.bracket,cl.stream, …) to the plot instead of constructing it.SpatialLibraryErroris removed; it was never raised. Drop it from imports andexceptclauses.
Errors#
Every cellestial error lives in cellestial.errors (also cl.errors) and
subclasses both CellestialError and the builtin it
replaces, so existing except KeyError or except ValueError clauses keep
working.
try:
cl.umap(data, "leiden", use_key="X_umap")
except cl.errors.UnknownParameterError as error:
print(error) # names embedding_key as the replacement
try:
cl.umap(data, "leidn")
except cl.errors.CellestialError as error:
print(error) # suggests 'leiden'
Some failures changed class: unknown keys now raise
KeyNotFoundError (a KeyError) instead of
ValueError. Catch KeyError or KeyNotFoundError for those cases.
Dataset Changes#
The dataset that cl.datasets.pbmc3k() used to load is renamed to
bone_marrow(). It was never the 10x PBMC 3k: it holds
about 17,000 bone marrow mononuclear cells (samples s1d1 and s1d3) from
the scanpy “Preprocessing and clustering” tutorial, with the same
cell_type_lvl1 and leiden_res_* columns. Replace
cl.datasets.pbmc3k() with cl.datasets.bone_marrow() to keep the old
data. Its cell_type_lvl1 column had “B Cells” and “Erythroid” swapped and
left the erythroblast cluster null; the labels are corrected and the column has
no nulls.
pbmc3k() now loads the real 10x Genomics PBMC 3k:
2,638 cells processed as in the scanpy PBMC 3k tutorial, annotated in
cell_type. Code written for the old pbmc3k raises
KeyNotFoundError on cell_type_lvl1 or
leiden_res_0.02.
New in v1#
outline=Trueon the dimensional plots draws a scanpy-style border around the point cloud.outline_widthandoutline_colorset the border and gap.volcanoandvolcanostakemin_fraction_expressed(e.g.0.1) to drop features detected in too few cells of the group.build_framereturns categorical metadata aspl.Enumin the source category order, so legends list categories as the data defines them.
The full list of changes is in the changelog.