The rule is defined by feature, operator and threshold.
evaluate_rule(obj, feature, operator, threshold, overdispersion = 0.01)
logical vector stating for each cell whether the rule is true.
A cellpypes object, see section cellpypes Objects below.
Character scalar naming the gene you'd like to threshold.
One of c(">","<")
. Use ">" for positive (CD3E+) and
"<" for negative markers (MS4A1-).
Numeric scalar with the expression threshold separating positive from negative cells. Evaluate_rule expects a plain fraction, not CP10K (while rule has the use_CP10K argument).
Defaults to 0.01, only change it if you know
what you are doing.
If set to 0, the NB simplifies to the Poisson distribution, and larger
values give more variance.
The 0.01 default value follows the recommendation by
Lause, Berens and Kobak (Genome Biology 2021) to use
size=100
in pnbinom for typical data sets.
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)
.