% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils_hubgene.R
\name{build_hubgene_network}
\alias{build_hubgene_network}
\title{Build HubGene Network Data Structure (Enhanced with Leading Edge)}
\usage{
build_hubgene_network(
  gsea_task,
  pathway_ids,
  min_hub_degree = 2,
  de_df = NULL,
  res_df = NULL,
  seed = 123
)
}
\arguments{
\item{gsea_task}{GseaTask object}

\item{pathway_ids}{Character vector of selected pathway IDs}

\item{min_hub_degree}{Minimum degree threshold for hub genes (default: 2)}

\item{de_df}{Optional DE data frame containing stat column}

\item{res_df}{Optional pathway result data frame}

\item{seed}{Random seed for reproducibility (default: 123)}
}
\value{
A list with three components:
  \item{nodes}{A list containing pathway and gene data frames}
  \item{edges}{Edge data frame with source, target, and leading edge info}
  \item{hub_df}{Hub gene data frame from extraction}
}
\description{
Build complete network data with leading edge information for edges.
Now properly passes de_df to extract_hub_genes for stat extraction.
}
\examples{
# Load pre-computed GseaRes shipped with the package and pick a task
data(precomputed_gseares, package = "GSEAlens")

gsea_res <- precomputed_gseares
task <- extract_gsea_task(gsea_res, contrast_id = "untrt_vs_trt")

# Pick top 3 enriched pathway IDs from the task result
res_df <- as.data.frame(task$gsea_res)
top_ids <- utils::head(res_df$ID, 3)

# Build the hub-gene network from these pathways
network <- build_hubgene_network(task, top_ids)
names(network)
}
