Calculates the fraction of nearest neighbours divided by the expected fraction of nearest neighbours in the patient subgraph.
Usage
calc_snn_specificity(
snn_graph,
cell_idents1,
cell_idents2,
sampling_rate = 0.1,
weighted = T,
ncores = 1
)
Arguments
- snn_graph
A SNN matrix
- cell_idents1
Vector of cell identities for which the specificity will be calculated against. Ideally sample or patient.
- cell_idents2
Vector of cell identities for which define cell types or states. The variable for which we want to see if the factor is specific to cell_idents1.
- sampling_rate
Proportion of cells to subsample when performing calculations.
- weighted
Logical. Whether to weight the identities by their inverse size. Only relevent for the neighbor purity estimated
- ncores
Number of cores to use