From 4d6e7b6d0672d23b9831fd1c287c950ae3239ac3 Mon Sep 17 00:00:00 2001
From: Flavio Lombardo <flavio.lombardo@unibas.ch>
Date: Thu, 16 Jan 2025 10:26:56 +0100
Subject: [PATCH] Fix directives for test examples - README update2

---
 R/change_data_format_to_longer.R       | 26 +++++++++++++++++---------
 R/data_binding.R                       |  7 +++++++
 R/get_QC_plots.R                       |  2 +-
 R/get_QC_plots_and_stats.R             |  2 +-
 R/make_count_dataframe.R               | 23 +++++++++++++++--------
 R/make_run_config.R                    |  7 +++----
 R/parsers.R                            |  7 +++++--
 README.md                              |  6 ++++++
 man/change_data_format_to_longer.Rd    | 26 +++++++++++++++++---------
 man/get_QC_plots.Rd                    |  2 +-
 man/get_QC_plots_parsed_merged_data.Rd |  2 +-
 man/make_count_dataframe.Rd            | 22 +++++++++++++++-------
 man/make_run_config.Rd                 |  5 +++--
 man/string_parsing.Rd                  |  7 +++++--
 man/utils_internal.Rd                  |  8 ++++++++
 15 files changed, 105 insertions(+), 47 deletions(-)

diff --git a/R/change_data_format_to_longer.R b/R/change_data_format_to_longer.R
index 2de8294..a50c749 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 0f805b6..8a1afb2 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 7bd93af..091ed93 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 35ea9d7..0a60c30 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 edd3564..8352da0 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 3ae38e3..33fb99d 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 72c6055..e470e64 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 e2e67f4..e3bef56 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
 ![](https://img.shields.io/badge/R-%3E%3D%204.0.0-blue)
+![](https://www.r-pkg.org/badges/version/drugsens)
+
 
 # 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 latest 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 93a2d83..33ad994 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 14cc7ab..2e07c3b 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 084f98a..346fe9e 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 f1aa2bf..d19cfb8 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 a56cf8e..29baa0e 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 31fee43..ba0b29b 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 a0dfbbe..e3fc989 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}
-- 
GitLab