View source: R/compute_metrics.R
jaccardIndex | R Documentation |
The function computes the Jaccard index between all pairs of cells.
jaccardIndex(object, i, by = NULL)
object |
An object of class QFeatures. |
i |
The index of the assay in |
by |
A vector of length equal to the number of columns in
assay |
A data.frame
with as many rows as pairs of cells
and the following column(s):
jaccard
: the computed Jaccard index
by
: if by
is not NULL
, the group of the pair of cells
for which the Jaccard index is computed.
data("scp1")
## Define the identification matrix
peps <- scp1[["peptides"]]
assay(peps) <- ifelse(is.na(assay(peps)), FALSE, TRUE)
scp1 <- addAssay(scp1, peps, "id")
## Compute Jaccard indices
jaccardIndex(scp1, "id")
## Compute Jaccard indices by sample type
jaccardIndex(scp1, "id", scp1$SampleType)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.