scmapCell {scmap} | R Documentation

## For each cell in a query dataset, we search for the nearest neighbours by cosine distance within a collection of reference datasets.

### Description

For each cell in a query dataset, we search for the nearest neighbours by cosine distance within a collection of reference datasets.

### Usage

    scmapCell(projection = NULL, index_list = NULL, w = 10)

    scmapCell.SingleCellExperiment(projection, index_list, w)

    ## S4 method for signature 'SingleCellExperiment'
    scmapCell(projection = NULL,
      index_list = NULL, w = 10)

### Arguments

`projection` | an object of `SingleCellExperiment` class
`index_list` | list of index objects each coming from the output of 'indexCell'
`w` | a positive integer specifying the number of nearest neighbours to find

### Value

a list of 3 objects: 1) a matrix with the closest w neighbours by cell number of each query cell stored by column 2) a matrix of integers giving the reference datasets from which the above cells came from 3) a matrix with the cosine similarities corresponding to each of the nearest neighbours

### Examples

    library(SingleCellExperiment)
    sce <- SingleCellExperiment(assays = list(normcounts = as.matrix(yan)), colData = ann)
    # this is needed to calculate dropout rate for feature selection
    # important: normcounts have the same zeros as raw counts (fpkm)
    counts(sce) <- normcounts(sce)
    logcounts(sce) <- log2(normcounts(sce) + 1)
    # use gene names as feature symbols
    rowData(sce)$feature_symbol <- rownames(sce)
    isSpike(sce, 'ERCC') <- grepl('^ERCC-', rownames(sce))
    # remove features with duplicated names
    sce <- sce[!duplicated(rownames(sce)), ]
    sce <- selectFeatures(sce)
    sce <- indexCell(sce)
    scmapCell_results <- scmapCell(sce, list(metadata(sce)$scmap_cell_index))

[Package scmap version 1.6.0 Index]