% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotting.r
\name{create_long_data}
\alias{create_long_data}
\title{Reshapes ECODA data into a long format for plotting and analysis.}
\usage{
create_long_data(
  se,
  assay = c("clr", "freq", "asin_sqrt", "clr_hvc"),
  label_col = NULL
)
}
\arguments{
\item{se}{An initialized
\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 plotting. 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{"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{label_col}{Character string (optional, default: \code{NULL}). The name
of a column in \code{colData(se)} to merge into the long data frame (e.g.,
"Disease_State" or "Batch"). If \code{NULL}, only the abundance data and
sample/celltype IDs are returned.}
}
\value{
A tidy, long format data frame with columns:
\itemize{
\item \code{sample_id}: Sample identifier.
\item \code{celltype}: Cell type name.
\item \code{rel_abundance} or \code{clr_abundance}:
The quantitative value depending on the chosen
\code{data_slot}.
\item \code{...}: Additional column specified by
\code{label_col} (if provided).
}
}
\description{
This function takes either the relative abundance (\code{freq}) or
CLR-transformed abundance (\code{clr}) matrix from an
\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}
object, converts it from a wide (cell types x samples) to a long (sample,
cell type, value) format for plotting, and optionally joins it with a
specified column from the sample metadata.
}
\seealso{
\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}
}
