plot_last {cellpypes} | R Documentation |
Plot the last modified rule or class
Description
Plot the last modified rule or class
Usage
plot_last(
obj,
show_feat = TRUE,
what = "rule",
fast = NULL,
legend_rel_width = 0.3,
overdispersion = 0.01
)
Arguments
obj |
A cellpypes object, see section cellpypes Objects below. |
show_feat |
If TRUE (default), a second panel shows the feature plot of the relevant gene. |
what |
Either "rule" or "class". |
fast |
Set this to TRUE if you want fast plotting in spite of many cells
(using the scattermore package). If NULL (default), cellpypes decides
automatically and fast plotting is done for more than 10k cells, if FALSE
it always uses |
legend_rel_width |
Relative width compared to the other two plots
(only relevant if |
overdispersion |
Defaults to 0.01, only change if you know what you are doing. See further classify. |
Value
Returns a ggplot2 object with the plot.
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 withnames(seurat@graphs)
.
Examples
plot_last(rule(simulated_umis, "T", "CD3E",">", 1))