\name{reft_kegg_microbe_run}
\alias{reft_kegg_microbe_run}
\title{Run KEGG microbe-EC-reaction search workflow}
\usage{
reft_kegg_microbe_run(
  input_file,
  ec_col = "EC_Number",
  taxonomy_col = "Taxonomy",
  output_dir = NULL,
  output_file = "microbe_ec_kegg_reactions.xlsx",
  sleep_sec = 0.35,
  verbose = TRUE
)
}
\arguments{
  \item{input_file}{Path to input annotation table.}
  \item{ec_col}{Column containing EC numbers. Default is \code{"EC_Number"}.}
  \item{taxonomy_col}{Column containing taxonomy strings. Default is \code{"Taxonomy"}.}
  \item{output_dir}{Output directory. If \code{NULL} (default), no files are written.}
  \item{output_file}{Output Excel filename. Default is
  \code{"microbe_ec_kegg_reactions.xlsx"}.}
  \item{sleep_sec}{Delay between KEGG requests in seconds. Default is \code{0.35}.}
  \item{verbose}{Whether to print progress. Default is \code{TRUE}.}
}
\value{
A named list containing:
\describe{
  \item{results}{Full result table with EC, microbe, reaction, compounds, and formulae.}
  \item{ec_to_reaction}{EC-to-reaction mapping table.}
  \item{reaction_details}{Reaction detail table.}
  \item{compound_table}{Compound formula table.}
}
}
\description{
Import a microbial EC annotation table, normalize EC identifiers, extract
species names from taxonomy strings, query KEGG for EC-linked reactions, and
append reactants, products, and compound formulae. By default, no files are
written; set \code{output_dir} to explicitly request Excel outputs.
}
\examples{
\donttest{
toy <- data.frame(
  EC_Number = "1.1.1.1",
  Taxonomy = "k__Bacteria;p__Proteobacteria;g__Escherichia;s__Escherichia_coli"
)
input_file <- tempfile(fileext = ".csv")
utils::write.csv(toy, input_file, row.names = FALSE)
res <- try(
  reft_kegg_microbe_run(input_file, output_dir = tempdir(), sleep_sec = 0,
                        verbose = FALSE),
  silent = TRUE
)
if (!inherits(res, "try-error")) head(res$results)
}
}
