\name{reft_run}
\alias{reft_run}
\title{Run the full REFT workflow}
\usage{
reft_run(
  input_file,
  name_col = "Name",
  other_col = "Other_name(Kegg_name)",
  hmdb_col = "HMDB_ID",
  kegg_col = "Kegg_ID",
  output_dir = NULL,
  output_desc_file = "metabolites_6_descriptors.xlsx",
  output_unmatched_file = "unmatched_smiles.xlsx",
  output_log_file = "pubchem_match_log.xlsx",
  verbose = TRUE
)
}
\arguments{
  \item{input_file}{Path to the input Excel file.}
  \item{name_col}{Column name for compound name. Default is \code{"Name"}.}
  \item{other_col}{Column name for alternative name. Default is
  \code{"Other_name(Kegg_name)"}.}
  \item{hmdb_col}{Column name for HMDB identifier. Default is \code{"HMDB_ID"}.}
  \item{kegg_col}{Column name for KEGG identifier. Default is \code{"Kegg_ID"}.}
  \item{output_dir}{Output directory. If \code{NULL} (default), no files are written.}
  \item{output_desc_file}{Final descriptor Excel filename.}
  \item{output_unmatched_file}{Unmatched records Excel filename.}
  \item{output_log_file}{PubChem match log Excel filename.}
  \item{verbose}{Whether to print progress. Default is \code{TRUE}.}
}
\value{
A named list with three data frames:
\describe{
  \item{descriptors}{Final annotation table with SMILES and six descriptors.}
  \item{unmatched}{Rows that could not be matched to SMILES.}
  \item{match_log}{Unique-query matching log from PubChem.}
}
}
\description{
Import an Excel table, clean query fields, match SMILES from PubChem,
calculate six molecular descriptors, and optionally write Excel outputs.
By default, no files are written; set \code{output_dir} to explicitly request
Excel outputs.
}
\examples{
\donttest{
toy <- data.frame(
  Name = "Glutarate",
  `Other_name(Kegg_name)` = NA,
  HMDB_ID = NA,
  Kegg_ID = NA,
  check.names = FALSE
)
if (requireNamespace("rcdk", quietly = TRUE)) {
  input_file <- tempfile(fileext = ".xlsx")
  writexl::write_xlsx(toy, input_file)
  res <- try(reft_run(input_file, output_dir = tempdir(), verbose = FALSE),
             silent = TRUE)
  if (!inherits(res, "try-error")) head(res$descriptors)
}
}
}
