diff --git a/R/change_data_format_to_longer.R b/R/change_data_format_to_longer.R index 2de829482b5d12fde2398280c9fe4e7f5acc1104..a50c749d7abc9904117ddfc64949440461a1f61a 100644 --- a/R/change_data_format_to_longer.R +++ b/R/change_data_format_to_longer.R @@ -12,16 +12,24 @@ #' @param unique_name_row_identifier String that indicates the unique identifier for each image, defaults as "filter_image" #' @export #' @examples -#' \dontrun{ -#' list_of_relabeling =list( "PathCellObject" = "onlyDAPIPositve", -#' "cCasp3" = "cCASP3", "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3", -#' "EpCAM_E-Cadherin" = "E-Cadherin", -#' "EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3") -#' bind_data <- data_binding(path_to_the_projects_folder = -#' system.file("extdata/to_merge/", package = "drugsens")) +#' \donttest{ +#' # Set up relabeling list +#' list_of_relabeling <- list( +#' "PathCellObject" = "onlyDAPIPositve", +#' "cCasp3" = "cCASP3", +#' "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3", +#' "EpCAM_E-Cadherin" = "E-Cadherin", +#' "EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3" +#' ) +#' +#' # Load and process example data +#' bind_data <- data_binding( +#' path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens") +#' ) #' counts_dataframe <- make_count_dataframe(bind_data) -#' plotting_ready_dataframe <- -#' change_data_format_to_longer(counts_dataframe) +#' +#' # Convert to long format +#' plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) #' } # pivot_longer diff --git a/R/data_binding.R b/R/data_binding.R index 0f805b6314a98f1fd224079a041db8cc3953491d..8a1afb20b500e43c8a029504c8b828946ce48062 100644 --- a/R/data_binding.R +++ b/R/data_binding.R @@ -7,6 +7,13 @@ #' @importFrom utils read.csv #' @importFrom stats setNames #' @import roxygen2 +#' @examples +#' \donttest{ +#' # Load example data from package +#' bind_data <- data_binding( +#' path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens") +#' ) +#' } # list all the files list_all_files <- function(define_path, extension, recursive_search) { diff --git a/R/get_QC_plots.R b/R/get_QC_plots.R index 7bd93af3305a15d7ead8ec4cb90d4037270fa4ad..091ed938b2e32470e436de2ae33632149b0f8a09 100644 --- a/R/get_QC_plots.R +++ b/R/get_QC_plots.R @@ -16,7 +16,7 @@ #' @importFrom dplyr filter #' @return Invisibly returns NULL, but saves plots to disk if save_plots is TRUE #' @examples -#' \dontrun{ +#' \donttest{ #' # First process example data #' example_path <- system.file("extdata/to_merge/", package = "drugsens") #' raw_data <- data_binding(path_to_the_projects_folder = example_path) diff --git a/R/get_QC_plots_and_stats.R b/R/get_QC_plots_and_stats.R index 35ea9d7016eb89e9044f04bf176ad28cc3e150d8..0a60c30b1a78685dc508ce6847420a77b888d20f 100644 --- a/R/get_QC_plots_and_stats.R +++ b/R/get_QC_plots_and_stats.R @@ -20,7 +20,7 @@ #' @importFrom ggplot2 ggplot aes geom_violin geom_boxplot facet_wrap theme element_text labs #' geom_jitter position_jitter stat_summary aes_string #' @examples -#' \dontrun{ +#' \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) diff --git a/R/make_count_dataframe.R b/R/make_count_dataframe.R index edd3564065b8ba7f72578b59816426a740215f14..8352da040cb69ab92f921b52460feeb5303b3b05 100644 --- a/R/make_count_dataframe.R +++ b/R/make_count_dataframe.R @@ -8,21 +8,28 @@ #' @param name_of_the_markers_column The name of the column of the .data where the marker names are expressed (ie E-Caderin, DAPI), "Defaults as Name" #' @export #' @examples -#' \dontrun{ +#' \donttest{ +#' # First load example data #' pkg_path <- system.file("extdata/to_merge/", package = "drugsens") #' bind_data <- data_binding( #' path_to_the_projects_folder = pkg_path, #' files_extension_to_look_for = "csv" #' ) +#' +#' # Process the data #' counts_dataframe <- make_count_dataframe(bind_data) -#' plotting_ready_dataframe <- change_data_format_to_longer( -#' counts_dataframe +#' +#' # Convert to plotting format +#' plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) +#' } +#' +#' \donttest{ +#' # Example with custom parameters +#' make_count_dataframe( +#' bind_data, +#' name_of_the_markers_column = "Name", +#' unique_name_row_identifier = "filter_image" #' ) -# make_count_dataframe( -#' data, -#' name_of_the_markers_column = "Name", -#' unique_name_row_identifier = "filter_image" -#' ) #' } # adding the image number so to identify the distribution diff --git a/R/make_run_config.R b/R/make_run_config.R index 3ae38e3ec352238a6f1b08a540094de5905c0497..33fb99d14a1082fd8275cfd41d1d19118aa071ad 100644 --- a/R/make_run_config.R +++ b/R/make_run_config.R @@ -1,5 +1,3 @@ -# In make_run_config.R: - #' Generates and use a config txt file #' @description #' When this function run the first time, it will generated a config.txt file in the user working directory. @@ -10,8 +8,9 @@ #' @export #' @return A `dataframe`/`tibble`. #' @examples -#' \dontrun{ -#' make_run_config() +#' \donttest{ +#' # Generate config in temporary directory +#' make_run_config(forcePath = tempdir()) #' } make_run_config <- function(overwrite_config = FALSE, forcePath = NULL) { diff --git a/R/parsers.R b/R/parsers.R index 72c6055d08cc7824d21d5659a875acde753b1d1b..e470e64a8e7c7e13fab564b977fd1fd7055aaca0 100644 --- a/R/parsers.R +++ b/R/parsers.R @@ -10,12 +10,15 @@ #' @param .data dataframe with parsed metadata #' @export #' @examples +#' # Basic example with sample data #' input_data <- data.frame( #' Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif" #' ) #' test <- drugsens::string_parsing(input_data) -#' \dontrun{ -#' data.parsed <- string_parsing(.data) +#' +#' \donttest{ +#' # Example with actual data processing +#' data.parsed <- string_parsing(input_data) #' } # Main function to bind data from multiple files diff --git a/README.md b/README.md index e2e67f46832eefd5af7b32ae297cfcf1fa93d16b..b554164e5f5a4569ea926d507781ac5828bd9fc7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@  + + # Overview @@ -10,6 +12,10 @@ This package is complementary to the STAR protocol: [*Protocol for quantifying d # Installation ``` r +Install from CRAN +install.packages("drugsens") + +# Or for the lastest changes: devtools::install_git("https://git.scicore.unibas.ch/ovca-research/drugsens") # OR devtools::install_github("https://github.com/flalom/drugsens") # this is the GitLab's mirroring repo diff --git a/man/change_data_format_to_longer.Rd b/man/change_data_format_to_longer.Rd index 93a2d8353a5b0aace9ea37f17319dd70d9605b78..33ad99496cb9d0e009f59bd9bf8be56431684edc 100644 --- a/man/change_data_format_to_longer.Rd +++ b/man/change_data_format_to_longer.Rd @@ -30,15 +30,23 @@ This function gets the count data data.frame, that has a wider format and it ret Reformat the counts data in longer format } \examples{ -\dontrun{ -list_of_relabeling =list( "PathCellObject" = "onlyDAPIPositve", -"cCasp3" = "cCASP3", "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3", -"EpCAM_E-Cadherin" = "E-Cadherin", -"EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3") -bind_data <- data_binding(path_to_the_projects_folder = -system.file("extdata/to_merge/", package = "drugsens")) +\donttest{ +# Set up relabeling list +list_of_relabeling <- list( + "PathCellObject" = "onlyDAPIPositve", + "cCasp3" = "cCASP3", + "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3", + "EpCAM_E-Cadherin" = "E-Cadherin", + "EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3" +) + +# Load and process example data +bind_data <- data_binding( + path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens") +) counts_dataframe <- make_count_dataframe(bind_data) -plotting_ready_dataframe <- -change_data_format_to_longer(counts_dataframe) + +# Convert to long format +plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) } } diff --git a/man/get_QC_plots.Rd b/man/get_QC_plots.Rd index 14cc7ab84cde079df6b6a4234d5bd0d8a6cf3e5f..2e07c3b79a69ceccd5c28b74557a14554d7ac7d5 100644 --- a/man/get_QC_plots.Rd +++ b/man/get_QC_plots.Rd @@ -39,7 +39,7 @@ through make_count_dataframe() and change_data_format_to_longer() to ensure the data structure for plotting. } \examples{ -\dontrun{ +\donttest{ # First process example data example_path <- system.file("extdata/to_merge/", package = "drugsens") raw_data <- data_binding(path_to_the_projects_folder = example_path) diff --git a/man/get_QC_plots_parsed_merged_data.Rd b/man/get_QC_plots_parsed_merged_data.Rd index 084f98acc5d53208636c47c22dfffccb29ceb34c..346fe9e98706de295d28d7abaddc2fa7415d26ab 100644 --- a/man/get_QC_plots_parsed_merged_data.Rd +++ b/man/get_QC_plots_parsed_merged_data.Rd @@ -58,7 +58,7 @@ This function creates quality control plots and calculates basic statistics for The plots provide visual insights into marker expression patterns and data quality. } \examples{ -\dontrun{ +\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) diff --git a/man/make_count_dataframe.Rd b/man/make_count_dataframe.Rd index f1aa2bfd7012df9f380397ce7ad2a4393130c4b7..d19cfb8dc5992efee222a40bc952063f7d1a763e 100644 --- a/man/make_count_dataframe.Rd +++ b/man/make_count_dataframe.Rd @@ -24,19 +24,27 @@ A \code{dataframe}/\code{tibble}. This function counts every single marker present in the "Name" column of the data.frame and return a dataframe of the counts per marker } \examples{ -\dontrun{ +\donttest{ +# First load example data pkg_path <- system.file("extdata/to_merge/", package = "drugsens") bind_data <- data_binding( path_to_the_projects_folder = pkg_path, files_extension_to_look_for = "csv" ) + +# Process the data counts_dataframe <- make_count_dataframe(bind_data) -plotting_ready_dataframe <- change_data_format_to_longer( - counts_dataframe + +# Convert to plotting format +plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) +} + +\donttest{ +# Example with custom parameters +make_count_dataframe( + bind_data, + name_of_the_markers_column = "Name", + unique_name_row_identifier = "filter_image" ) - data, - name_of_the_markers_column = "Name", - unique_name_row_identifier = "filter_image" - ) } } diff --git a/man/make_run_config.Rd b/man/make_run_config.Rd index a56cf8e6b06a21416816cd92a451ab007c82f9e2..29baa0e5ed7acba0e6262de61f9798758d844488 100644 --- a/man/make_run_config.Rd +++ b/man/make_run_config.Rd @@ -20,7 +20,8 @@ It will import the data config file into the use environment. This data will be of the imported dataset and change the name of the markers that is often incorrectly exported. } \examples{ -\dontrun{ - make_run_config() +\donttest{ +# Generate config in temporary directory +make_run_config(forcePath = tempdir()) } } diff --git a/man/string_parsing.Rd b/man/string_parsing.Rd index 31fee436dc02935cdb6ff0337c41585ec8beed6a..ba0b29bebc35e6273a27294a3c26fc38f6569212 100644 --- a/man/string_parsing.Rd +++ b/man/string_parsing.Rd @@ -17,11 +17,14 @@ This function will parse the data from the Image name and will return the metada The metadata will be then associated to the count file as well } \examples{ +# Basic example with sample data input_data <- data.frame( Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif" ) test <- drugsens::string_parsing(input_data) -\dontrun{ - data.parsed <- string_parsing(.data) + +\donttest{ +# Example with actual data processing +data.parsed <- string_parsing(input_data) } } diff --git a/man/utils_internal.Rd b/man/utils_internal.Rd index a0dfbbe295b7d9d142f5cf007ee36d274c91d390..e3fc98981702dcda919ae8cc6ae5739a737bd8bd 100644 --- a/man/utils_internal.Rd +++ b/man/utils_internal.Rd @@ -10,4 +10,12 @@ list_all_files(define_path, extension, recursive_search) \description{ This file contains internal utility functions for file handling and processing } +\examples{ +\donttest{ +# Load example data from package +bind_data <- data_binding( + path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens") +) +} +} \keyword{internal}