prepare_volcano_input: Prepare volcano input

View source: R/prepare_volcano_input.R

prepare_volcano_inputR Documentation

Prepare volcano input

Description

This function has as input posterior draws, calculates pi-values and credible intervals (CrI), and annotates them with biological information (e.g., cell line, time point) based on parameter names and a user-provided annotation data frame. Returns a data frame that is ready for plotting.

Usage

prepare_volcano_input(posterior, annotation, null.effect = 0, CrI_level = 0.95)

Arguments

posterior

A data frame of posterior draws (one row per draw) extract_fit().

annotation

A data frame with at least one column:

  • parameter: the parameter name (e.g., doubling.1, logOR.treatment)

  • label: the biological label (e.g., cell.line, time.point)

  • Optional: other columns (e.g., group, condition) for future coloring

null.effect

Central parameter value corresponding to no effect (default t=0).

CrI_level

a scalar between 0 and 1 specifying the mass within the credible interval (default=0.95, i.e. 95% credible interval (CrI)).

Details

Only returns pi-values and credible intervals for parameters that are in posterior and annotation. For formula see README or Vignette

Value

A list with:

  • result: A data frame with columns:

    • parameter: original parameter name

    • pi.value: calculated pi.value

    • null.effect: set null effect by user

    • parameter.median: median posterior parameter value

    • parameter.low: lower boundary of CrI of parameter value

    • paramter.high: upper boundary of CrI of parameter value

    • CrI.width: the absolute distance between parameter.low and parameter.high

    • CrI.level: CrI_level set by user

    • label: biological label (e.g., cell.line)

    • Other columns from annotation (e.g., group, condition)

See Also

extract_fit()

Examples

# Example: Simulate posterior and annotation
posterior <- data.frame(
  doubling.1 = rnorm(1000),
  doubling.2 = rnorm(1000)
)

annotation <- data.frame(
  parameter = c("doubling.1", "doubling.2"),
  label = c("cell.line.A", "cell.line.B"),
  group = c("group1", "group1")
)

result <- prepare_volcano_input(
  posterior = posterior,
  annotation = annotation,
)

head(result$result)


BayesVolcano documentation built on March 31, 2026, 5:06 p.m.