Get a mutual kNN graph (M-kNN) from the latent space (LSI) of single cell profiles

getmutualknn(lsimat, num_k = 30)

Arguments

lsimat

A dense or sparse matrix of cell (rows) x LSI (cols)

num_k

A numeric input (30 by default) for k used for graph construction

Value

A sparse matrix indicating adjacent matrix from single cells used for graph construction

Examples

SE_pbmc5k <- example_data(name="pbmc5k_SE.rda")
peak_by_cell_mat <- SummarizedExperiment::assay(SE_pbmc5k)
#### Downsample to speed up example ####
peak_by_cell_mat <- peak_by_cell_mat[seq_len(500), seq_len(100)]
tfidf_mat <- tfidf(bmat=peak_by_cell_mat)
#> [info] binarize matrix
#> [info] calculate tf
#> [info] calculate idf
#> [info] fast log tf-idf
lsi_mat <- do_lsi(mat=tfidf_mat, dims=30)
#> SVD analysis of TF-IDF matrix
mknn_graph <- getmutualknn(lsimat=lsi_mat, num_k=30)
#> [info] fast knn