pype_from_seurat {cellpypes}R Documentation

Convert Seurat to cellpypes object.

Description

Start cellpyping a Seurat object. This function saves the user from building his own cellpypes object, which is done with list(umi, neighbors,embed, totalUMI).

Usage

pype_from_seurat(seurat, graph_name = NULL)

Arguments

seurat

A Seurat object.

graph_name

Supply one of the graphs. To see options, type names(seurat@graphs). If left empty (NULL, the default), pype_from_seurat will try to guess the correct name for you.

Value

A cellpypes object.

cellpypes Objects

A cellpypes object is a list with four slots:

raw

(sparse) matrix with genes in rows, cells in columns

totalUMI

the colSums of obj$raw

embed

two-dimensional embedding of the cells, provided as data.frame or tibble with two columns and one row per cell.

neighbors

index matrix with one row per cell and k columns, where k is the number of nearest neighbors (we recommend 15<k<100, e.g. k=50). Here are two ways to get the neighbors index matrix:

  • Use find_knn(featureMatrix)$idx, where featureMatrix could be principal components, latent variables or normalized genes (features in rows, cells in columns).

  • use as(seurat@graphs[["RNA_nn"]], "dgCMatrix")> .1 to extract the kNN graph computed on RNA. The > .1 ensures this also works with RNA_snn, wknn/wsnn or any other available graph – check with names(seurat@graphs).


[Package cellpypes version 0.3.0 Index]