% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/addCustomReaction.R
\name{addCustomReaction}
\alias{addCustomReaction}
\title{Build MetaPathNet-style edges from user-defined reactions}
\usage{
addCustomReaction(
  reaction_table,
  substrate_col = "substrates",
  product_col = "products",
  ko_col = NULL,
  direction_col = NULL
)
}
\arguments{
\item{reaction_table}{A data.frame in which each row corresponds to one
custom reaction.}

\item{substrate_col}{Character. Name of the column containing substrate node
IDs. Multiple IDs must be separated by semicolons.}

\item{product_col}{Character. Name of the column containing product node
IDs. Multiple IDs must be separated by semicolons.}

\item{ko_col}{Optional character. Name of the column containing KO IDs.
Multiple IDs must be separated by semicolons. If \code{NULL}, no KO layer
is added and direct substrate-product edges are returned.}

\item{direction_col}{Optional character. Name of the column containing
reaction direction. Accepted values are \code{"reversible"},
\code{"irreversible"}, and \code{"unknown"}. If \code{NULL}, all reactions
are treated as \code{"unknown"}.}
}
\value{
A character matrix with three columns:
\describe{
\item{source}{Source node ID.}
\item{target}{Target node ID.}
\item{interaction_type}{Reaction type, e.g.
\code{"custom:reversible"}, \code{"custom:irreversible"}, or
\code{"custom:unknown"}.}
}
}
\description{
Convert one or more manually curated reactions into the standard
MetaPathNet 3-column edge list format
(\code{source}, \code{target}, \code{interaction_type}).
}
\details{
Each input row represents one reaction. Substrates and products can contain
one or multiple node IDs, separated by semicolons. Optional KO annotations
can be provided to build compound-KO-compound edges; otherwise the function
returns direct compound-compound edges. User-defined compounds or enzymes can
first be mapped to KEGG identifiers with \code{findKeggIDs()} when possible.
}
\examples{
## Example — Add a user-defined irreversible reaction

## 1) Build a custom reaction table
##    Multiple substrates, products, or KO terms must be separated by semicolons.
custom_df <- data.frame(
  reaction_id = "custom_reaction_1",
  substrates  = "cpd:C00078; cpd:C00001",
  products    = "cpd:C00328",
  ko          = "K00453",
  direction   = "irreversible",
  stringsAsFactors = FALSE
)

## 2) Convert the user-defined reaction into MetaPathNet-style edges
custom_edges <- addCustomReaction(
  reaction_table = custom_df,
  substrate_col  = "substrates",
  product_col    = "products",
  ko_col         = "ko",
  direction_col  = "direction"
)

custom_edges

}
\seealso{
\code{\link{findKeggIDs}}, \code{\link{mapReaction}},
\code{\link{combineNetworks}}
}
