% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/run_all.R
\name{dfdr_run_all}
\alias{dfdr_run_all}
\title{Run a standard set of FDR QC diagnostics}
\usage{
dfdr_run_all(
  xs,
  alpha_main = 0.01,
  alphas = c(1e-04, 5e-04, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2),
  eps = 0.2,
  win_rel = 0.2,
  truncation = "warn_drop",
  k_fixed = 10,
  k_sqrt_mult = 2,
  qband_breaks = c(0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5),
  low_conf = c(0.2, 0.5),
  min_N_equalchance = 2000,
  pep_binwidth = 0.05,
  pep_n_min = 200,
  pep_max = 0.5,
  pep_sanity_thresholds = c(0.01, 0.05, 0.1, 0.2),
  pep_density_max = 0.5,
  pep_rel_tdc_breaks = seq(0, 0.5, by = 0.05),
  pep_rel_tdc_add_decoy = 0L,
  compute_pseudo_pvalues = TRUE,
  pseudo_pvalue_method = "decoy_ecdf",
  p_u_grid = c(seq(0.001, 0.1, by = 0.001), seq(0.11, 1, by = 0.01)),
  p_u_max = 0.1,
  p_stratify = NULL,
  p_min_n_calib = 200,
  p_lambdas = seq(0.5, 0.95, by = 0.05),
  p_min_n_pi0 = 2000,
  bh_boundary = c("mult", "add"),
  bh_win = 0.2,
  bh_delta = NULL
)
}
\arguments{
\item{xs}{Named list of \code{dfdr_tbl} objects.}

\item{alpha_main}{Numeric scalar in \eqn{(0,1]}. Headline threshold (e.g. 0.01).}

\item{alphas}{Numeric vector of thresholds in \eqn{(0,1]} used to build curves.}

\item{eps}{Numeric scalar. Relative perturbation used in elasticity (e.g. 0.2).}

\item{win_rel}{Numeric scalar. Relative window width for local tail support (e.g. 0.2).}

\item{truncation}{Character. Truncation policy for local tail windows; see \code{\link{dfdr_local_tail}}.}

\item{k_fixed}{Integer. Fixed +/-K used in sensitivity intervals.}

\item{k_sqrt_mult}{Numeric. Multiplier for adaptive +/-\eqn{\lceil mult\sqrt{D}\rceil} intervals.}

\item{qband_breaks}{Numeric vector. Cutpoints for q-band equal-chance diagnostic.}

\item{low_conf}{Length-2 numeric vector. Pooled low-confidence region for the equal-chance test.}

\item{min_N_equalchance}{Integer. Minimum pooled N for equal-chance test.}

\item{pep_binwidth}{Numeric. Bin width for PEP reliability bins.}

\item{pep_n_min}{Integer. Minimum bin size to include PEP bins in IPE summary/plots.}

\item{pep_max}{Numeric. Max mean PEP included in IPE summary.}

\item{pep_sanity_thresholds}{Numeric vector. Thresholds for decoy PEP sanity summaries.}

\item{pep_density_max}{Numeric. Max PEP displayed in target/decoy density plot.}

\item{pep_rel_tdc_breaks}{Numeric vector. Breaks used for the TDC-style PEP reliability bins.}

\item{pep_rel_tdc_add_decoy}{Integer. Additive correction used in D/T for TDC-style reliability.}

\item{compute_pseudo_pvalues}{Logical. If \code{TRUE}, attempt to compute pseudo-p-values
when \code{p} is missing.}

\item{pseudo_pvalue_method}{Character. Method passed to \code{\link{score_to_pvalue}}
(default \code{"decoy_ecdf"}).}

\item{p_u_grid}{Numeric vector in \eqn{(0,1]}. Grid for p-value ECDF calibration diagnostics.}

\item{p_u_max}{Numeric scalar in \eqn{(0,1]}. Upper bound of \code{u} used for p-value inflation summaries.}

\item{p_stratify}{Optional character vector of columns for stratified p-value diagnostics.}

\item{p_min_n_calib}{Integer. Minimum n for p-value calibration per stratum.}

\item{p_lambdas}{Numeric vector in \eqn{[0,1)}. Lambdas for Storey \eqn{\pi_0(\lambda)} diagnostic.}

\item{p_min_n_pi0}{Integer. Minimum n for \eqn{\pi_0(\lambda)} diagnostic per stratum.}

\item{bh_boundary}{Character. Boundary window type for BH diagnostics (\code{"mult"} or \code{"add"}).}

\item{bh_win}{Numeric. Relative window size for BH boundary support when \code{bh_boundary="mult"}.}

\item{bh_delta}{Numeric. Additive window size when \code{bh_boundary="add"}.}
}
\value{
A list with components:
\describe{
\item{tables}{A named list of result tables (tibbles) for the computed diagnostics
(e.g. \code{headline}, \code{stability}, \code{local_tail}, \code{elasticity},
and optional PEP/p-value/BH-related tables).}
\item{plots}{A named list of \link[ggplot2:ggplot]{ggplot} objects produced from
the diagnostics.}
\item{objects}{The input \code{xs}, possibly augmented with computed pseudo-p-values
if \code{compute_pseudo_pvalues=TRUE}.}
\item{params}{A list of parameter values used to compute the diagnostics.}
}
}
\description{
Runs stability, boundary-support, and plausibility diagnostics on a named list
of \code{dfdr_tbl} objects and returns both summary tables and plots.
}
\details{
Diagnostics include (depending on available columns):
\itemize{
\item Target/decoy headline diagnostics at \code{alpha_main} (counts, FDR estimate, stability proxies)
\item Stability curves across \code{alphas}
\item Local tail decoy support near each \code{alpha}
\item Elasticity (Jaccard overlap under threshold perturbation)
\item PEP reliability / IPE and PEP sanity summaries (if \code{pep} is present)
\item Equal-chance by q-bands (always attempted; may be not applicable if q-range is truncated)
\item (Pseudo-)p-value calibration and Storey \eqn{\pi_0(\lambda)} (if \code{p} is present or computed)
\item BH diagnostics (if \code{p} is present)
}
}
\examples{
\donttest{
library(tibble)

set.seed(1)
n <- 2000
df <- tibble(
  id = as.character(seq_len(n)),
  run = sample(c("run1", "run2"), n, replace = TRUE),
  is_decoy = sample(c(FALSE, TRUE), n, replace = TRUE, prob = c(0.95, 0.05)),
  score = rnorm(n),
  # Toy q/pep/p for demonstration purposes
  q = pmin(1, rank(-score) / n),
  pep = stats::runif(n),
  p = stats::runif(n)
)
x <- as_dfdr_tbl(df, unit = "psm", scope = "global", q_source = "toy", p_source = "toy")

diag <- dfdr_run_all(
  xs = list(toy = x),
  alpha_main = 0.01,
  compute_pseudo_pvalues = FALSE
)

names(diag$tables)
names(diag$plots)
diag$tables$headline
}
}
