Skip to content

map_celltypes_knn

map_celltypes_knn(source_x, target_x, target_labels, n_neighbors=15)

Transfer cell-type labels from target cells to source cells with kNN.

Parameters:

  • source_x (array-like of shape (n_source, n_genes)) –

    Source expression matrix receiving transferred labels.

  • target_x (array-like of shape (n_target, n_genes)) –

    Target expression matrix used as kNN reference.

  • target_labels (array-like of shape (n_target,)) –

    Cell-type labels for target_x.

  • n_neighbors (int, default: 15 ) –

    Number of neighbors in the classifier.

Returns:

  • source_labels ( ndarray of shape (n_source,) ) –

    Predicted labels for source_x in target-label space.