% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/module4_primary.R
\name{select_primary_hit}
\alias{select_primary_hit}
\title{Select primary-screen hits}
\usage{
select_primary_hit(
  data,
  value = "inhibition",
  method = c("threshold", "percentile"),
  threshold = 50,
  percentile = 0.95,
  compound_col = "compound_id"
)
}
\arguments{
\item{data}{An \code{hts_norm} object or long data frame.}

\item{value}{Name of the activity column. Default \code{"inhibition"}.}

\item{method}{Selection mode: \code{"threshold"} (default) keeps compounds with
activity at or above \code{threshold}; \code{"percentile"} keeps the top fraction.}

\item{threshold}{Activity cut-off for \code{method = "threshold"}. Default \code{50}.}

\item{percentile}{Upper fraction to keep for \code{method = "percentile"} (for
example \code{0.95} keeps the top 5 percent). Default \code{0.95}.}

\item{compound_col}{Name of the compound column. Default \code{"compound_id"}.}
}
\value{
A data frame with one row per compound: \code{compound_id}, \code{activity},
\code{is_hit}. The applied cut-off is stored in \code{attr(x, "cutoff")} and the
method in \code{attr(x, "method")}.
}
\description{
Flags active compounds from single-concentration primary-screen data using
either a fixed activity threshold or a percentile rank of the whole library.
}
\examples{
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw)))
hits <- select_primary_hit(norm, threshold = 50)
sum(hits$is_hit)

}
\seealso{
\code{\link[=summarize_primary_hit]{summarize_primary_hit()}}, \code{\link[=plot_primary_inhibition_rank]{plot_primary_inhibition_rank()}}
}
