scbiot.ot.supbiot

Contents

scbiot.ot.supbiot#

scbiot.ot.supbiot(adata, *, use_rep=None, label_key, unlabeled_category='unknown', pred_label_key='pred_cell_type', pred_conf_key='pred_confidence', min_conf=0.25, use_embedding_ref=False, embedding_key=None, embedding_k=10, embedding_weight_power=2.0, inplace=True, out_key=None, verbose=True, **kwargs)#

Label transfer wrapper around transfer_labels using OT metadata.

Parameters#

adata

AnnData object with reference and query cells plus OT metadata.

use_rep

Representation in adata.obsm used for label transfer (alias for out_key).

label_key

Column in adata.obs with labels for reference cells.

unlabeled_category

Label value(s) that identify query cells.

pred_label_key

Output column in adata.obs for predicted labels for only query cells within unlabeled_category.

pred_conf_key

Output column in adata.obs for prediction confidence.

min_conf

Minimum confidence threshold for assigned labels.

use_embedding_ref

If True, project query embeddings into the reference embedding space.

embedding_key

adata.obsm key for embedding projection when use_embedding_ref=True. Projected query embeddings are written back to this key.

embedding_k

Number of neighbors for embedding projection.

embedding_weight_power

Power for distance weights in embedding projection.

inplace

If True, write results back to adata and return it.

out_key

Override the aligned embedding key from OT metadata.

verbose

Print progress messages.

**kwargs

Extra args forwarded to transfer_labels.

Returns#

Any

Updated adata (in place) or a joint AnnData when inplace=False.

Examples#

Basic usage:

>>> import scbiot as scb
>>> adata, metrics = scb.ot.integrate(
...     adata,
...     obsm_key="X_pca",
...     batch_key="batch",    
...     out_key="X_supbiot",    
...     label_key="cell_type",
...     unlabeled_category="Unknown"    
)
>>> adata = scb.ot.supbiot(
...     adata,
...     label_key="cell_type",
...     unlabeled_category="Unknown",
...     pred_label_key='pred_cell_type',
...     pred_conf_key="pred_confidence",
...     min_conf=0.25
)
>>> sc.pl.violin(adata_query, keys="pred_confidence", groupby="pred_cell_type", rotation=90)
Parameters:
Return type:

Any