% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotting.r
\name{plot_corr}
\alias{plot_corr}
\title{Plot Cell Type Correlation Matrix}
\usage{
plot_corr(
  se,
  assay = c("clr", "counts", "counts_imp", "freq", "freq_imp", "asin_sqrt", "clr_hvc",
    "pb"),
  order = "hclust",
  hclust.method = "ward.D2",
  ...
)
}
\arguments{
\item{se}{A
\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}
object.}

\item{assay}{Character string (default: \code{"clr"}). The name of the assay
in the \code{SummarizedExperiment} object to use for the correlation plot
Must be one of: \code{"clr"} (CLR-transformed abundances, default),
\code{"clr_hvc"} (CLR-transformed abundances of only the most highly
variable cell types (HVCs)), \code{"pb"} (pseudobulk gene expression),
\code{"counts"} (raw counts), \code{"counts_imp"} (imputed counts),
\code{"freq"} (relative frequencies), \code{"freq_imp"} (imputed
frequencies), or \code{"asin_sqrt"} (arcsin-square root transformed data).}

\item{order}{Character string (default: \code{"hclust"}). The ordering method
for the correlation matrix. Common options include:
\itemize{
\item \code{"original"} (no reordering)
\item \code{"hclust"} (hierarchical clustering)
\item \code{"FPC"} (first principal component order)
}}

\item{hclust.method}{Character string (default: \code{"ward.D2"}). The
hierarchical clustering method to use if \code{order} is set to
\code{"hclust"}.}

\item{...}{Additional arguments passed to \code{corrplot::corrplot} for plot
customization (e.g., \code{method}, \code{type}, \code{tl.col}).}
}
\value{
A plot object generated by \code{corrplot::corrplot}, which is a base
R plot or a grid object depending on the \code{corrplot} version and options.
}
\description{
Calculates the pairwise Pearson correlation matrix for all cell
types (columns) using the Centered Log-Ratio (CLR) transformed abundances
stored in \code{assay(se, "clr")}. It then visualizes this matrix as a
heatmap using \code{corrplot::corrplot}.
}
\details{
The function uses the CLR matrix, where high correlation between two
cell types suggests they vary together across samples, indicating potential
co-occurrence or co-regulation.
}
\examples{
data(example_data)
# Example of a large cohort with 868 samples and 69 cell types
se <- ecoda(
    data = example_data$Gongsharma_full$cell_counts$authors_HR,
    metadata = example_data$Gongsharma_full$metadata
)
plot_corr(se)
}
