labelSpheres {cydar} | R Documentation

## Label unannotated hyperspheres

### Description

Given a set of labels for annotated hyperspheres, propagate labels to the surrounding unannotated hyperspheres.

### Usage

    labelSpheres(x, labels)

### Arguments

`x` | A numeric matrix of hypersphere coordinates, containing the median intensity of each marker (column) in each hypersphere (row). Alternatively, a CyData object containing median intensities for groups of cells, such as that produced by `countCells`.
`labels` | A character vector of labels for each hypersphere, set to an empty string for unannotated hyperspheres.

### Details

After some hyperspheres have been labelled with `interpretSpheres`, the remainder can be automatically labelled with this function. Unlabelled hyperspheres are assigned the label of the closest labelled hypersphere. Obviously, this assumes that enough hyperspheres have been labelled so that the closest hypersphere is of a similar cell type/state.

### Value

A character vector containing labels for all hyperspheres.

### Author(s)

Aaron Lun

### See Also

`interpretSpheres`

### Examples

    set.seed(1000)
    coords <- matrix(rgamma(10000, 2, 2), nrow=1000)
    labels <- character(nrow(coords))
    labels[1:4] <- c("B", "CD4T", "CD8T", "Mono")

    ref <- labelSpheres(coords, labels)
    head(ref)

[Package cydar version 1.10.0 Index]