detectPanel is an R package for discovering, validating,
and applying small biomarker panels from feature-by-sample count or
expression matrices.
It provides an end-to-end workflow for feature filtering, small-panel search, nested cross-validation, model fitting, prediction on new samples, stability assessment, visualization, and export.
High-dimensional molecular datasets often contain many candidate
biomarkers but relatively few samples. detectPanel is
designed for binary-outcome problems where the goal is to identify a
compact panel while reducing information leakage during model selection
and validation.
A typical workflow is:
detectPanel_result objectsinstall.packages("remotes")
remotes::install_github("Emr-27/detectPanel")Once the package is available on CRAN:
install.packages("detectPanel")The example below generates a small synthetic count matrix and can be run directly after installing the package.
library(detectPanel)
set.seed(42)
n_samples <- 48
n_features <- 18
group <- rep(c("Control", "Case"), each = n_samples / 2)
counts <- matrix(
rpois(n_features * n_samples, lambda = 80),
nrow = n_features,
dimnames = list(
paste0("marker", seq_len(n_features)),
paste0("S", seq_len(n_samples))
)
)
# Add signal to a few features in the positive class
counts[1:3, group == "Case"] <-
counts[1:3, group == "Case"] + 80
metadata <- data.frame(
group = group,
row.names = colnames(counts)
)
result <- discover_panel(
counts = counts,
metadata = metadata,
outcome = "group",
positive = "Case",
panel_size = 3,
candidate_n = 8,
detection_threshold = 5,
min_mean = 10,
min_median = 5,
min_detection = 0.50,
min_group_detection = 0.30,
min_auc = 0.55,
outer_v = 3,
outer_repeats = 1,
inner_v = 3,
inner_repeats = 1,
seed = 42
)
resultThe selected panel is available from:
result$final_panelA fitted detectPanel_result object can be applied
directly to a new feature-by-sample matrix.
new_counts <- counts[, 1:4, drop = FALSE]
probability <- predict(
result,
new_counts,
type = "response"
)
classification <- predict(
result,
new_counts,
type = "class"
)
probability
classificationNew data must contain the features required by the fitted model. The saved model retains the preprocessing and decision information needed for prediction.
detectPanel uses nested cross-validation to estimate
internal validation performance while keeping candidate selection and
panel search within the training data of each outer split.
Nested validation summaries are available from:
result$nested$outer_summaryThe final model is refitted on all available training samples for downstream prediction. Its training performance is apparent performance and should not be used as a substitute for nested cross-validation or independent external validation.
A selected panel should therefore be interpreted as a candidate biomarker model rather than evidence of clinical validation. Independent cohorts and a locked preprocessing and prediction procedure are recommended before prospective or clinical use.
Depending on the fitted result and analysis stage,
detectPanel provides plotting functions for marker
expression, marker ROC curves, panel heatmaps, volcano plots, and
PCA-based QC.
Examples include:
plot(result, type = "roc")
plot(result, type = "feature_frequency")See the function documentation for additional plotting options.
Detailed workflows are included as package vignettes:
browseVignettes("detectPanel")The package includes a vignette covering nested validation and the recommended interpretation of internal validation results.
Function-level documentation is available through R help, for example:
?discover_panel
?fit_panel
?nested_validate_panels
?export_resultsIf you use detectPanel in research, please cite the
package:
citation("detectPanel")detectPanel is distributed under the MIT License.