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.
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)
projection |
an object of |
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 |
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
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) # 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))