Learn R Programming

inDAGO (version 1.0.0)

CorrPlotHeatmap: CorrPlotHeatmap

Description

Plot a correlation heatmap of top variable genes across samples.

Usage

CorrPlotHeatmap(
  x,
  scale,
  Color,
  type,
  display,
  round_number,
  cutree_rows,
  cutree_cols,
  cluster,
  show_names,
  NumGenes
)

Value

A "pheatmap" object representing the correlation heatmap with clustering.

Arguments

x

Numeric matrix of log-CPM values (genes × samples), e.g., from "edgeR::cpm()".

scale

Character. Scaling mode for the heatmap: "row", "column", or "none".

Color

Character. Name of a continuous palette from the "paletteer" package.

type

Character. Correlation method passed to "Hmisc::rcorr()": "pearson", "spearman", or "kendall".

display

Character. Which matrix to display: "correlation" (coefficients) or "pvalue".

round_number

Integer. Number of decimal places to round displayed numbers.

cutree_rows

Integer. Number of clusters to cut for row dendrogram.

cutree_cols

Integer. Number of clusters to cut for column dendrogram.

cluster

Character. Clustering mode: one of "both", "row", "column", or "none".

show_names

Character. One of "both", "row", "column", or "none" to display row/column labels.

NumGenes

Integer. Number of top-variance genes to include in the correlation.

Details

This function selects the highest-variance genes from a log-CPM matrix, computes pairwise correlation coefficients (or p-values) with "Hmisc::rcorr()", and renders a heatmap via "pheatmap", with options for clustering, scaling, and number display.

  1. Compute per-gene variance and select the top "NumGenes".

  2. Subset the matrix and compute correlations (and p-values) via "Hmisc::rcorr()".

  3. Choose to display correlation coefficients or p-values, rounded to "round_number".

  4. Determine clustering and label visibility from cluster and "show_names".

  5. Render the heatmap with "pheatmap::pheatmap()", passing in custom distance, color, clustering, and "display" number settings, saving to a temporary file to suppress autosave.