% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ggnetview_modularity_heatmaps.R
\name{get_module_eigengene}
\alias{get_module_eigengene}
\title{Compute module eigengene (PC1) from OTU abundance matrix}
\usage{
get_module_eigengene(
  otu_mat,
  graph_obj,
  module_col = "Modularity",
  exclude_others = TRUE,
  scale_pca = TRUE
)
}
\arguments{
\item{otu_mat}{Numeric matrix. Rows = OTUs/ASVs, columns = samples.
Must have rownames (OTU IDs) and colnames (sample IDs).}

\item{graph_obj}{A tbl_graph from build_graph_from_mat or build_graph_from_df.
Must have node attribute \code{name} and a module column.}

\item{module_col}{Character. Name of the module column in graph_obj nodes.
One of \code{"Modularity"}, \code{"modularity3"}, \code{"modularity2"}.}

\item{exclude_others}{Logical. If TRUE, exclude "Others" module from output.}

\item{scale_pca}{Logical. If TRUE, scale variables before PCA (recommended).}
}
\value{
A data frame with samples as rows and module eigengenes as columns.
  Column names are module names.
}
\description{
For each module, performs PCA on the module members' abundance matrix
(samples x OTUs) and returns the first principal component as the
module eigengene. This represents the "overall activity/state" of
each module across samples.
}
\keyword{internal}
