write_outputs_to_directory: Write outputs to directory

View source: R/s4_analysis_functs_2.R

write_outputs_to_directoryR Documentation

Write outputs to directory

Description

write_outputs_to_directory() writes the outputs of a sceptre analysis to a directory on disk. write_outputs_to_directory() writes several files to the specified directory: a text-based summary of the analysis (analysis_summary.txt), the various plots (⁠*.png⁠), the calibration check, power check, discovery analysis results (results_run_calibration_check.rds, results_run_power_check.rds, and results_run_discovery_analysis.rds, respectively), and the binary gRNA-to-cell assignment matrix (grna_assignment_matrix.rds). See Section 8 of the introductory chapter in the manual for more information about this function.

Usage

write_outputs_to_directory(sceptre_object, directory)

Arguments

sceptre_object

a sceptre_object

directory

a string giving the file path to a directory on disk in which to write the results

Value

the value NULL

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",
    resampling_mechanism = "permutations",
    discovery_pairs = discovery_pairs,
    positive_control_pairs = positive_control_pairs
  ) |>
  assign_grnas(method = "thresholding") |>
  run_qc() |>
  run_calibration_check(
    parallel = TRUE,
    n_processors = 2
  ) |>
  run_power_check() |>
  run_discovery_analysis(
    parallel = TRUE,
    n_processors = 2
  ) |>
  write_outputs_to_directory(paste0(tempdir(), "/sceptre_outputs"))
# files written to "sceptre_outputs" in tempdir()

timothy-barry/sceptre documentation built on Nov. 19, 2024, 10:04 a.m.