inspectKNN {RaceID} | R Documentation |
Function for inspecting pruned k-nearest neighbourhoods
Description
This function allows inspection of the local background model and the pruning of nearest neighbours for a given cell. A dimensional reduction representation is plotted where k nearest neighours and outliers are highlighted. Alternatively, the dependence of the transcript count variance or, alternatively, the coefficient of variation (CV) on the mean in log2 space is plotted. The mean-variance dependence is plotted along with a loess-regression, a second order polynomial fit, and the background model of the local variability. The CV plot also highlights the local variability associated with cell-to-cell variability of total transcript counts, as calculated directly from the mean and variance of total transcript counts (turquoise) or from a local fit of a gamma distribution (orange).
Usage
inspectKNN(
i,
expData,
res,
cl,
object = NULL,
nb = res$pars$nb,
pvalue = 0.01,
backModel = NULL,
alpha = res$alpha[i],
plotSymbol = FALSE,
id = NULL,
degree = 2,
span = 0.75,
cv = FALSE,
...
)
Arguments
i |
Either integer column index or column name of |
expData |
Matrix of gene expression values with genes as rows and cells as columns. These values have to correspond to unique molecular identifier counts. |
res |
List object with k nearest neighbour information returned by |
cl |
List object with clustering information, returned by the |
object |
|
nb |
Input parameter of |
pvalue |
Positive real number between 0 and 1. All nearest neighbours with link probability |
backModel |
Optional background model. Second order polynomial fitting the mean-variance dpendence on log2 scales as returned by |
alpha |
Input parameter of |
plotSymbol |
Logical. If |
id |
Valid column name of expData. If |
degree |
Input parameter for mean-variance fit. See |
span |
Input parameter for mean-variance fit. See |
cv |
Input parameter for mean-variance fit. See |
... |
Additional parameters for |
Value
List object with six components:
pv.neighbours.cell |
Vector of outlier p-values (Bonferroni-corrected) for each of the k-nearest neighbours. |
cluster.neighours |
Vector of cluster numbers for central cell and each of the k-nearest neighbours. |
alpha |
|
expr.neighbours |
Matrix of normalized transcript counts for the central cell and each of the k-nearest neighbours (normalized to the minimum number of total trascript counts across all neighours). Additional columns indicate inferred local mean, standard deviation, and strongest outlier p-value. Rows are sorted by p-values of the strongest outlier cell in increasing order. |
pv.neighbours |
Matrix of outlier p-values of all genes for the central cells and each of the k-nearest neighbours. Rows are sorted by p-values of the strongest outlier cell in increasing order. |
strongest.outlier |
Column name of strongest outlier. |