| Title: | Differential Drug Sensitivity Analysis for Two-Condition High-Throughput Screens |
|---|---|
| Description: | A complete workflow for large-scale, two-condition high-throughput drug screening (HTS). It compares drug sensitivity between any two experimental conditions - for example irradiated versus non-irradiated cells, cancer versus normal cell lines, or treated versus untreated samples - across many plates and experiments. The package covers the full pipeline: control-based normalisation, plate-level quality-control metrics (Z-factor, Z-prime, signal-to-background, signal-to-noise and strictly standardised mean difference), replicate-consistency checks, four-parameter logistic dose-response fitting with area under the curve (AUC) estimation, differential (delta) AUC scoring with within-plate standardisation, cut-off and sigma-based hit selection, and publication-ready heatmap, scatter and quality-control visualisations. |
| Authors: | Liang Tang [aut, cre] |
| Maintainer: | Liang Tang <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-09-27 08:46:32 UTC |
| Source: | https://github.com/cran/diffHTS |
Joins external compound metadata (name, target, mechanism, library source) onto a hit table.
annotate_hit_info(hits, meta, by = "compound_id")annotate_hit_info(hits, meta, by = "compound_id")
hits |
A hit data frame (for example from |
meta |
A metadata data frame such as hts_compound_meta. |
by |
Join key present in both. Default |
hits with the metadata columns merged in (left join), row order
preserved.
rank_hit_compound(), export_hit_table()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) annotate_hit_info(rank_hit_compound(params), hts_compound_meta)drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) annotate_hit_info(rank_hit_compound(params), hts_compound_meta)
Joins a user-defined layout from 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 hts_raw object. This keeps the
what was measured (signal) and the 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.
apply_plate_layout( readings, layout, well_col = "well", signal_col = "signal", plate_col = "plate_id", plate_id = NULL )apply_plate_layout( readings, layout, well_col = "well", signal_col = "signal", plate_col = "plate_id", plate_id = NULL )
readings |
A data frame (or |
layout |
An |
well_col, signal_col
|
Names of the well and signal columns in
|
plate_col |
Name of the plate column. When present in both |
plate_id |
Optional plate identifier used when |
An hts_raw object with columns plate_id, well, row, col,
well_type, compound_id, concentration and signal, ready for the rest
of the pipeline.
read_plate_layout(), read_hts_plate()
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)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)
Removes the per-plate instrument background by subtracting the mean blank
(no-cell) signal from every well, a standard first step for luminescence and
fluorescence readouts. The original signal is preserved in signal_raw.
baseline_subtract(hts_raw, blank_label = "Blank", clip_zero = TRUE)baseline_subtract(hts_raw, blank_label = "Blank", clip_zero = TRUE)
hts_raw |
An |
blank_label |
Well-type label identifying blank wells. Default
|
clip_zero |
Logical; if |
The input object with signal replaced by the background-subtracted
value and a new signal_raw column holding the original signal.
read_hts_plate(), norm_by_control()
raw <- read_hts_plate(hts_primary_raw) bs <- baseline_subtract(raw) head(bs[, c("well_type", "signal_raw", "signal")])raw <- read_hts_plate(hts_primary_raw) bs <- baseline_subtract(raw) head(bs[, c("well_type", "signal_raw", "signal")])
Reshapes long AUC results into a numeric matrix with compounds as rows and samples (for example cell lines or batches) as columns, optionally standardised to Z-scores for comparability.
build_auc_matrix( data, row_col = "compound_id", col_col = "cell_line", value_col = "auc", zscore = c("none", "row", "column") )build_auc_matrix( data, row_col = "compound_id", col_col = "cell_line", value_col = "auc", zscore = c("none", "row", "column") )
data |
A data frame with compound, sample and AUC columns (typically
|
row_col |
Compound column. Default |
col_col |
Sample column. Default |
value_col |
AUC column. Default |
zscore |
Standardisation: |
A numeric matrix (compounds x samples). The standardisation used is
stored in attr(x, "zscore").
cluster_auc_matrix(), plot_auc_heatmap()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) build_auc_matrix(drc$meta)drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) build_auc_matrix(drc$meta)
The percent CV (100 * SD / mean) of each control population. What it is
for: CV% is the direct measure of pipetting and reagent-handling
reproducibility within a plate. Low, stable control CVs are a precondition
for every other metric; a control drifting above ~15–20% flags a liquid-
handling or edge-effect problem even when the Z'-factor still passes.
calc_cv( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", cv_max = 20 )calc_cv( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", cv_max = 20 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
cv_max |
Acceptance threshold in percent, applied to both controls.
Default |
A data frame with one row per plate: plate_id, cv_nc, cv_pc
(percent) and a logical pass (both controls at or below cv_max).
calc_plate_qc(), plot_plate_qc()
calc_cv(read_hts_plate(hts_primary_raw))calc_cv(read_hts_plate(hts_primary_raw))
Computes the area under each fitted curve by trapezoidal integration of the fitted 4PL over the tested concentration range (on the log10 scale), a robust single-number summary of overall potency.
calc_drc_auc(drc)calc_drc_auc(drc)
drc |
An |
The hts_drc object with an auc column added to its meta, also
returned invisibly as a data frame via drc$meta.
compute_auc(), extract_drc_params()
drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") calc_drc_auc(drc)$metadrc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") calc_drc_auc(drc)$meta
Computes the full panel of assay-quality metrics used to judge a
high-throughput screening plate, in a single per-plate table. Alongside the
classic Z'-factor this reports the median/MAD-based robust Z'-factor, the
sample-aware Z-factor, SSMD, the signal-to-background (S/B) and
signal-to-noise (S/N) ratios, and the coefficient of variation (CV%)
of each control population. All of these can then be visualised through the
single entry point plot_plate_qc().
calc_plate_qc( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", sample_label = "compound", z_prime_min = 0.5 )calc_plate_qc( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", sample_label = "compound", z_prime_min = 0.5 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
sample_label |
Well-type label for the test (compound) wells, used by
the sample-aware Z-factor. Default |
z_prime_min |
Acceptance threshold applied to the Z'-factor to set the
|
Each metric also has its own dedicated function, useful when you only need one
number (and each with its own acceptance threshold): calc_z_prime(),
calc_robust_z_prime(), calc_z_factor(), calc_ssmd(), calc_sb_ratio(),
calc_sn_ratio() and calc_cv(). calc_plate_qc() uses the very same
formulas so the numbers agree.
What each metric tells you, with the high-signal control taken as whichever of NC/PC has the larger mean and the low-signal control as the other:
CV% of each control — pipetting/reagent
reproducibility; lower is better.
S/B — raw dynamic range of the assay.
S/N — assay window
relative to background noise.
Z'-factor
— overall control-only assay quality (>= 0.5 excellent).
Robust Z'-factor: as Z'-factor but with medians and MADs, resistant to outlier control wells.
Z-factor
using the sample population — is the window large versus the
library spread (often low/negative in primary screens).
SSMD
— effect-size measure of control separation for hit cut-offs.
A data frame with one row per plate and the columns plate_id,
mean_nc, mean_pc, sd_nc, sd_pc, cv_nc, cv_pc, signal_window,
sb (signal-to-background), sn (signal-to-noise), z_prime,
robust_z_prime, z_factor, ssmd and a logical pass.
plot_plate_qc(), calc_z_prime(), calc_well_zscore()
raw <- read_hts_plate(hts_primary_raw) calc_plate_qc(raw)raw <- read_hts_plate(hts_primary_raw) calc_plate_qc(raw)
Computes the Pearson correlation (and its ) between the per-compound
activity of every pair of replicate plates, the standard check that technical
replicates agree.
calc_replicate_correlation( data, value = "viability", compound_col = "compound_id", plate_col = "plate_id" )calc_replicate_correlation( data, value = "viability", compound_col = "compound_id", plate_col = "plate_id" )
data |
An |
value |
Name of the value column. Default |
compound_col |
Name of the compound column. Default |
plate_col |
Name of the plate column. Default |
A data frame with one row per plate pair: plate_x, plate_y, n,
pearson_r and r_squared. The wide compound-by-plate matrix is attached
as attr(x, "wide") for use by plot_replicate_scatter().
calc_replicate_cv(), plot_replicate_scatter()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) calc_replicate_correlation(norm)norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) calc_replicate_correlation(norm)
Computes, for each compound, the coefficient of variation (CV, percent) across its technical replicates (repeated wells, whether on the same plate or across plates), a standard measure of assay reproducibility.
calc_replicate_cv( data, value = "viability", compound_col = "compound_id", group_cols = NULL )calc_replicate_cv( data, value = "viability", compound_col = "compound_id", group_cols = NULL )
data |
An |
value |
Name of the value column on which to compute the CV. Default
|
compound_col |
Name of the compound column. Default |
group_cols |
Optional additional grouping columns (for example
|
A data frame with one row per compound (and any group_cols):
compound_id, the grouping columns, n, mean, sd and cv (percent).
calc_replicate_correlation(), filter_bad_replicate()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) cv <- calc_replicate_cv(norm) head(cv[order(-cv$cv), ])norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) cv <- calc_replicate_cv(norm) head(cv[order(-cv$cv), ])
Median/MAD version of the Z'-factor. What it is for: it answers the same
question as calc_z_prime() — how cleanly the positive and negative controls
separate — but because it uses the median and the median absolute deviation
instead of the mean and SD, a couple of splashed or crystallised control
wells cannot single-handedly sink an otherwise good plate. Prefer it when
control replicates occasionally contain outliers.
calc_robust_z_prime( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", z_prime_min = 0.5 )calc_robust_z_prime( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", z_prime_min = 0.5 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
z_prime_min |
Acceptance threshold ( |
A data frame with one row per plate: plate_id, median_nc,
median_pc, mad_nc, mad_pc, robust_z_prime and a logical pass.
calc_z_prime(), calc_plate_qc(), plot_plate_qc()
calc_robust_z_prime(read_hts_plate(hts_primary_raw))calc_robust_z_prime(read_hts_plate(hts_primary_raw))
The ratio of the high-signal control mean to the low-signal control mean.
What it is for: S/B is the quickest sanity check that the assay actually
produced a usable dynamic range — that the untreated (high) and killed (low)
controls are far enough apart on the raw scale. It ignores variability, so it
complements but does not replace the Z'-factor; a common minimum is >= 2.
calc_sb_ratio( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", sb_min = 2 )calc_sb_ratio( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", sb_min = 2 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
sb_min |
Acceptance threshold. Default |
A data frame with one row per plate: plate_id, mean_nc,
mean_pc, sb (high-mean / low-mean) and a logical pass.
calc_sn_ratio(), calc_plate_qc()
calc_sb_ratio(read_hts_plate(hts_primary_raw))calc_sb_ratio(read_hts_plate(hts_primary_raw))
The assay window divided by the noise of the low-signal control. What it is
for: S/N asks whether the separation between the two controls is large
compared with the background scatter, i.e. whether a real change would rise
above the noise floor. It is more informative than S/B because it accounts
for variability; higher is better, with >= 3 a reasonable floor.
calc_sn_ratio( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", sn_min = 3 )calc_sn_ratio( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", sn_min = 3 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
sn_min |
Acceptance threshold. Default |
A data frame with one row per plate: plate_id, mean_nc,
mean_pc, sn (window / low-control SD) and a logical pass.
calc_sb_ratio(), calc_plate_qc()
calc_sn_ratio(read_hts_plate(hts_primary_raw))calc_sn_ratio(read_hts_plate(hts_primary_raw))
The mean control difference divided by the pooled control spread. What it
is for: SSMD is the effect-size measure of control separation, and it is
the statistically principled companion to the Z'-factor for setting hit
cut-offs. Its magnitude grades the assay — roughly |SSMD| >= 2 is
excellent, 1–2 good and < 1 weak — independent of the number of
control replicates.
calc_ssmd( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", ssmd_min = 2 )calc_ssmd( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", ssmd_min = 2 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
ssmd_min |
Acceptance threshold applied to |
A data frame with one row per plate: plate_id, mean_nc,
mean_pc, sd_nc, sd_pc, ssmd and a logical pass. The sign of
ssmd follows mean_nc - mean_pc.
calc_z_prime(), calc_plate_qc()
calc_ssmd(read_hts_plate(hts_primary_raw))calc_ssmd(read_hts_plate(hts_primary_raw))
Standardises every well's signal within its plate, adding both a classic Z-score (mean/SD based) and a robust Z-score (median/MAD based, which is the preferred choice in HTS because it is not distorted by the very hits the screen is looking for). Scores are computed against a per-plate reference population, by default the test-compound wells.
calc_well_zscore( hts_raw, signal_col = "signal", reference = c("compound", "negative", "all"), nc_label = "NC", sample_label = "compound" )calc_well_zscore( hts_raw, signal_col = "signal", reference = c("compound", "negative", "all"), nc_label = "NC", sample_label = "compound" )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
reference |
One of |
nc_label, sample_label
|
Well-type labels for the negative controls and test wells, used to pick the reference population. |
The input object with two added columns: zscore (mean/SD based) and
robust_zscore (median/MAD based, MAD scaled to the normal distribution).
calc_plate_qc(), plot_plate_qc()
raw <- read_hts_plate(hts_primary_raw) scored <- calc_well_zscore(raw) head(scored[, c("plate_id", "well", "zscore", "robust_zscore")])raw <- read_hts_plate(hts_primary_raw) scored <- calc_well_zscore(raw) head(scored[, c("plate_id", "well", "zscore", "robust_zscore")])
The screening-window quality factor computed from the test-compound
population against the negative control. What it is for: unlike the
Z'-factor (controls only), the Z-factor tells you whether the assay window is
large enough relative to the spread of the actual library wells. Values above
0.5 indicate an excellent screen and 0–0.5 a marginal one; it is
routinely low or negative in a single-point primary screen, because most
library compounds are inactive and therefore sit at the negative-control
level — that is expected, not a failure.
calc_z_factor( hts_raw, signal_col = "signal", nc_label = "NC", sample_label = "compound", z_factor_min = 0.5 )calc_z_factor( hts_raw, signal_col = "signal", nc_label = "NC", sample_label = "compound", z_factor_min = 0.5 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, sample_label
|
Well-type labels for the negative control and
the test wells. Defaults |
z_factor_min |
Acceptance threshold. Default |
A data frame with one row per plate: plate_id, mean_sample,
mean_nc, sd_sample, sd_nc, z_factor and a logical pass.
calc_z_prime(), calc_plate_qc()
calc_z_factor(read_hts_plate(hts_primary_raw))calc_z_factor(read_hts_plate(hts_primary_raw))
Calculates the Z' (Z-prime) factor for each plate from its negative- and positive-control populations and flags plates against an acceptance threshold.
calc_z_prime( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", z_prime_min = 0.5 )calc_z_prime( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC", z_prime_min = 0.5 )
hts_raw |
An |
signal_col |
Name of the signal column. Default |
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
z_prime_min |
Acceptance threshold. Default |
A data frame with one row per plate: plate_id, mean_nc,
mean_pc, sd_nc, sd_pc, z_prime and a logical pass.
filter_valid_plates(), plot_plate_qc()
raw <- read_hts_plate(hts_primary_raw) calc_z_prime(raw)raw <- read_hts_plate(hts_primary_raw) calc_z_prime(raw)
Computes the standard set of assay quality metrics for a single plate from per-control-type summary statistics: the Z-factor, Z-prime (Z'), the signal-to-background ratio, the signal-to-noise ratio and the strictly standardised mean difference (SSMD).
calculate_qc_metrics(df)calculate_qc_metrics(df)
df |
A data frame describing one plate with one row per control type. It
must contain the columns |
The metrics follow the usual HTS definitions, using the negative control and positive (kill) control populations:
with signal-to-background , signal-to-noise
and
.
A one-row data frame with columns z_factor, z_prime, sb_value,
sn_value and ssmd_value.
plate <- data.frame( experiment_type = c("negative_ctrl", "positive_cttl", "sample"), mean = c(1.00, 0.10, 0.60), sd = c(0.05, 0.03, 0.20) ) calculate_qc_metrics(plate)plate <- data.frame( experiment_type = c("negative_ctrl", "positive_cttl", "sample"), mean = c(1.00, 0.10, 0.60), sd = c(0.05, 0.03, 0.20) ) calculate_qc_metrics(plate)
Checks that a data frame contains the expected negative-, positive- and blank-control labels in its well-type column, so that normalisation and QC can be carried out. It is a light-weight guard to run right after import.
check_control_label(data, type_col = "well_type", required = c("NC", "PC"))check_control_label(data, type_col = "well_type", required = c("NC", "PC"))
data |
A data frame of well-level readouts. |
type_col |
Name of the well-type column, as a string. Default
|
required |
Character vector of labels that must be present. Default
|
Invisibly, a list with ok (logical), present and missing
(character vectors) and counts (a table of well-type frequencies). A
warning is emitted when any required label is missing.
d <- data.frame(well_type = c("NC", "NC", "PC", "compound")) check_control_label(d)d <- data.frame(well_type = c("NC", "NC", "PC", "compound")) check_control_label(d)
Cleans free-text compound identifiers into a consistent form: trims surrounding whitespace, collapses internal whitespace, and replaces illegal or separator characters with underscores so that IDs can be matched and used safely in file names.
clean_compound_id(x, to_upper = TRUE)clean_compound_id(x, to_upper = TRUE)
x |
A character vector of compound identifiers. |
to_upper |
Logical; if |
A character vector of cleaned identifiers.
clean_compound_id(c(" cpd 001 ", "Drug/A", "cpd-002!"))clean_compound_id(c(" cpd 001 ", "Drug/A", "cpd-002!"))
Removes newlines and characters that are illegal in file names on common operating systems, so that drug names or plate labels can be turned into safe output file names.
clean_filename(filename_str)clean_filename(filename_str)
filename_str |
A character vector of candidate file names. |
A character vector with newlines removed, / and : replaced by
_ and - respectively, and the characters * ? " < > | stripped.
clean_filename("Drug A/B: 10\u00b5M?")clean_filename("Drug A/B: 10\u00b5M?")
Performs hierarchical clustering of the compounds (rows) and samples (columns) of an AUC matrix and cuts the compound tree into groups.
cluster_auc_matrix(mat, k = 3, distance = "euclidean", method = "complete")cluster_auc_matrix(mat, k = 3, distance = "euclidean", method = "complete")
mat |
A numeric matrix from |
k |
Number of compound clusters to cut. Default |
distance |
Distance method for |
method |
Linkage method for |
A list with row_hclust, col_hclust (or NULL if too few
columns), clusters (named integer vector of compound cluster ids) and
k.
extract_cluster_hit(), plot_cluster_tree()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) cl <- cluster_auc_matrix(build_auc_matrix(drc$meta), k = 2) table(cl$clusters)drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) cl <- cluster_auc_matrix(build_auc_matrix(drc$meta), k = 2) table(cl$clusters)
Integrates a fitted four_pl() curve between two concentrations to obtain
the area under the curve (AUC), a robust summary of drug potency used for
between-condition comparisons.
compute_auc(min_concentration, max_concentration, top, ic50, hill, bottom)compute_auc(min_concentration, max_concentration, top, ic50, hill, bottom)
min_concentration |
Lower integration limit (minimum tested concentration). |
max_concentration |
Upper integration limit (maximum tested concentration). |
top, ic50, hill, bottom
|
Four-parameter logistic parameters, as in
|
A single numeric value: the integrated area under the curve. When
integration fails (for example a degenerate fit) NA_real_ is returned
with a warning.
four_pl(), fit_dose_response()
compute_auc( min_concentration = 0.01, max_concentration = 10, top = 1, ic50 = 1, hill = 1, bottom = 0 )compute_auc( min_concentration = 0.01, max_concentration = 10, top = 1, ic50 = 1, hill = 1, bottom = 0 )
Contrasts drug potency between two experimental conditions by reshaping a long per-drug/per-condition AUC table to one row per drug and computing the differential AUC together with its within-experiment z-score. This is the core scoring step for two-condition screens (for example irradiated versus non-irradiated, or treated versus control).
compute_delta_auc( data, drug_col = "drug_name", condition_col = "condition", auc_col = "auc", conditions = NULL )compute_delta_auc( data, drug_col = "drug_name", condition_col = "condition", auc_col = "auc", conditions = NULL )
data |
A long-format data frame with one row per drug and condition. |
drug_col |
Name of the drug identifier column, as a string. Default
|
condition_col |
Name of the condition column, as a string. Default
|
auc_col |
Name of the AUC column, as a string. Default |
conditions |
Character vector of length two giving the baseline and
treatment condition, in the order |
A negative delta_auc indicates the treatment condition sensitises
cells to the drug relative to baseline (lower AUC = more killing). The
z-score standardises delta_auc across all drugs within the experiment so
that hits can be selected on a common scale (see select_hits_sigma()).
A data frame with one row per drug containing the two per-condition
AUC columns (named auc_<condition>), delta_auc and zscore_delta_auc
(the z-scored delta_auc across all drugs).
select_hits_cutoff(), select_hits_sigma()
auc_long <- data.frame( drug_name = rep(c("DrugA", "DrugB", "DrugC"), each = 2), condition = rep(c("Gy0", "Gy2"), times = 3), auc = c(5.0, 3.1, 4.2, 4.0, 6.0, 2.0) ) compute_delta_auc(auc_long, conditions = c("Gy0", "Gy2"))auc_long <- data.frame( drug_name = rep(c("DrugA", "DrugB", "DrugC"), each = 2), condition = rep(c("Gy0", "Gy2"), times = 3), auc = c(5.0, 3.1, 4.2, 4.0, 6.0, 2.0) ) compute_delta_auc(auc_long, conditions = c("Gy0", "Gy2"))
Transforms a concentration vector to log10, the scale on which
dose-response curves are usually drawn and fitted. Non-positive values (for
example the zero-dose controls) become NA.
convert_conc_log10(x, shift_min = FALSE)convert_conc_log10(x, shift_min = FALSE)
x |
Numeric vector of concentrations (factors/characters are coerced). |
shift_min |
Logical; if |
A numeric vector of log10 concentrations.
convert_conc_log10(c(0.01, 0.1, 1, 10, 100)) convert_conc_log10(c(0.01, 0.1, 1, 10, 100), shift_min = TRUE)convert_conc_log10(c(0.01, 0.1, 1, 10, 100)) convert_conc_log10(c(0.01, 0.1, 1, 10, 100), shift_min = TRUE)
Detects anomalous wells (for example contaminated, bubble or crystallisation artefacts) using the interquartile-range rule within groups of comparable wells, and optionally removes them.
detect_outlier_wells( hts_raw, signal_col = "signal", group_cols = c("plate_id", "well_type"), k = 1.5, filter = FALSE )detect_outlier_wells( hts_raw, signal_col = "signal", group_cols = c("plate_id", "well_type"), k = 1.5, filter = FALSE )
hts_raw |
An |
signal_col |
Name of the signal column to test. Default |
group_cols |
Columns defining comparable well groups within which the
IQR is computed. Default |
k |
IQR multiplier for the fences. Default |
filter |
Logical; if |
The input object with a logical outlier column added (or with
outlier rows removed when filter = TRUE).
calc_z_prime(), filter_valid_plates()
raw <- read_hts_plate(hts_primary_raw) flagged <- detect_outlier_wells(raw) sum(flagged$outlier)raw <- read_hts_plate(hts_primary_raw) flagged <- detect_outlier_wells(raw) sum(flagged$outlier)
Writes a complete hit table (all QC and pharmacology columns) to a CSV file.
export_hit_table(hits, file, ...)export_hit_table(hits, file, ...)
hits |
A hit data frame. |
file |
Output path. |
... |
Passed to |
The file path, invisibly.
rank_hit_compound(), annotate_hit_info()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) export_hit_table(rank_hit_compound(params), tempfile(fileext = ".csv"))drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) export_hit_table(rank_hit_compound(params), tempfile(fileext = ".csv"))
Returns the compounds belonging to the cluster with the most extreme mean activity, that is the lowest mean AUC (strongest potency) by default.
extract_cluster_hit(mat, cluster_result, direction = c("low", "high"))extract_cluster_hit(mat, cluster_result, direction = c("low", "high"))
mat |
The AUC matrix used for clustering. |
cluster_result |
The list returned by |
direction |
|
A character vector of compound ids in the selected cluster.
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) m <- build_auc_matrix(drc$meta) extract_cluster_hit(m, cluster_auc_matrix(m, k = 2))drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) m <- build_auc_matrix(drc$meta) extract_cluster_hit(m, cluster_auc_matrix(m, k = 2))
Pulls the fitted potency and efficacy parameters from every curve of an
hts_drc object.
extract_drc_params(drc)extract_drc_params(drc)
drc |
An |
A data frame with one row per curve: keys plus ic50, emax (top),
bottom, hill, rsq and pass. Curves that failed to fit yield NA
parameters.
fit_4pl_curve(), calc_drc_auc()
drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") head(extract_drc_params(drc))drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") head(extract_drc_params(drc))
Removes compounds whose replicate coefficient of variation exceeds a
threshold. When a correlation table is supplied it also checks that the
replicate plates are globally concordant, warning if any pair falls below the
threshold.
filter_bad_replicate(cv, cv_max = 15, cor_result = NULL, r2_min = 0.8)filter_bad_replicate(cv, cv_max = 15, cor_result = NULL, r2_min = 0.8)
cv |
A data frame from |
cv_max |
Maximum acceptable CV (percent). Default |
cor_result |
Optional data frame from |
r2_min |
Minimum acceptable pairwise |
The subset of cv for compounds passing the CV threshold, with the
removed compound ids stored in attr(x, "removed").
calc_replicate_cv(), calc_replicate_correlation()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) cv <- calc_replicate_cv(norm) good <- filter_bad_replicate(cv, cv_max = 20) attr(good, "removed")norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) cv <- calc_replicate_cv(norm) good <- filter_bad_replicate(cv, cv_max = 20) attr(good, "removed")
Removes curves that failed to fit or whose falls below the
threshold, leaving only trustworthy dose-response models.
filter_low_quality_curve(drc, rsq_min = NULL)filter_low_quality_curve(drc, rsq_min = NULL)
drc |
An |
rsq_min |
Minimum acceptable |
The filtered hts_drc object; removed curve ids are stored in
attr(drc, "removed").
drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") clean <- filter_low_quality_curve(drc) nrow(clean$meta)drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") clean <- filter_low_quality_curve(drc) nrow(clean$meta)
Removes whole plates whose Z' factor falls below the acceptance threshold, returning a clean data set for downstream normalisation.
filter_valid_plates( hts_raw, z_prime_min = 0.5, signal_col = "signal", nc_label = "NC", pc_label = "PC" )filter_valid_plates( hts_raw, z_prime_min = 0.5, signal_col = "signal", nc_label = "NC", pc_label = "PC" )
hts_raw |
An |
z_prime_min |
Acceptance threshold. Default |
signal_col, nc_label, pc_label
|
Passed to |
The hts_raw object restricted to passing plates, with the Z'
summary table stored in attr(x, "zprime") and the dropped plate ids in
attr(x, "dropped_plates").
raw <- read_hts_plate(hts_primary_raw) clean <- filter_valid_plates(raw) attr(clean, "dropped_plates")raw <- read_hts_plate(hts_primary_raw) clean <- filter_valid_plates(raw) attr(clean, "dropped_plates")
Fits a 4PL dose-response model to every compound (optionally split by
grouping columns such as cell line), reusing the package's self-contained
fitter, and records the goodness of fit . No external fitting
package is required.
fit_4pl_curve( data, response = "response", concentration = "concentration", compound_col = "compound_id", group_cols = NULL, rsq_min = 0.85 )fit_4pl_curve( data, response = "response", concentration = "concentration", compound_col = "compound_id", group_cols = NULL, rsq_min = 0.85 )
data |
An |
response, concentration, compound_col
|
Column names. Default
|
group_cols |
Optional grouping columns. |
rsq_min |
Curves with |
An hts_drc object: a list with meta (one row per curve: keys,
n, rsq, converged, pass), fits (named list of dsr_4pl models)
and data (the input). group_cols is stored as an attribute.
extract_drc_params(), calc_drc_auc(), plot_single_drc()
dr <- import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line") drc <- fit_4pl_curve(dr, group_cols = "cell_line") head(drc$meta)dr <- import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line") drc <- fit_4pl_curve(dr, group_cols = "cell_line") head(drc$meta)
Fits a 4PL curve for a single drug under one condition by non-linear least
squares, entirely in base R (no external fitting package required). Robust
starting values are derived from the data and refined with a bounded
L-BFGS-B optimisation over several initial IC50 guesses, falling back to
a derivative-free Nelder-Mead search if needed. The model uses the same
parameterisation as four_pl(), which matches the dr4pl package
convention (UpperLimit, IC50, Slope, LowerLimit).
fit_dose_response(data, response, concentration, bounds = NULL) ## S3 method for class 'dsr_4pl' coef(object, ...) ## S3 method for class 'dsr_4pl' predict(object, newdata = NULL, ...) ## S3 method for class 'dsr_4pl' fitted(object, ...) ## S3 method for class 'dsr_4pl' residuals(object, ...) ## S3 method for class 'dsr_4pl' print(x, ...)fit_dose_response(data, response, concentration, bounds = NULL) ## S3 method for class 'dsr_4pl' coef(object, ...) ## S3 method for class 'dsr_4pl' predict(object, newdata = NULL, ...) ## S3 method for class 'dsr_4pl' fitted(object, ...) ## S3 method for class 'dsr_4pl' residuals(object, ...) ## S3 method for class 'dsr_4pl' print(x, ...)
data |
A data frame containing at least the response and concentration columns for one drug and one condition. |
response |
Name of the (normalised) response column, as a string. |
concentration |
Name of the concentration column, as a string. |
bounds |
Optional named list overriding the box constraints used by the
bounded optimiser. Recognised names are |
object |
A |
... |
Ignored, for S3 method consistency. |
newdata |
Optional numeric vector of concentrations at which to predict. Defaults to the concentrations used for fitting. |
x |
A |
The fitted parameters can be passed directly to compute_auc() to
obtain a potency summary, for example
do.call(compute_auc, c(list(min(x), max(x)), as.list(coef(fit)))).
An object of class dsr_4pl: a list with elements coefficients
(named numeric vector top, ic50, hill, bottom), fitted,
residuals, convergence (logical), sse, data and call. The
companion methods coef(), predict(), fitted(), residuals() and
print() are provided for this class.
coef(dsr_4pl): Extract the fitted 4PL coefficients (top,
ic50, hill, bottom).
predict(dsr_4pl): Predict responses from a fitted model.
fitted(dsr_4pl): Extract fitted values.
residuals(dsr_4pl): Extract residuals.
print(dsr_4pl): Print a short summary of the fitted model.
one <- subset( screen_doseresponse, drug_name == "DrugA" & condition == "Gy0" & experiment_type == "sample" ) fit <- fit_dose_response(one, "normalized_cell_count", "concentration") coef(fit) compute_auc( min(one$concentration), max(one$concentration), top = coef(fit)[["top"]], ic50 = coef(fit)[["ic50"]], hill = coef(fit)[["hill"]], bottom = coef(fit)[["bottom"]] )one <- subset( screen_doseresponse, drug_name == "DrugA" & condition == "Gy0" & experiment_type == "sample" ) fit <- fit_dose_response(one, "normalized_cell_count", "concentration") coef(fit) compute_auc( min(one$concentration), max(one$concentration), top = coef(fit)[["top"]], ic50 = coef(fit)[["ic50"]], hill = coef(fit)[["hill"]], bottom = coef(fit)[["bottom"]] )
Adds pass/fail flags to a table of plate quality metrics such as the one
produced by calculate_qc_metrics(), using conventional acceptance
thresholds.
flag_qc_plates(qc, z_prime_min = 0.4, sb_min = 3, cv_max = 10)flag_qc_plates(qc, z_prime_min = 0.4, sb_min = 3, cv_max = 10)
qc |
A data frame of plate quality metrics. Columns referenced by the
active thresholds must be present ( |
z_prime_min |
Minimum acceptable Z-prime. Plates below this are flagged
|
sb_min |
Minimum acceptable signal-to-background ratio. Default |
cv_max |
Maximum acceptable coefficient of variation (percent) of the
negative control. Only applied when a |
The input data frame with added character flag columns
z_primer_flag, sb_flag and (when applicable) cv_flag, each taking the
value "Bad" or "Normal".
qc <- data.frame( plateID = c("P01", "P02"), z_prime = c(0.62, 0.20), sb_value = c(5.1, 2.4), cv_negative_ctrl = c(6, 14) ) flag_qc_plates(qc)qc <- data.frame( plateID = c("P01", "P02"), z_prime = c(0.62, 0.20), sb_value = c(5.1, 2.4), cv_negative_ctrl = c(6, 14) ) flag_qc_plates(qc)
Evaluates the classic four-parameter logistic model used to describe drug dose-response curves in high-throughput screens.
four_pl(x, top, ic50, hill, bottom)four_pl(x, top, ic50, hill, bottom)
x |
Numeric vector of drug concentrations (on the same scale used to fit the model, typically the raw concentration). |
top |
Response of the upper asymptote (e.g. viability with no drug). |
ic50 |
Concentration producing the half-maximal response. |
hill |
Hill slope controlling the steepness of the curve. |
bottom |
Response of the lower asymptote (e.g. viability at saturating drug). |
The model is
A numeric vector of predicted responses, the same length as x.
compute_auc(), fit_dose_response()
four_pl(x = c(0.01, 0.1, 1, 10), top = 1, ic50 = 1, hill = 1, bottom = 0)four_pl(x = c(0.01, 0.1, 1, 10), top = 1, ic50 = 1, hill = 1, bottom = 0)
Renders a standard HTML analysis report from the bundled R Markdown template, embedding the supplied QC, dose-response and heatmap results. Requires the suggested rmarkdown package.
generate_hts_report( params = list(), output_file = tempfile(fileext = ".html"), template = NULL, quiet = TRUE )generate_hts_report( params = list(), output_file = tempfile(fileext = ".html"), template = NULL, quiet = TRUE )
params |
A named list of objects made available to the report template
(passed as |
output_file |
Output HTML path. Default a temporary file. |
template |
Path to an |
quiet |
Passed to |
The path to the rendered report, invisibly.
## Not run: drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) generate_hts_report(list(hits = rank_hit_compound(params))) ## End(Not run)## Not run: drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) generate_hts_report(list(hits = rank_hit_compound(params))) ## End(Not run)
A small, simulated compound annotation table used to demonstrate hit
annotation. Keyed by compound_id to join onto screening results.
hts_compound_metahts_compound_meta
A data frame with one row per compound and the following columns:
Compound identifier such as "CPD001" (character).
Human-readable compound name (character).
Nominal molecular target (character).
Mechanism of action (character).
Source library the compound came from (character).
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound.
A small, simulated dose-response confirmation screen: ten compounds tested across a concentration gradient in three cell lines with two replicates each. Used to demonstrate the dose-response fitting, AUC and clustering modules.
hts_dose_responsehts_dose_response
A data frame with one row per measurement and the following columns:
Compound identifier such as "CPD001" (character).
Cell line, "A549", "H1299" or "MRC5" (character).
Compound concentration (micromolar) (numeric).
Technical replicate index, 1 or 2 (integer).
Percent viability relative to vehicle control (numeric).
The data are simulated (see data-raw/make_datasets.R); the cell
line "MRC5" is made comparatively resistant.
Returns the package's low-saturation, colourblind-safe qualitative palette (an Okabe-Ito ordering). Use it whenever a plot maps a discrete variable to colour so that figures stay consistent and accessible.
hts_pal(n = NULL)hts_pal(n = NULL)
n |
Number of colours to return (recycled if |
A character vector of hex colours.
hts_pal(3)hts_pal(3)
A single simulated 384-well plate ("EXP87P01") whose layout mirrors a real
cell-based high-throughput screen (see EXP87/). The two outermost rings of
wells (rows A, B, O, P and columns 1, 2, 23, 24) are kept free of compound to
avoid edge-evaporation artefacts. They still hold medium but no live cells,
so the instrument reads them at the same low, "dead" level as the kill
control; they are stored as "edgewell" wells (not omitted). The controls
sit inset from the true plate edge in the two innermost flanking columns
(3 and 22), arranged in a rotationally balanced diagonal pattern: column 3
holds the positive (kill) control in its top half (rows C-H) and the negative
(DMSO) control in its bottom half (rows I-N), while column 22 mirrors it
(negative top, positive bottom). This diagonal split averages out
spatial/edge signal gradients. Columns 4-21 across the interior rows C-N hold
the test compounds. Used to demonstrate plate-layout heatmaps with control
circling on a 384-well plate.
hts_plate_384hts_plate_384
A data frame with one row per well (all 384) and the following columns:
Plate identifier, "EXP87P01" (character).
Well address such as "C03" (character).
Plate row letter, "A"-"P" (character).
Plate column number, 1-24 (integer).
Well role: "PC" (positive control), "NC" (negative
control), "compound" or "edgewell" (empty buffer) (character).
Compound identifier for test wells, NA for controls
and edge wells (character).
Compound concentration (micromolar); NA for
controls and edge wells (numeric).
Raw luminescence read-out (numeric).
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound. All 384 wells are stored; the empty edge
wells carry only a low background/no-cell reading.
A small, simulated primary high-throughput screen in 96-well plate format
with raw readout signals, used to demonstrate the pre-QC, normalisation,
replicate and primary-hit modules. The layout follows good HTS practice: the
outer ring of wells (row A, row H and columns 1 and 12) is a compound-free
evaporation buffer stored as "Blank" wells, the two inset columns 2 and 11
carry the controls in a rotationally balanced diagonal pattern (positive
controls top-left/bottom-right, negative controls top-right/bottom-left), and
the 48 compounds fill the interior block (rows B-G, columns 3-10). Plates
"P01" and "P02" are good replicates (Z-prime around 0.8) while "P03" is
a failed plate.
hts_primary_rawhts_primary_raw
A data frame with one row per well and the following columns:
Plate identifier, "P01", "P02" or "P03" (character).
Well identifier such as "A1" (character).
Plate row letter, "A"-"H" (character).
Plate column number, 1-12 (integer).
Well role: "NC" (negative), "PC" (positive),
"Blank" or "compound" (character).
Compound identifier such as "CPD001", NA for
control and blank wells (character).
Compound concentration (micromolar), NA for
controls (numeric).
Raw instrument signal (numeric).
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound or cell line.
Standardises a secondary (dose-response) screening table into the columns
expected by the fitting engine, matching each compound to its concentration
gradient and response, ready for fit_4pl_curve().
import_dose_response( data, compound_col = "compound_id", concentration_col = "concentration", response_col = "viability", group_cols = NULL )import_dose_response( data, compound_col = "compound_id", concentration_col = "concentration", response_col = "viability", group_cols = NULL )
data |
A data frame, or a path to a csv/txt/xlsx file. |
compound_col, concentration_col, response_col
|
Names of the compound,
concentration and response columns in |
group_cols |
Optional grouping columns kept alongside each curve (for
example |
An hts_dose object (data frame) with columns compound_id,
concentration, response, any group_cols, and canonical class.
dr <- import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line") head(dr)dr <- import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line") head(dr)
Row-binds several normalised plates (or a list of them) into a single
hts_norm object holding the activity of the whole screen, keeping only the
columns shared by all inputs.
merge_plate_data(...)merge_plate_data(...)
... |
One or more |
A combined hts_norm object.
n1 <- norm_by_control(read_hts_plate( hts_primary_raw[hts_primary_raw$plate_id == "P01", ])) n2 <- norm_by_control(read_hts_plate( hts_primary_raw[hts_primary_raw$plate_id == "P02", ])) merged <- merge_plate_data(n1, n2) table(merged$plate_id)n1 <- norm_by_control(read_hts_plate( hts_primary_raw[hts_primary_raw$plate_id == "P01", ])) n2 <- norm_by_control(read_hts_plate( hts_primary_raw[hts_primary_raw$plate_id == "P02", ])) merged <- merge_plate_data(n1, n2) table(merged$plate_id)
Converts raw or background-subtracted signals to percent inhibition and
percent viability using each plate's own negative (NC) and positive (PC)
controls, so that readouts are comparable across plates. Inhibition is
and viability is its
complement relative to the control window.
norm_by_control( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC" )norm_by_control( hts_raw, signal_col = "signal", nc_label = "NC", pc_label = "PC" )
hts_raw |
An |
signal_col |
Name of the signal column to normalise. Default
|
nc_label, pc_label
|
Well-type labels for the negative and positive
controls. Defaults |
An hts_norm object: the input data with added numeric columns
inhibition (percent) and viability (percent). Multiple plates are
normalised independently.
merge_plate_data(), plot_plate_heatmap_inhibition()
raw <- baseline_subtract(read_hts_plate(hts_primary_raw)) norm <- norm_by_control(raw) summary(norm$inhibition)raw <- baseline_subtract(read_hts_plate(hts_primary_raw)) norm <- norm_by_control(raw) summary(norm$inhibition)
Builds the full row/column coordinate table for a standard microplate, ordered by row then column. This is useful for joining plate readouts onto a complete layout so that empty wells are represented explicitly.
plate_layout(format = 96) plate_layout_384() plate_layout_1536()plate_layout(format = 96) plate_layout_384() plate_layout_1536()
format |
Plate format (number of wells): one of |
A data frame with one row per well and the columns well (for
example "A1"), row (row letter), col (column number) and row_index
(numeric row position, A = 1).
plate_layout_384(), plate_layout_1536()
head(plate_layout(96)) nrow(plate_layout(384))head(plate_layout(96)) nrow(plate_layout(384))
Draws a clustered heatmap of the AUC matrix. Uses ComplexHeatmap (with
circlize for the colour scale) when available for a publication-quality
figure with a diverging navy-white-firebrick palette matching
plot_delta_auc_heatmap(), otherwise falls back to base stats::heatmap().
plot_auc_heatmap( mat, title = "AUC heatmap", cluster_rows = TRUE, cluster_columns = TRUE )plot_auc_heatmap( mat, title = "AUC heatmap", cluster_rows = TRUE, cluster_columns = TRUE )
mat |
A numeric matrix from |
title |
Plot title. Default |
cluster_rows, cluster_columns
|
Whether to cluster rows/columns. Default
|
Invisibly, the drawn object. Called for its side effect (a plot on the active graphics device).
build_auc_matrix(), plot_cluster_tree()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) plot_auc_heatmap(build_auc_matrix(drc$meta, zscore = "row"))drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) plot_auc_heatmap(build_auc_matrix(drc$meta, zscore = "row"))
Overlays the fitted curves of several compounds for side-by-side comparison of activity.
plot_batch_drc_overlay(drc, curve_ids = NULL)plot_batch_drc_overlay(drc, curve_ids = NULL)
drc |
An |
curve_ids |
Curve identifiers to overlay. Defaults to all fitted curves. |
A ggplot2::ggplot object.
drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") plot_batch_drc_overlay(drc, drc$meta$curve_id[1:4])drc <- fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line") plot_batch_drc_overlay(drc, drc$meta$curve_id[1:4])
Draws the hierarchical clustering tree of compounds from an AUC matrix.
plot_cluster_tree(cluster_result, main = "Compound clustering")plot_cluster_tree(cluster_result, main = "Compound clustering")
cluster_result |
The list returned by |
main |
Plot title. Default |
Invisibly NULL; called for its side effect (a base-graphics plot).
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) m <- build_auc_matrix(drc$meta) plot_cluster_tree(cluster_auc_matrix(m, k = 2))drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) m <- build_auc_matrix(drc$meta) plot_cluster_tree(cluster_auc_matrix(m, k = 2))
Plots a per-drug scatter of a score (for example delta AUC) under two conditions or cell lines, colouring points by quadrant and labelling the most extreme drugs in each quadrant. This is useful for spotting drugs that behave differently between, say, a cancer and a normal cell line.
plot_condition_scatter(data, x, y, drug_col = "drug_name", label_n = 5)plot_condition_scatter(data, x, y, drug_col = "drug_name", label_n = 5)
data |
A data frame with one row per drug. |
x, y
|
Names of the two numeric score columns to place on the x and y axes, as strings. |
drug_col |
Name of the drug identifier column, as a string. Default
|
label_n |
Number of most-extreme drugs (by distance from the origin) to
label per quadrant. Default |
Point labelling uses ggrepel when available and falls back to
ggplot2::geom_text() otherwise. The axes are centred on the origin with a
fixed aspect ratio so the four quadrants are equal in size.
A ggplot2::ggplot object.
df <- data.frame( drug_name = paste0("Drug", 1:8), MRC5 = c(-1, 0.5, -0.2, 1.2, -0.8, 0.3, -1.5, 0.9), A549 = c(-1.2, 0.1, 0.7, -0.9, -1.1, 1.0, -0.4, 0.6) ) plot_condition_scatter(df, x = "MRC5", y = "A549")df <- data.frame( drug_name = paste0("Drug", 1:8), MRC5 = c(-1, 0.5, -0.2, 1.2, -0.8, 0.3, -1.5, 0.9), A549 = c(-1.2, 0.1, 0.7, -0.9, -1.1, 1.0, -0.4, 0.6) ) plot_condition_scatter(df, x = "MRC5", y = "A549")
Draws, for each plate, the individual negative- and positive-control well readouts (for example normalised cell counts) so that plate-to-plate control behaviour and separation can be inspected at a glance. This is the standard QC view used to confirm that negative controls stay high and positive controls stay low across an entire screen.
plot_control_scatter( data, plate_col = "plateID", neg_cols = grep("^neg_ctrl", names(data), value = TRUE), pos_cols = grep("^pos_ctrl", names(data), value = TRUE), colors = c(`Negative control` = "#0072B2", `Positive control` = "#D55E00"), y_title = "Normalized cell count" )plot_control_scatter( data, plate_col = "plateID", neg_cols = grep("^neg_ctrl", names(data), value = TRUE), pos_cols = grep("^pos_ctrl", names(data), value = TRUE), colors = c(`Negative control` = "#0072B2", `Positive control` = "#D55E00"), y_title = "Normalized cell count" )
data |
A data frame with one row per plate and several negative- and positive-control replicate columns (wide format, such as screen_plate_qc). |
plate_col |
Name of the plate identifier column, as a string. Default
|
neg_cols, pos_cols
|
Character vectors naming the negative- and
positive-control replicate columns. By default columns matching
|
colors |
Named character vector giving the point colours for the two control groups. |
y_title |
Y-axis title. Default |
A ggplot2::ggplot object: control readouts (points, dodged and jittered) per plate, coloured by control type, with the y-axis expanded to include zero.
plot_qc_boxplot(), plot_qc_circular_heatmap()
plot_control_scatter(screen_plate_qc)plot_control_scatter(screen_plate_qc)
Shows the distribution of per-compound replicate CVs across the library, with the acceptance threshold marked.
plot_cv_distribution(cv, cv_max = 15, bins = 30)plot_cv_distribution(cv, cv_max = 15, bins = 30)
cv |
A data frame from |
cv_max |
Threshold to draw as a reference line. Default |
bins |
Number of histogram bins. Default |
A ggplot2::ggplot object.
calc_replicate_cv(), filter_bad_replicate()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_cv_distribution(calc_replicate_cv(norm))norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_cv_distribution(calc_replicate_cv(norm))
Draws a diverging heatmap of differential (delta) AUC values with drugs on one axis and conditions/cell lines on the other, using ComplexHeatmap. Colours are centred at zero so that sensitising (negative) and antagonising (positive) responses are visually separated.
plot_delta_auc_heatmap( data, drug_col = "drug_name", value_cols = NULL, cell_types = NULL, cluster_rows = TRUE, cluster_columns = TRUE, name = "delta AUC" )plot_delta_auc_heatmap( data, drug_col = "drug_name", value_cols = NULL, cell_types = NULL, cluster_rows = TRUE, cluster_columns = TRUE, name = "delta AUC" )
data |
A data frame with one row per drug: a drug identifier column and one numeric delta-AUC column per condition or cell line. |
drug_col |
Name of the drug identifier column, as a string. Default
|
value_cols |
Character vector of the delta-AUC column names to display.
Defaults to every numeric column other than |
cell_types |
Optional named character vector mapping each column in
|
cluster_rows, cluster_columns
|
Logical, whether to cluster drugs and
conditions respectively. Defaults |
name |
Legend title. Default |
Requires the suggested packages ComplexHeatmap and circlize.
A ComplexHeatmap::Heatmap object, which is drawn when printed. Rows with missing values are dropped before plotting.
if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("circlize", quietly = TRUE)) { ht <- plot_delta_auc_heatmap( screen_delta_auc, value_cols = c("A549", "H1299", "H1975", "MRC5") ) }if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("circlize", quietly = TRUE)) { ht <- plot_delta_auc_heatmap( screen_delta_auc, value_cols = c("A549", "H1299", "H1975", "MRC5") ) }
Fits a four-parameter logistic model to each condition of a single drug and overlays the observed responses with the smooth fitted curves, coloured by condition. This is the key visual for comparing drug sensitivity between two conditions (for example irradiated versus non-irradiated cells), making a potency shift between conditions immediately apparent.
plot_dose_response_curves( data, drug = NULL, response = "normalized_cell_count", concentration = "concentration", condition = "condition", drug_col = "drug_name", n_points = 200, colors = c("#0072B2", "#D55E00", "#009E73", "#CC79A7"), shapes = c(19, 15, 17, 18), ref_line = 0.5, legend_title = "Condition" )plot_dose_response_curves( data, drug = NULL, response = "normalized_cell_count", concentration = "concentration", condition = "condition", drug_col = "drug_name", n_points = 200, colors = c("#0072B2", "#D55E00", "#009E73", "#CC79A7"), shapes = c(19, 15, 17, 18), ref_line = 0.5, legend_title = "Condition" )
data |
A long-format data frame with one row per well/replicate, containing drug, condition, concentration and response columns. |
drug |
Optional drug name to display. If |
response |
Name of the (normalised) response column, as a string.
Default |
concentration |
Name of the concentration column, as a string. Default
|
condition |
Name of the condition column, as a string. Default
|
drug_col |
Name of the drug identifier column, as a string. Default
|
n_points |
Number of points used to draw each smooth fitted curve.
Default |
colors |
Character vector of colours, one per condition (recycled from the pipeline palette by default). |
shapes |
Numeric vector of point shapes, one per condition. |
ref_line |
Numeric response level at which to draw a horizontal dashed
reference line (for example the 50 % effect level). Set to |
legend_title |
Legend title. Default |
The styling reproduces the plots used throughout the screening pipeline: a logarithmic concentration axis, distinct colour and point shape per condition, a horizontal 50 % reference line, and the fitted IC50/AUC of each condition reported in the subtitle.
Only concentrations that are finite and strictly positive are used
(a log scale cannot show zero or negative doses). A condition with fewer
than four usable observations is plotted as points only, with a warning,
and no curve is fitted for it. Fitting is performed with
fit_dose_response(), so no external fitting package is required. The
figure uses the package's modern-academic theme_hts() look with a
colourblind-safe condition palette.
A ggplot2::ggplot object with a base-10 logarithmic concentration axis, observed points and fitted 4PL curves coloured by condition.
fit_dose_response(), four_pl(), compute_auc()
one <- subset( screen_doseresponse, drug_name == "DrugA" & experiment_type == "sample" ) plot_dose_response_curves(one, drug = "DrugA")one <- subset( screen_doseresponse, drug_name == "DrugA" & experiment_type == "sample" ) plot_dose_response_curves(one, drug = "DrugA")
Bar chart of the number of hit versus non-hit compounds from a primary screen.
plot_hit_bar_count(hits)plot_hit_bar_count(hits)
hits |
A data frame from |
A ggplot2::ggplot object.
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_hit_bar_count(select_primary_hit(norm))norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_hit_bar_count(select_primary_hit(norm))
Bar chart of the number of Strong, Moderate and Weak hits.
plot_hit_stratify_bar(ranked)plot_hit_stratify_bar(ranked)
ranked |
A data frame from |
A ggplot2::ggplot object.
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) plot_hit_stratify_bar(rank_hit_compound(params))drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) plot_hit_stratify_bar(rank_hit_compound(params))
Scatter plot of IC50 against AUC across curves, a compact view for triaging strong, moderate and weak compounds. IC50 marks the potency (the concentration for half-maximal effect) while AUC integrates potency and efficacy over the whole tested range; plotting them together shows whether the two agree and flags compounds that are potent but only weakly efficacious (or vice versa). A regression trend line and the Pearson correlation (computed on the log10 IC50, matching the log x-axis) are drawn on the figure by default.
plot_ic50_auc_cor( params, auc_col = "auc", ic50_col = "ic50", add_trend = TRUE, annotate_cor = TRUE )plot_ic50_auc_cor( params, auc_col = "auc", ic50_col = "ic50", add_trend = TRUE, annotate_cor = TRUE )
params |
A data frame from |
auc_col, ic50_col
|
Column names. Default |
add_trend |
Add a linear regression trend line with a 95% confidence
band. Default |
annotate_cor |
Annotate the Pearson correlation coefficient and p-value
on the plot. Default |
A ggplot2::ggplot object.
extract_drc_params(), calc_drc_auc()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) plot_ic50_auc_cor(params)drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) plot_ic50_auc_cor(params)
Shows the distribution of percent inhibition across the compound wells of a plate (controls excluded), the standard view for judging overall hit density.
plot_inhibition_hist( hts_norm, plate = NULL, value = "inhibition", compound_label = "compound", bins = 30 )plot_inhibition_hist( hts_norm, plate = NULL, value = "inhibition", compound_label = "compound", bins = 30 )
hts_norm |
An |
plate |
Optional plate identifier; if |
value |
Name of the value column. Default |
compound_label |
Well-type label marking compound wells. Default
|
bins |
Number of histogram bins. Default |
A ggplot2::ggplot object.
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_inhibition_hist(norm, plate = "P01")norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_inhibition_hist(norm, plate = "P01")
Draws a microplate as a grid of wells (rows lettered top-to-bottom, columns
numbered left-to-right) coloured by a per-well readout such as normalised
cell count, so that drug-treated wells and their positive/negative controls
can be inspected in their physical plate positions. Missing wells are shown
as empty cells, making layout errors and edge effects easy to spot. This
abstracts the per-plate heatmap.2() plate maps used in the screening
pipeline, but is built on ggplot2 and needs no external heatmap
package.
plot_plate_heatmap( data, fill = "normalized_cell_count", well_col = NULL, row_col = "plate_rows", col_col = "plate_columns", label = NULL, control_col = NULL, nc_values = c("NC", "negative_ctrl"), pc_values = c("PC", "positive_ctrl"), circle_size = NULL, plate = NULL, plate_col = "plateID", plate_type = NULL, title = NULL, na_value = "grey90" )plot_plate_heatmap( data, fill = "normalized_cell_count", well_col = NULL, row_col = "plate_rows", col_col = "plate_columns", label = NULL, control_col = NULL, nc_values = c("NC", "negative_ctrl"), pc_values = c("PC", "positive_ctrl"), circle_size = NULL, plate = NULL, plate_col = "plateID", plate_type = NULL, title = NULL, na_value = "grey90" )
data |
A long-format data frame with one row per well. |
fill |
Name of the column mapped to tile colour, as a string. Default
|
well_col |
Optional name of a single well-identifier column such as
|
row_col, col_col
|
Names of the row (letter) and column (number)
columns used when |
label |
Optional name of a column whose values are printed inside each
tile (for example a drug name or a QC flag). Default |
control_col |
Optional name of a column identifying each well's role
(for example |
nc_values, pc_values
|
Character vectors of the labels in |
circle_size |
Size of the control-marking circles. When |
plate |
Optional plate identifier; if supplied |
plate_col |
Name of the plate identifier column, as a string. Default
|
plate_type |
Plate format, either |
title |
Optional plot title. |
na_value |
Colour used for wells with no data. Default |
Duplicate wells (for example replicates sharing a position) are
summarised by their mean for numeric fill and concatenated for
categorical fill/label.
A ggplot2::ggplot object: one tile per well, coloured by fill,
with row A at the top and column 1 at the top-left, drawn with a fixed
aspect ratio. When control_col is supplied the negative- and
positive-control wells are outlined with coloured circles.
plot_qc_boxplot(), plot_control_scatter()
# A single 96-well plate coloured by normalised cell count. plot_plate_heatmap(subset(screen_plate_layout, plateID == "EXP99_Gy0")) # Show the well-type layout instead, both plates side by side. plot_plate_heatmap(screen_plate_layout, fill = "experiment_type") # Circle the negative and positive controls on a raw 96-well plate. plot_plate_heatmap( subset(hts_primary_raw, plate_id == "P01"), fill = "signal", well_col = "well", plate_col = "plate_id", control_col = "well_type" ) # A realistic 384-well plate (the outer 2-well ring is a compound-free buffer # that reads at the low, no-cell level; controls sit on a diagonal in the two # inset columns 3 and 22). plot_plate_heatmap(hts_plate_384, fill = "signal", well_col = "well", control_col = "well_type", plate_col = "plate_id", plate_type = 384)# A single 96-well plate coloured by normalised cell count. plot_plate_heatmap(subset(screen_plate_layout, plateID == "EXP99_Gy0")) # Show the well-type layout instead, both plates side by side. plot_plate_heatmap(screen_plate_layout, fill = "experiment_type") # Circle the negative and positive controls on a raw 96-well plate. plot_plate_heatmap( subset(hts_primary_raw, plate_id == "P01"), fill = "signal", well_col = "well", plate_col = "plate_id", control_col = "well_type" ) # A realistic 384-well plate (the outer 2-well ring is a compound-free buffer # that reads at the low, no-cell level; controls sit on a diagonal in the two # inset columns 3 and 22). plot_plate_heatmap(hts_plate_384, fill = "signal", well_col = "well", control_col = "well_type", plate_col = "plate_id", plate_type = 384)
Draws a plate's normalised percent-inhibition values in plate layout. A thin
wrapper around plot_plate_heatmap() for hts_norm objects.
plot_plate_heatmap_inhibition(hts_norm, plate = NULL, value = "inhibition")plot_plate_heatmap_inhibition(hts_norm, plate = NULL, value = "inhibition")
hts_norm |
An |
plate |
Plate identifier to show. Defaults to the first plate. |
value |
Name of the value column to colour by. Default |
A ggplot2::ggplot object.
plot_plate_heatmap(), plot_inhibition_hist()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_plate_heatmap_inhibition(norm, plate = "P01")norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_plate_heatmap_inhibition(norm, plate = "P01")
Draws a single plate's raw (or background-subtracted) readouts in plate
layout, optionally marking flagged outlier wells. A thin wrapper around
plot_plate_heatmap() for hts_raw objects.
plot_plate_heatmap_raw( hts_raw, plate = NULL, signal_col = "signal", mark_outliers = TRUE )plot_plate_heatmap_raw( hts_raw, plate = NULL, signal_col = "signal", mark_outliers = TRUE )
hts_raw |
An |
plate |
Plate identifier to show. Defaults to the first plate. |
signal_col |
Name of the signal column to colour by. Default
|
mark_outliers |
Logical; if |
A ggplot2::ggplot object.
plot_plate_heatmap(), plot_plate_qc()
raw <- detect_outlier_wells(read_hts_plate(hts_primary_raw)) plot_plate_heatmap_raw(raw, plate = "P01")raw <- detect_outlier_wells(read_hts_plate(hts_primary_raw)) plot_plate_heatmap_raw(raw, plate = "P01")
A single entry point for plotting the plate-quality metrics produced by
calc_plate_qc() (and the per-well scores from calc_well_zscore()). Choose
which assessment to draw through the metric argument; the acceptance
threshold, axis label and pass/fail colouring are set automatically for each
metric but can be overridden.
plot_plate_qc(qc, metric = "z_prime", threshold = NULL, plate_col = "plate_id")plot_plate_qc(qc, metric = "z_prime", threshold = NULL, plate_col = "plate_id")
qc |
A data frame from |
metric |
The metric to plot: one of |
threshold |
Optional acceptance threshold drawn as a reference line; defaults to the standard cut-off for the chosen metric. |
plate_col |
Name of the plate-identifier column. Default |
A ggplot2::ggplot object.
calc_plate_qc(), calc_well_zscore(), plot_plate_heatmap_raw()
raw <- read_hts_plate(hts_primary_raw) qc <- calc_plate_qc(raw) plot_plate_qc(qc, metric = "z_prime") plot_plate_qc(qc, metric = "ssmd") plot_plate_qc(qc, metric = "cv") plot_plate_qc(calc_well_zscore(raw), metric = "robust_zscore")raw <- read_hts_plate(hts_primary_raw) qc <- calc_plate_qc(raw) plot_plate_qc(qc, metric = "z_prime") plot_plate_qc(qc, metric = "ssmd") plot_plate_qc(qc, metric = "cv") plot_plate_qc(calc_well_zscore(raw), metric = "robust_zscore")
Draws the whole library ranked by activity, with the hit cut-off marked, the standard view of how many compounds clear the primary threshold.
plot_primary_inhibition_rank(hits)plot_primary_inhibition_rank(hits)
hits |
A data frame from |
A ggplot2::ggplot object.
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_primary_inhibition_rank(select_primary_hit(norm))norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_primary_inhibition_rank(select_primary_hit(norm))
Scatter of primary-screen activity against secondary-screen AUC for the same compounds, the standard check that primary hits reproduce in the dose-response confirmation screen.
plot_primary_secondary_cor( primary, secondary, by = "compound_id", primary_col = "activity", secondary_col = "auc" )plot_primary_secondary_cor( primary, secondary, by = "compound_id", primary_col = "activity", secondary_col = "auc" )
primary |
A data frame with a compound column and a primary-activity column. |
secondary |
A data frame with a compound column and a secondary-activity (AUC) column. |
by |
Join key. Default |
primary_col |
Primary-activity column. Default |
secondary_col |
Secondary-activity column. Default |
A ggplot2::ggplot object.
select_primary_hit(), calc_drc_auc()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) primary <- select_primary_hit(norm) drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) sec <- aggregate(auc ~ compound_id, drc$meta, mean) plot_primary_secondary_cor(primary, sec)norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) primary <- select_primary_hit(norm) drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) sec <- aggregate(auc ~ compound_id, drc$meta, mean) plot_primary_secondary_cor(primary, sec)
Draws grouped boxplots of a per-well readout across plates, split by control type, to inspect assay consistency and separation between negative and positive controls.
plot_qc_boxplot( data, plate_col = "plateID", value_col = "normalized_cell_count", group_col = "experiment_type", y_title = "Normalized cell count" )plot_qc_boxplot( data, plate_col = "plateID", value_col = "normalized_cell_count", group_col = "experiment_type", y_title = "Normalized cell count" )
data |
A long-format data frame of well-level readouts. |
plate_col |
Name of the plate identifier column, as a string. Default
|
value_col |
Name of the numeric readout column, as a string. Default
|
group_col |
Name of the control-type / grouping column, as a string.
Default |
y_title |
Axis title for the readout. Default
|
A ggplot2::ggplot object.
plot_qc_boxplot(screen_doseresponse)plot_qc_boxplot(screen_doseresponse)
Draws a large circular (circlize) heatmap of the control-well readouts
for every plate, grouped into sectors by experiment. Each ring is one plate
and each cell one control well, so systematic control problems across a whole
screen become visible at once. This mirrors the summary circos.heatmap
used in the pipeline to display negative- and positive-control cell counts.
plot_qc_circular_heatmap( data, value_cols = grep("_ctrl_", names(data), value = TRUE), plate_col = "plateID", split_col = "experimentID", col_breaks = c(0, 0.5, 1), col_colors = c("navy", "white", "firebrick3"), name = "Norm cell counts", show_sector_labels = TRUE )plot_qc_circular_heatmap( data, value_cols = grep("_ctrl_", names(data), value = TRUE), plate_col = "plateID", split_col = "experimentID", col_breaks = c(0, 0.5, 1), col_colors = c("navy", "white", "firebrick3"), name = "Norm cell counts", show_sector_labels = TRUE )
data |
A data frame with one row per plate and numeric control columns, such as screen_plate_qc. |
value_cols |
Character vector of the control-value columns to display.
By default all columns matching |
plate_col |
Name of the plate identifier column (used as row names), as
a string. Default |
split_col |
Optional name of a grouping column (experiment) used to
split the ring into sectors. Default |
col_breaks, col_colors
|
Numeric breakpoints and matching colours passed
to |
name |
Legend title. Default |
show_sector_labels |
Logical, whether to label each sector. Default
|
Requires the suggested package circlize; when ComplexHeatmap is also installed a colour legend is added.
Invisibly NULL. Called for the side effect of drawing to the active
graphics device.
plot_control_scatter(), plot_delta_auc_heatmap()
if (requireNamespace("circlize", quietly = TRUE)) { plot_qc_circular_heatmap(screen_plate_qc) }if (requireNamespace("circlize", quietly = TRUE)) { plot_qc_circular_heatmap(screen_plate_qc) }
Draws a circular (circlize) scatter of a QC metric with one sector per experiment and one point per plate, coloured by whether the plate passes a threshold. This reproduces the whole-screen Z'-factor overview used in the pipeline, where many plates across several experiments are compared on a single ring.
plot_qc_metric_circular( data, metric = "z_prime", sector_col = "experimentID", x_col = "plateNumber", label_col = "plateID", threshold = 0.5, transform = TRUE, colors = c(Bad = "#D55E00", Normal = "#0072B2"), bar_lwd = 4, x_margin = 0.8, show_labels = TRUE, center_label = NULL )plot_qc_metric_circular( data, metric = "z_prime", sector_col = "experimentID", x_col = "plateNumber", label_col = "plateID", threshold = 0.5, transform = TRUE, colors = c(Bad = "#D55E00", Normal = "#0072B2"), bar_lwd = 4, x_margin = 0.8, show_labels = TRUE, center_label = NULL )
data |
A data frame with one row per plate, such as screen_plate_qc. |
metric |
Name of the metric column, as a string. Default |
sector_col |
Name of the column that defines the sectors (experiments),
as a string. Default |
x_col |
Name of the numeric within-sector position column (plate order),
as a string. Default |
label_col |
Name of the column holding the plate identifier printed on
the outside of each bar, as a string. Default |
threshold |
Numeric pass/fail cut-off. Plates whose metric is below
|
transform |
Logical; if |
colors |
Named character vector with entries |
bar_lwd |
Line width of each plate bar. Default |
x_margin |
Numeric angular padding (in |
show_labels |
Logical; if |
center_label |
Text drawn in the centre of the ring. Defaults to
|
Requires the suggested package circlize. Each experiment is a
sector and each plate a thin vertical bar drawn at its own plateNumber
position, rising from a zero baseline to the metric value, so the bars never
overlap. An angular x_margin keeps the first and last bars clear of the
sector edges, the plate identifier is printed radially just outside each
bar, and a short Y-axis on the first sector plus a dashed reference line at
threshold in every sector give the scale. The design scales to large
campaigns of roughly ten plates per experiment.
Invisibly NULL. Called for the side effect of drawing to the active
graphics device.
plot_qc_metric_trend(), plot_qc_circular_heatmap()
if (requireNamespace("circlize", quietly = TRUE)) { plot_qc_metric_circular(screen_plate_qc, metric = "z_prime") }if (requireNamespace("circlize", quietly = TRUE)) { plot_qc_metric_circular(screen_plate_qc, metric = "z_prime") }
Plots a single QC metric (for example Z', Z-factor or negative-control CV) for every plate in acquisition order, colouring each plate by a pass/fail flag and marking the overall mean. This mirrors the per-metric QC review plots used in the screening pipeline and makes drifting or failing plates easy to spot.
plot_qc_metric_trend( data, metric = "z_prime", plate_col = "plateID", flag_col = NULL, threshold = 0.5, direction = c("min", "max"), colors = c(Bad = "#D55E00", Normal = "#0072B2") )plot_qc_metric_trend( data, metric = "z_prime", plate_col = "plateID", flag_col = NULL, threshold = 0.5, direction = c("min", "max"), colors = c(Bad = "#D55E00", Normal = "#0072B2") )
data |
A data frame with one row per plate, such as screen_plate_qc. |
metric |
Name of the metric column to plot, as a string. Default
|
plate_col |
Name of the plate identifier column, as a string. Default
|
flag_col |
Optional name of a column of |
threshold |
Numeric cut-off used to flag plates when |
direction |
Either |
colors |
Named character vector giving the colours for |
A ggplot2::ggplot object: one bar per plate in plate order,
coloured by flag, with a dashed line at the mean and a solid line at
threshold.
calculate_qc_metrics(), flag_qc_plates()
plot_qc_metric_trend(screen_plate_qc, metric = "z_prime")plot_qc_metric_trend(screen_plate_qc, metric = "z_prime")
Plots the activity of replicate plates against one another in the house style
used across the screening reports: points coloured by well type (compounds,
negative/positive controls, blanks) at 50% opacity, a linear regression line
with a shaded 95% confidence band, and a Pearson (with p-value)
annotated on each panel. When more than two replicate plates are present and
no specific pair is requested, every pairwise combination (replicate 1 vs 2,
1 vs 3, 2 vs 3, ...) is drawn together in a single faceted figure, mirroring
the combn()-based reps_corr_plot() workflow in the source analyses.
plot_replicate_scatter( data, plate_x = NULL, plate_y = NULL, value = "viability", plate_col = "plate_id", key_col = NULL, compound_col = "compound_id", color_col = NULL, palette = .well_type_palette, line_color = "lightblue", band_color = "lightgray", show_identity = TRUE )plot_replicate_scatter( data, plate_x = NULL, plate_y = NULL, value = "viability", plate_col = "plate_id", key_col = NULL, compound_col = "compound_id", color_col = NULL, palette = .well_type_palette, line_color = "lightblue", band_color = "lightgray", show_identity = TRUE )
data |
An |
plate_x, plate_y
|
Plate identifiers for the two axes. When both are
|
value |
Name of the value column when |
plate_col |
Name of the plate column. Default |
key_col |
Column identifying matching observations across replicate
plates. Defaults to the well-address column |
compound_col |
Compound column, used as the pairing key when no |
color_col |
Column used to colour points, typically the well-role column.
Defaults to |
palette |
Named vector mapping well-type levels to colours. Defaults to the report palette (compounds blue, negative controls black, positive controls red, blanks gold). |
line_color, band_color
|
Colour of the regression line and of its 95% confidence band. Default light blue on light grey, as in the reports. |
show_identity |
Whether to draw the dotted |
A single ggplot2::ggplot object. With three or more plates it is
faceted, one panel per replicate pair. The annotated and p-value are
computed over every point shown in the panel.
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) # All pairwise replicate comparisons at once, points coloured by well type: plot_replicate_scatter(norm) # A single chosen pair: plot_replicate_scatter(norm, plate_x = "P01", plate_y = "P02")norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) # All pairwise replicate comparisons at once, points coloured by well type: plot_replicate_scatter(norm) # A single chosen pair: plot_replicate_scatter(norm, plate_x = "P01", plate_y = "P02")
Histogram of the per-compound activity with the library centre and the 1, 2 and 3 sigma cut-offs marked, bars coloured by how many sigma each compound clears. Optionally overlays the fitted normal curve so the departure from normality (the hit tail) stands out.
plot_sigma_hits(hits, bins = 30, show_normal = TRUE)plot_sigma_hits(hits, bins = 30, show_normal = TRUE)
hits |
A data frame from |
bins |
Number of histogram bins. Default |
show_normal |
Overlay the fitted normal density curve. Default |
A ggplot2::ggplot object.
select_sigma_hits(), summarize_sigma_hits()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_sigma_hits(select_sigma_hits(norm))norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) plot_sigma_hits(select_sigma_hits(norm))
Plots one compound's observed points and fitted 4PL curve on a log10
concentration axis, annotating IC50, AUC and .
plot_single_drc(drc, curve_id = NULL, color = "#0072B2")plot_single_drc(drc, curve_id = NULL, color = "#0072B2")
drc |
An |
curve_id |
Curve identifier (from |
color |
Curve colour. Default |
A ggplot2::ggplot object.
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) plot_single_drc(drc, drc$meta$curve_id[1])drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) plot_single_drc(drc, drc$meta$curve_id[1])
Combines potency, efficacy and quality metrics into a single activity score
and assigns each compound to a Strong, Moderate or Weak tier, the final
prioritisation step of the pipeline. Lower AUC and IC50 and higher Emax count
as more active; lower replicate CV and higher fit raise confidence.
rank_hit_compound( data, auc_col = "auc", ic50_col = "ic50", emax_col = "emax", cv_col = "cv", rsq_col = "rsq", weights = NULL, probs = c(1/3, 2/3) )rank_hit_compound( data, auc_col = "auc", ic50_col = "ic50", emax_col = "emax", cv_col = "cv", rsq_col = "rsq", weights = NULL, probs = c(1/3, 2/3) )
data |
A per-compound data frame of metrics. |
auc_col, ic50_col, emax_col, cv_col, rsq_col
|
Column names for the metrics
to use; set any to |
weights |
Optional named numeric vector of per-metric weights (names matching the metric column names). Defaults to equal weights. |
probs |
Two increasing probabilities splitting Weak/Moderate/Strong by
score quantile. Default |
data with added score (numeric) and tier (ordered factor
Weak < Moderate < Strong), sorted by descending score.
annotate_hit_info(), plot_hit_stratify_bar()
drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) ranked <- rank_hit_compound(params) table(ranked$tier)drc <- calc_drc_auc(fit_4pl_curve(import_dose_response(hts_dose_response, response_col = "viability", group_cols = "cell_line"), group_cols = "cell_line")) params <- merge(extract_drc_params(drc), drc$meta[, c("curve_id", "auc")]) ranked <- rank_hit_compound(params) table(ranked$tier)
Reads an instrument export (csv, txt/tsv or Excel) or an in-memory data frame
of well-level readouts and standardises it into an hts_raw object with a
fixed set of columns, ready for the rest of the pipeline. Well coordinates are
parsed from the well identifier and control wells are canonicalised to the
labels "NC", "PC" and "Blank".
read_hts_plate( file, plate_id = NULL, well_col = "well", signal_col = "signal", compound_col = "compound_id", conc_col = "concentration", type_col = "well_type", plate_col = "plate_id", nc_label = "NC", pc_label = "PC", blank_label = "Blank", sep = "\t", sheet = 1 )read_hts_plate( file, plate_id = NULL, well_col = "well", signal_col = "signal", compound_col = "compound_id", conc_col = "concentration", type_col = "well_type", plate_col = "plate_id", nc_label = "NC", pc_label = "PC", blank_label = "Blank", sep = "\t", sheet = 1 )
file |
A path to a |
plate_id |
Optional plate identifier used when the data has no plate column. |
well_col, signal_col, compound_col, conc_col, type_col, plate_col
|
Names of
the well, signal, compound, concentration, well-type and plate columns in
|
nc_label, pc_label, blank_label
|
Character vectors of the labels that
mark negative controls, positive controls and blanks (matched
case-insensitively in |
sep |
Field separator for |
sheet |
Worksheet passed to readxl for Excel files. Default |
Reading Excel files requires the suggested package readxl.
An hts_raw object (a data frame subclass) with columns plate_id,
well, row, col, well_type, compound_id, concentration and
signal.
baseline_subtract(), calc_z_prime(), norm_by_control()
raw <- read_hts_plate(hts_primary_raw) table(raw$well_type)raw <- read_hts_plate(hts_primary_raw) table(raw$well_type)
Reads a plate map that you author yourself in Excel or CSV to declare, for
every well, whether it holds a negative control, a positive control, a blank
(empty/edge) well or a test compound. Nothing about the layout is fixed by the
package: you are free to place the controls, blanks and compounds in whichever
wells your assay uses, and apply_plate_layout() then stamps those roles onto
the measured readings.
read_plate_layout( file, plate_id = NULL, nc_labels = c("NC", "DMSO", "vehicle", "negative_ctrl", "neg_ctrl"), pc_labels = c("PC", "kill_ctrl", "positive_ctrl", "pos_ctrl"), blank_labels = c("Blank", "edgewell", "empty", "blank", "na", ""), concentration_file = NULL, sheet = 1, sep = "\t" )read_plate_layout( file, plate_id = NULL, nc_labels = c("NC", "DMSO", "vehicle", "negative_ctrl", "neg_ctrl"), pc_labels = c("PC", "kill_ctrl", "positive_ctrl", "pos_ctrl"), blank_labels = c("Blank", "edgewell", "empty", "blank", "na", ""), concentration_file = NULL, sheet = 1, sep = "\t" )
file |
Path to the plate-map grid ( |
plate_id |
Optional plate identifier attached to every well of the layout, so the same map can be matched to a specific plate. |
nc_labels, pc_labels, blank_labels
|
Character vectors of the cell labels that mark negative controls, positive controls and blank/empty wells. All other non-empty labels become compound identifiers. |
concentration_file |
Optional path to a second grid (same layout) giving the concentration of each well. |
sheet, sep
|
Worksheet (Excel) and field separator ( |
The expected file is a grid that mirrors the physical plate: the first
column holds the row letters (A, B, ...), the remaining column headers are
the plate column numbers (1, 2, ... 24), and each cell contains the
label for that well. Labels are matched case-insensitively against
nc_labels, pc_labels and blank_labels; any other non-empty label is
treated as a compound identifier. An optional second grid of the same shape
supplies per-well concentrations.
An hts_layout data frame with one row per well and the columns
plate_id, well, row, col, well_type ("NC", "PC", "Blank" or
"compound"), compound_id and concentration.
apply_plate_layout(), read_hts_plate(), check_control_label()
f <- system.file("extdata", "plate_layout_example.csv", package = "diffHTS") layout <- read_plate_layout(f, plate_id = "P01") table(layout$well_type)f <- system.file("extdata", "plate_layout_example.csv", package = "diffHTS") layout <- read_plate_layout(f, plate_id = "P01") table(layout$well_type)
A small, simulated table of differential (delta) AUC values with one row per
drug and one column per cell line, used to demonstrate hit selection and
heatmap/scatter visualisation across several cancer cell lines and a normal
(MRC5) cell line.
screen_delta_aucscreen_delta_auc
A data frame with one row per drug and the following columns:
Drug identifier (character).
Delta AUC in the A549 lung cancer cell line (numeric).
Delta AUC in the H1299 lung cancer cell line (numeric).
Delta AUC in the H1975 lung cancer cell line (numeric).
Delta AUC in the H2030 lung cancer cell line (numeric).
Delta AUC in the MRC5 normal lung fibroblast cell line (numeric).
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound. Negative values indicate treatment-induced
sensitisation.
A small, simulated high-throughput drug-screening dataset in long (tidy)
format, mimicking a two-condition experiment in which each drug is tested
across a concentration series under a baseline ("Gy0") and a treatment
("Gy2") condition, alongside negative and positive control wells. It is
sized to run the package examples and vignette quickly.
screen_doseresponsescreen_doseresponse
A data frame with one row per well and the following columns:
Plate identifier (character).
Drug identifier, or a control label such as "DMSO"
(negative) or "kill_ctrl" (positive).
Well role: "sample", "negative_ctrl" or
"positive_cttl".
Experimental condition, "Gy0" (baseline) or "Gy2"
(treatment).
Drug concentration (micromolar).
Viability normalised to the negative control (roughly 0-1).
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound or cell line.
A small, simulated 96-well plate (8 rows by 12 columns) assayed under two
conditions ("Gy0" and "Gy2"), in long (one row per well) format. The
layout follows good HTS practice: the outer ring (row A, row H, columns 1 and
12) is an empty evaporation buffer, the two flanking columns (2 and 11) carry
the positive (kill) and negative (DMSO) controls in a rotationally balanced
diagonal pattern, and the interior block (rows B-G, columns 3-10) holds an
8-point dose series of one drug per row. It is used to demonstrate the
plate-layout heatmap plot_plate_heatmap().
screen_plate_layoutscreen_plate_layout
A data frame with one row per well and the following columns:
Plate identifier such as "EXP99_Gy0" (character).
Experimental condition, "Gy0" or "Gy2".
Well identifier such as "A1" (character).
Plate row letter, "A"-"H" (character).
Plate column number, 1-12 (integer).
Drug identifier, or a control label ("DMSO",
"kill_ctrl"), or NA for empty buffer wells.
Well role: "sample", "negative_ctrl",
"positive_ctrl" or "empty" (evaporation-buffer ring).
Drug concentration (micromolar), NA for controls
and empty wells.
Viability normalised to the negative control; empty buffer wells hold no live cells and read near the kill control.
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound or cell line.
A small, simulated per-plate quality-control (QC) table spanning several experiments (cell lines), each with a few plates. Every plate carries its negative- and positive-control replicate readouts together with the QC metrics derived from them, so the table can drive the control scatter, the circular control heatmap and the circular Z'-factor plot. A couple of plates are deliberately noisy so that passing and failing plates are both present.
screen_plate_qcscreen_plate_qc
A data frame with one row per plate and the following columns:
Plate identifier such as "EXP76_01" (character).
Experiment identifier (character), the plate prefix.
Cell line assayed on the experiment (character).
Plate order within the experiment (integer).
Assay Z-factor from sample and negative-control wells.
Z-prime factor from negative- and positive-control wells.
Signal-to-background ratio.
Signal-to-noise value.
Strictly standardised mean difference.
Coefficient of variation of the negative controls (percent).
Negative-control well readouts.
Positive-control well readouts.
The data are simulated (see data-raw/make_datasets.R) and do not
correspond to any real compound or cell line.
plot_control_scatter(), plot_qc_metric_circular(),
plot_qc_circular_heatmap()
Nominates drugs whose score is below a fixed cut-off in a required number of the supplied score columns. This implements the cut-off based hit-selection strategy used to intersect differential responses across several cancer cell lines.
select_hits_cutoff( data, score_cols, cutoff = 0, min_pass = length(score_cols), drug_col = "drug_name" )select_hits_cutoff( data, score_cols, cutoff = 0, min_pass = length(score_cols), drug_col = "drug_name" )
data |
A data frame with one row per drug: a drug identifier column plus
one numeric score column per condition or cell line (for example
|
score_cols |
Character vector of the score column names to test. |
cutoff |
Numeric threshold. A drug passes a column when its value is
strictly below |
min_pass |
Minimum number of |
drug_col |
Name of the drug identifier column, as a string. Default
|
The subset of data (rows) meeting the criterion, with an added
integer column n_pass giving the number of score columns below cutoff.
Rows containing missing scores in the tested columns are dropped.
df <- data.frame( drug_name = c("DrugA", "DrugB", "DrugC"), A549 = c(-0.5, 0.2, -0.9), H1299 = c(-0.3, -0.1, -0.8) ) select_hits_cutoff(df, score_cols = c("A549", "H1299"), cutoff = 0, min_pass = 2)df <- data.frame( drug_name = c("DrugA", "DrugB", "DrugC"), A549 = c(-0.5, 0.2, -0.9), H1299 = c(-0.3, -0.1, -0.8) ) select_hits_cutoff(df, score_cols = c("A549", "H1299"), cutoff = 0, min_pass = 2)
Nominates drugs whose standardised score exceeds a given number of standard deviations from the mean, in the desired direction. This implements the sigma-based (for example 2-sigma or 3-sigma) hit-selection strategy applied to z-scored differential AUC values.
select_hits_sigma( data, score_col = "zscore_delta_auc", n_sigma = 3, direction = c("less", "greater"), standardize = FALSE, drug_col = "drug_name" )select_hits_sigma( data, score_col = "zscore_delta_auc", n_sigma = 3, direction = c("less", "greater"), standardize = FALSE, drug_col = "drug_name" )
data |
A data frame with one row per drug. |
score_col |
Name of the numeric (typically already z-scored) score
column, as a string. Default |
n_sigma |
Number of standard deviations defining the threshold. Default
|
direction |
Either |
standardize |
Logical. If |
drug_col |
Name of the drug identifier column, as a string. Default
|
The subset of data whose score is beyond the sigma threshold in the
requested direction, ordered by score.
select_hits_cutoff(), compute_delta_auc()
df <- data.frame( drug_name = paste0("Drug", 1:6), zscore_delta_auc = c(-3.4, -1.2, 0.1, 0.5, 1.1, -2.8) ) select_hits_sigma(df, n_sigma = 2, direction = "less")df <- data.frame( drug_name = paste0("Drug", 1:6), zscore_delta_auc = c(-3.4, -1.2, 0.1, 0.5, 1.1, -2.8) ) select_hits_sigma(df, n_sigma = 2, direction = "less")
Flags active compounds from single-concentration primary-screen data using either a fixed activity threshold or a percentile rank of the whole library.
select_primary_hit( data, value = "inhibition", method = c("threshold", "percentile"), threshold = 50, percentile = 0.95, compound_col = "compound_id" )select_primary_hit( data, value = "inhibition", method = c("threshold", "percentile"), threshold = 50, percentile = 0.95, compound_col = "compound_id" )
data |
An |
value |
Name of the activity column. Default |
method |
Selection mode: |
threshold |
Activity cut-off for |
percentile |
Upper fraction to keep for |
compound_col |
Name of the compound column. Default |
A data frame with one row per compound: compound_id, activity,
is_hit. The applied cut-off is stored in attr(x, "cutoff") and the
method in attr(x, "method").
summarize_primary_hit(), plot_primary_inhibition_rank()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) hits <- select_primary_hit(norm, threshold = 50) sum(hits$is_hit)norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) hits <- select_primary_hit(norm, threshold = 50) sum(hits$is_hit)
Treats the per-compound activity of the whole library as an approximately normal "inactive" distribution and flags compounds sitting far out in the tail. Each compound receives a z-score (how many standard deviations it lies from the library centre) and is binned by whether it clears 1, 2 or 3 sigma. By default the centre and spread are estimated robustly (median and MAD), the HTS-standard choice: a handful of genuine hits would otherwise inflate a plain mean/SD and mask themselves (with too wide an SD nothing reaches 3 sigma).
select_sigma_hits( data, value = "inhibition", method = c("robust", "sd"), n_sigma = 3, direction = c("greater", "less", "two.sided"), compound_col = "compound_id" )select_sigma_hits( data, value = "inhibition", method = c("robust", "sd"), n_sigma = 3, direction = c("greater", "less", "two.sided"), compound_col = "compound_id" )
data |
An |
value |
Name of the activity column. Default |
method |
How to estimate the distribution centre and spread:
|
n_sigma |
Number of sigma a compound must clear to be called a hit.
Default |
direction |
Tail to test: |
compound_col |
Name of the compound column. Default |
A data frame with one row per compound: compound_id, activity,
sigma (signed z-score), sigma_level (0-3, how many sigma it clears in
the tested direction), band (an ordered-factor label) and is_hit
(sigma_level >= n_sigma). The distribution center, scale, method,
n_sigma and direction are stored as attributes.
summarize_sigma_hits(), plot_sigma_hits(), select_primary_hit()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) hits <- select_sigma_hits(norm, n_sigma = 3) sum(hits$is_hit)norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) hits <- select_sigma_hits(norm, n_sigma = 3) sum(hits$is_hit)
Reports, for every plate in an hts_raw object, how the plate is laid out:
its physical format, the number of wells of each role (negative/positive
controls, blanks and compounds), how many distinct compounds it carries, and
which columns the controls and compounds occupy. The positions are read
back from your own layout (see read_plate_layout()) rather than assumed by
the package: because a screening run normally spans several plates at
once, this is the quickest way to confirm that every plate carries the
layout you designed before QC and normalisation.
summarize_plate_setup( hts_raw, plate_col = "plate_id", type_col = "well_type", compound_col = "compound_id", col_col = "col", nc_label = "NC", pc_label = "PC", blank_label = "Blank", compound_label = "compound" )summarize_plate_setup( hts_raw, plate_col = "plate_id", type_col = "well_type", compound_col = "compound_id", col_col = "col", nc_label = "NC", pc_label = "PC", blank_label = "Blank", compound_label = "compound" )
hts_raw |
An |
plate_col, type_col, compound_col, col_col
|
Names of the plate,
well-type, compound and column-index columns. Defaults match
|
nc_label, pc_label, blank_label, compound_label
|
Well-type labels for the four roles. |
A data frame with one row per plate and the columns plate_id,
n_wells, plate_format, n_rows, n_cols, n_nc, n_pc, n_blank,
n_compound, n_unique_compound, nc_columns, pc_columns,
blank_columns and compound_columns (control/compound positions given as
compact column ranges such as "3-11").
read_hts_plate(), check_control_label(), calc_z_prime()
raw <- read_hts_plate(hts_primary_raw) # One row per plate; the run holds three 96-well plates here. summarize_plate_setup(raw)raw <- read_hts_plate(hts_primary_raw) # One row per plate; the run holds three 96-well plates here. summarize_plate_setup(raw)
Reports the number of compounds screened, the number of hits and the hit rate.
summarize_primary_hit(hits)summarize_primary_hit(hits)
hits |
A data frame from |
A one-row data frame with n_compounds, n_hits, hit_rate
(fraction) and cutoff.
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) summarize_primary_hit(select_primary_hit(norm))norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) summarize_primary_hit(select_primary_hit(norm))
Counts how many compounds clear 1, 2 and 3 sigma from the library centre and compares each count to what a perfectly normal, hit-free distribution would predict, so enrichment of the tail over chance is obvious.
summarize_sigma_hits(hits)summarize_sigma_hits(hits)
hits |
A data frame from |
A data frame with one row per sigma level (1, 2, 3): sigma,
n_beyond (compounds clearing it), frac_beyond, expected_frac
(normal-theory tail probability) and expected_n (expected count).
select_sigma_hits(), plot_sigma_hits()
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) summarize_sigma_hits(select_sigma_hits(norm))norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw))) summarize_sigma_hits(select_sigma_hits(norm))
A minimal, publication-ready theme: pure-white background, an L-shaped axis
(left and bottom only), light dashed horizontal major grid lines with no
minor grid, restrained dark-grey typography and generous margins. Pair it
with hts_pal() for discrete colours or a viridis/muted-blue gradient for
continuous ones.
theme_hts( base_size = 12, base_family = "", legend = "bottom", grid = c("y", "x", "both", "none") )theme_hts( base_size = 12, base_family = "", legend = "bottom", grid = c("y", "x", "both", "none") )
base_size |
Base font size in points. Default |
base_family |
Base font family; defaults to the device sans-serif. |
legend |
Legend position passed to |
grid |
Which major grid lines to keep: |
A ggplot2::theme object that can be added to any ggplot.
library(ggplot2) ggplot(mtcars, aes(factor(cyl), mpg)) + geom_boxplot() + theme_hts()library(ggplot2) ggplot(mtcars, aes(factor(cyl), mpg)) + geom_boxplot() + theme_hts()
Replaces backslashes with forward slashes so that Windows-style paths can be used consistently across platforms.
windows_to_linux_path(path)windows_to_linux_path(path)
path |
A character vector of file paths. |
A character vector of the same length with backslashes replaced by forward slashes.
windows_to_linux_path("C:\\data\\EXP99\\raw.txt")windows_to_linux_path("C:\\data\\EXP99\\raw.txt")