% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/buildKeggNetwork.R
\name{buildKeggNetwork}
\alias{buildKeggNetwork}
\title{Build KEGG Metabolic and Signaling Network}
\usage{
buildKeggNetwork(metabo_paths = NULL, signaling_paths = NULL)
}
\arguments{
\item{metabo_paths}{Character vector of KEGG pathway IDs for metabolic
pathways (e.g. \code{"hsa00380"}, \code{"eco00380"}). Use \code{NULL} to
exclude the metabolic layer.}

\item{signaling_paths}{Character vector of KEGG pathway IDs for signaling
pathways (e.g. \code{"hsa04060"}, \code{"hsa04630"}). Use \code{NULL} to
exclude the signaling layer.}
}
\value{
A \code{data.frame} with 3 columns:
\describe{
\item{source}{Source node (compound or KO/gene).}
\item{target}{Target node (KO/gene or compound).}
\item{interaction_type}{Interaction type
(e.g. metabolic reaction, activation, inhibition, phosphorylation).}
}
}
\description{
Constructs a directed network (3-column edge list) from user-specified KEGG
metabolic and/or signaling pathways. KEGG KGML files are downloaded and
parsed, networks are merged, organism-specific gene IDs in signaling
pathways are converted to KEGG Orthology (KO) IDs, self-loops are removed,
and interaction types are annotated.
}
\details{
\itemize{
\item All pathways supplied in \code{metabo_paths} and
\code{signaling_paths} must belong to the same organism
(same prefix, e.g. \code{"hsa"}, \code{"eco"}, \code{"bsu"}).
\item If both metabolic and signaling pathways are provided, the output
network is the union of both layers.
\item Invalid or unavailable pathway IDs are skipped with a message, and
the network is built from valid pathways only.
}
}
\examples{
\dontrun{
## Requires extensive KEGG API querying; runtime depends on server response
## Example 1 — Human tryptophan metabolism + immune signaling

## Metabolic pathway: Tryptophan metabolism (human)
metabo_paths_hsa <- c("hsa00380")

## Selected immune / inflammatory signaling pathways (human)
signaling_paths_hsa <- c(
  "hsa04060",  # Cytokine–cytokine receptor interaction
  "hsa04630",  # JAK–STAT signaling pathway
  "hsa04064",  # NF-kappa B signaling pathway
  "hsa04660",  # T cell receptor signaling pathway
  "hsa04659"   # Th17 cell differentiation
)

net_trp_hsa <- buildKeggNetwork(
  metabo_paths    = metabo_paths_hsa,
  signaling_paths = signaling_paths_hsa
)

head(net_trp_hsa)

## Example 2 — E. coli tryptophan metabolism + biosynthesis

metabo_paths_eco <- c(
  "eco00380",  # Tryptophan metabolism (E. coli)
  "eco00400"   # Phenylalanine, tyrosine and tryptophan biosynthesis (E. coli)
)

net_trp_eco <- buildKeggNetwork(
  metabo_paths    = metabo_paths_eco,
  signaling_paths = NULL
)

head(net_trp_eco)
}

}
\seealso{
\code{\link{getPathIDs}} for pathway ID retrieval.
}
