Skip to contents

plot_run_discovery_analysis() creates a visualization of the outcome of the discovery analysis. The visualization consists of four plots:

  • The upper left plot superimposes the discovery p-values (blue) on top of the negative control p-values (red) on an untransformed scale.

  • The upper right plot is the same as the upper left plot, but the scale is negative log-10 transformed. The discovery p-values ideally should trend above the diagonal line, indicating the presence of signal in the discovery set. The horizontal dashed line indicates the multiple testing threshold; discovery pairs whose p-value falls above this line are called as significant.

  • The bottom left panel is a volcano plot of the p-values and log fold changes of the discovery pairs. Each point corresponds to a pair; the estimated log-2 fold change of the pair is plotted on the horizontal axis, and the (negative log-10 transformed) p-value is plotted on the vertical axis. The horizontal dashed line again indicates the multiple testing threshold. Points above the dashed line (colored in purple) are called as discoveries, while points below (colored in blue) are called as insignificant.

  • The bottom right panel is a text box displaying the number of discovery pairs called as significant.

Usage

plot_run_discovery_analysis(
  sceptre_object,
  x_limits = c(-1.5, 1.5),
  point_size = 0.55,
  transparency = 0.8,
  return_indiv_plots = FALSE
)

Arguments

sceptre_object

a sceptre_object that has had run_discovery_analysis called on it

x_limits

(optional; default c(-1.5, 1.5)) a numeric vector of length 2 giving the lower and upper limits of the x-axis (corresponding to log-2 fold change) for the "Discovery volcano plot" panel

point_size

(optional; default 0.55) the size of the individual points in the plot

transparency

(optional; default 0.8) the transparency of the individual points in the plot

return_indiv_plots

(optional; default FALSE) if FALSE then a list of ggplot is returned; if TRUE then a single cowplot object is returned.

Value

a single cowplot object containing the combined panels (if return_indiv_plots is set to TRUE) or a list of the individual panels (if return_indiv_plots is set to FALSE)

Examples

library(sceptredata)
data(highmoi_example_data)
data(grna_target_data_frame_highmoi)
# import data
sceptre_object <- import_data(
  response_matrix = highmoi_example_data$response_matrix,
  grna_matrix = highmoi_example_data$grna_matrix,
  grna_target_data_frame = grna_target_data_frame_highmoi,
  moi = "high",
  extra_covariates = highmoi_example_data$extra_covariates,
  response_names = highmoi_example_data$gene_names
)
positive_control_pairs <- construct_positive_control_pairs(sceptre_object)
discovery_pairs <- construct_cis_pairs(sceptre_object,
  positive_control_pairs = positive_control_pairs,
  distance_threshold = 5e6
)
sceptre_object |>
  set_analysis_parameters(
    side = "left",
    discovery_pairs = discovery_pairs,
    resampling_mechanism = "permutations",
  ) |>
  assign_grnas(method = "thresholding") |>
  run_qc() |>
  run_calibration_check(
    parallel = TRUE,
    n_processors = 2
  ) |>
  run_discovery_analysis(
    parallel = TRUE,
    n_processors = 2
  ) |>
  plot_run_discovery_analysis()
#> Constructing negative control pairs.
#> Generating permutation resamples.
#> Running calibration_check in parallel. Change directories to /var/folders/7v/5sqjgh8j28lgf8qx3gbtq1h00000gp/T//RtmpHhxNRw/sceptre_logs/ and view the files calibration_check_*.out for progress updates.
#> 
#> Generating permutation resamples.
#> Running discovery_analysis in parallel. Change directories to /var/folders/7v/5sqjgh8j28lgf8qx3gbtq1h00000gp/T//RtmpHhxNRw/sceptre_logs/ and view the files discovery_analysis_*.out for progress updates.
#> 
#>