Skip to contents

The function takes in a kNN matrix and a batch vector indicating which cell belongs to which batch. The function will check for the neighbourhood of each cell if the proportion of represented batches are different from the overall batch proportions. Good mixing of batches would mean very cells have significant differences; bad mixing a lot of the batches have bad mixing.

Usage

rs_kbet(knn_mat, batch_vector)

Arguments

knn_mat

Integer matrix. The rows represent the cells and the columns the neighbour indices.

batch_vector

Integer vector. The integers indicate to which batch a given cell belongs.

Value

A list with the following items

  • pval - The p-values from the ChiSquare test

  • chi_square_stats - ChiSquare statistics

  • mean_chi_square - The mean ChiSquare value

  • median_chi_square - The median ChiSquare value