% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/module1_preqc.R
\name{apply_plate_layout}
\alias{apply_plate_layout}
\title{Stamp a plate-map layout onto measured readings}
\usage{
apply_plate_layout(
  readings,
  layout,
  well_col = "well",
  signal_col = "signal",
  plate_col = "plate_id",
  plate_id = NULL
)
}
\arguments{
\item{readings}{A data frame (or \code{hts_raw}) of readings with at least a well
column and a signal column.}

\item{layout}{An \code{hts_layout} from \code{\link[=read_plate_layout]{read_plate_layout()}}, or a data frame with
\code{well}, \code{well_type}, \code{compound_id} and (optionally) \code{concentration}.}

\item{well_col, signal_col}{Names of the well and signal columns in
\code{readings}.}

\item{plate_col}{Name of the plate column. When present in both \code{readings}
and a multi-plate \code{layout}, wells are matched within each plate.}

\item{plate_id}{Optional plate identifier used when \code{readings} has no plate
column.}
}
\value{
An \code{hts_raw} object with columns \code{plate_id}, \code{well}, \code{row}, \code{col},
\code{well_type}, \code{compound_id}, \code{concentration} and \code{signal}, ready for the rest
of the pipeline.
}
\description{
Joins a user-defined layout from \code{\link[=read_plate_layout]{read_plate_layout()}} onto a table of raw
signal readings, matching by well address (and plate identifier when both
sides carry one), and returns a standard \code{hts_raw} object. This keeps the
\emph{what was measured} (signal) and the \emph{what each well is} (role, compound,
concentration) in separate files, exactly as a screening lab records them,
and lets the same signal export be re-interpreted against different layouts.
}
\examples{
f <- system.file("extdata", "plate_layout_example.csv", package = "diffHTS")
layout <- read_plate_layout(f, plate_id = "P01")
# Simulate a signal export for the same wells.
readings <- data.frame(well = layout$well,
                        signal = runif(nrow(layout), 1e4, 1e5))
raw <- apply_plate_layout(readings, layout, plate_id = "P01")
table(raw$well_type)

}
\seealso{
\code{\link[=read_plate_layout]{read_plate_layout()}}, \code{\link[=read_hts_plate]{read_hts_plate()}}
}
