50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


drugsens (version 0.1.0)

get_QC_plots_parsed_merged_data: Plot QC plots and calculate statistics for bound data

Description

This function creates quality control plots and calculates basic statistics for microscopy data. The plots provide visual insights into marker expression patterns and data quality.

Usage

get_QC_plots_parsed_merged_data(
  .data,
  list_of_columns_to_plot = NULL,
  save_plots = FALSE,
  saving_plots_folder = NULL,
  save_plots_in_patient_specific_subfolders = TRUE,
  fill_color_variable = NULL,
  PID_column_name = "PID",
  isolate_specific_drug = NULL,
  isolate_specific_patient = NULL,
  drug_column_name = "Treatment",
  save_list_of_plots = TRUE,
  p_height = 10,
  p_width = 10,
  verbose = TRUE
)

Value

If save_list_of_plots=TRUE, returns a named list of ggplot objects. Otherwise returns invisible(NULL).

Arguments

.data

The preprocessed data frame to analyze

list_of_columns_to_plot

Columns to include in plots. If NULL, all numeric columns are used.

save_plots

Logical, whether to save plots to files. Defaults to FALSE.

saving_plots_folder

Directory for saving plots. If NULL and save_plots=TRUE, uses a subdirectory of tempdir().

save_plots_in_patient_specific_subfolders

Logical, whether to create patient subdirectories. Defaults to TRUE.

fill_color_variable

Variable name for plot color filling

PID_column_name

Column name for patient IDs. Defaults to "PID".

isolate_specific_drug

Drug name to subset data

isolate_specific_patient

Patient ID to subset data

drug_column_name

Column name for drug information. Defaults to "Treatment".

save_list_of_plots

Logical, whether to return list of plot objects. Defaults to TRUE.

p_height

Plot height in inches. Defaults to 10.

p_width

Plot width in inches. Defaults to 10.

verbose

Logical, whether to show progress messages. Defaults to TRUE.

Examples

Run this code
# \donttest{
# First load and process example data
example_path <- system.file("extdata/to_merge/", package = "drugsens")
raw_data <- data_binding(path_to_the_projects_folder = example_path)
count_data <- make_count_dataframe(raw_data)
processed_data <- change_data_format_to_longer(count_data)

# Basic usage - create plots for all patients
plots <- get_QC_plots_parsed_merged_data(processed_data)

# Save plots to a temporary directory
temp_dir <- file.path(tempdir(), "qc_plots")
plots <- get_QC_plots_parsed_merged_data(
  processed_data,
  save_plots = TRUE,
  saving_plots_folder = temp_dir
)

# Focus on a specific patient
plots <- get_QC_plots_parsed_merged_data(
  processed_data,
  isolate_specific_patient = "B39"
)

# Color plots by tissue type
plots <- get_QC_plots_parsed_merged_data(
  processed_data,
  fill_color_variable = "Tissue"
)
# }

Run the code above in your browser using DataLab