Create a heatmap reporting standardized residuals from chi-square test between two variables of interest
a Seurat object containing Kandinsky data
character string, name of the first variable
character string, name of the second variable
lower and upper residual caps for heatmap colour gradient
boolean, whether returning heatmap with cells annotated for significance or not (based on normal distribution fitting)
numeric, number of var.1 and var.2 reshuffling to estimate enrichment pvalue between var.1 and var.2 via permutation test. Default is set to 1000
numeric, adjusted pvalue threshold to define significant var.1/var.2 chisquare residuals. Default value is set to 0.01
character string specifying the alternative hypothesis, must be one of "two.sided", "greater" (default) or "less".
boolean, whether returning only residual plot (FALSE) or also a dataframe containing permutation-based chi-squared test results
residual heatmap created with ggplot2