Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

plot_predicted_curve() currently hardcodes Y-axis labels as "ELISA units". Different assay types require specific units (optical density, kinetic signal, MFI).

Changes

New parameter: assay (optional, default NULL)

  • Accepts "ELISA_OD", "Kinetic_ELISA", "multiplex-bg" (case-insensitive)
  • Maps to appropriate Y-axis labels:
    • ELISA_OD → "Optical density (OD)"
    • Kinetic_ELISA → "Kinetic ELISA signal"
    • multiplex-bg → "MFI (background-subtracted)"
  • Auto-appends "(log scale)" when log_y = TRUE

Label resolution logic:

  1. Use explicit assay parameter if provided
  2. Infer from dataset columns (assay, assay_type, assay_units)
  3. Fall back to "ELISA units"

Error handling:

  • Warns on unsupported assay types, uses default label

Example

# Explicit assay type
plot_predicted_curve(
  model, ids = "patient_123", 
  antigen_iso = "HlyE_IgA",
  assay = "Kinetic_ELISA",
  log_y = TRUE
)
# Y-axis: "Kinetic ELISA signal (log scale)"

# Infer from dataset
dataset$assay <- "ELISA_OD"
plot_predicted_curve(model, ids = "patient_123", antigen_iso = "HlyE_IgA", dataset = dataset)
# Y-axis: "Optical density (OD)"

Backward compatible: existing code unchanged when assay not specified.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.jsdelivr.net
    • Triggering command: /opt/R/4.5.2/lib/R/bin/exec/R /opt/R/4.5.2/lib/R/bin/exec/R --slave --no-save --no-restore -f /tmp/RtmpO7L4VB/callr-scr-631538b28a65 -B /bin/sh plot_predicted_cbash vignettes/articl/usr/local/bin/quarto (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>add assay-specific labels to plot_predictive_curve.R</issue_title>
<issue_description>pull Y axis labels for the plot depending on the assay units (ELISA OD, Kinetic ELISA, multiplex-bg)</issue_description>

Comments on the Issue (you are @copilot in this section)

@Kwan-Jenny @copilot Please revise `plot_predictive_curve()` in `R/plot_predictive_curve.R` so that the Y-axis label is assay-specific. Add a new optional argument `assay` (or `assay_type`) with default `NULL`. If `assay` is provided, use it to determine the Y-axis label; if it is `NULL`, attempt to infer the assay from the input data (e.g., columns named `assay`, `assay_type`, or `assay_units`), and otherwise fall back to the current default label. Implement a small internal helper that maps assay types (case-insensitive) as follows: `ELISA_OD` → `"Optical density (OD)"`, `Kinetic_ELISA` → `"Kinetic ELISA signal"`, and `multiplex-bg` → `"MFI (background-subtracted)"`; if an unsupported assay is provided, issue a warning and keep the existing label. Update the ggplot call to set the Y-axis label via `labs(y = ...)` without breaking existing behavior. Then update all roxygen2 documentation for `plot_predictive_curve()` to document the new argument and describe the inference and fallback behavior. Add or update `testthat` tests to verify that the returned ggplot object has the correct `y` label for each supported assay and that an unknown assay triggers a warning while preserving the default label. Finally, update any relevant examples, vignettes, or README code that call `plot_predictive_curve()` to include at least one example demonstrating assay-specific labeling, and ensure all tests and examples pass `R CMD check`.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 23, 2026 19:47
Co-authored-by: Kwan-Jenny <68584166+Kwan-Jenny@users.noreply.github.com>
Co-authored-by: Kwan-Jenny <68584166+Kwan-Jenny@users.noreply.github.com>
Co-authored-by: Kwan-Jenny <68584166+Kwan-Jenny@users.noreply.github.com>
Copilot AI changed the title [WIP] Add assay-specific labels to plot_predictive_curve.R Add assay-specific Y-axis labels to plot_predicted_curve() Jan 23, 2026
Copilot AI requested a review from Kwan-Jenny January 23, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add assay-specific labels to plot_predictive_curve.R

2 participants