% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils_hubgene.R
\name{color_by_direction}
\alias{color_by_direction}
\title{Color Nodes by Direction}
\usage{
color_by_direction(
  node_data,
  color_mode = "logFC",
  left_group = "A",
  right_group = "B"
)
}
\arguments{
\item{node_data}{Node data frame with type and direction columns}

\item{color_mode}{Color mode: "logFC", "pathway", or "uniform"}

\item{left_group}{Left group name for legend label}

\item{right_group}{Right group name for legend label}
}
\value{
Node data with added color and color_label columns
}
\description{
Assign colors based on NES (pathways) or log2FC (genes).
}
\examples{
# Build a minimal node data frame (pathway + gene nodes)
nodes <- data.frame(
  name   = c("P_POS", "P_NEG", "G_UP", "G_DOWN"),
  type   = c("pathway", "pathway", "gene", "gene"),
  NES    = c( 2.5, -2.0, NA, NA),
  log2FC = c( NA,  NA, 1.5, -1.2),
  stringsAsFactors = FALSE
)
colored <- color_by_direction(nodes, color_mode = "logFC")
head(colored$color)
}
