Skip to contents

Computes gene-wise correlation between empirical and theoretical quantiles, typically from Q-Q plots, and visualizes the distribution of these correlations as a histogram using ggplot2.

Usage

compute_qq_correlation(
  empirical,
  theoretical,
  method = c("pearson", "spearman"),
  title = NULL,
  x_label = NULL,
  y_label = NULL,
  bins = 50
)

Arguments

empirical

A numeric matrix of empirical quantiles (quantiles × genes)

theoretical

A numeric matrix of theoretical quantiles (same dimensions as empirical)

method

Character string specifying the correlation method: "pearson" (default) or "spearman"

title

Optional main title for the histogram plot

x_label

Optional label for the x-axis (default depends on method)

y_label

Optional label for the y-axis (default: "Count")

bins

Integer specifying the number of bins for the histogram (default: 50)

Value

A named list with the following elements:

cors

A numeric vector of correlation values (length = number of genes)

method

The correlation method used

plot

A ggplot2 object showing the histogram of correlations