Skip to content
Snippets Groups Projects
Commit 4d6e7b6d authored by Flavio Lombardo's avatar Flavio Lombardo :goal:
Browse files

Fix directives for test examples

- README update2
parent 0f5cd512
No related branches found
No related tags found
No related merge requests found
...@@ -12,16 +12,24 @@ ...@@ -12,16 +12,24 @@
#' @param unique_name_row_identifier String that indicates the unique identifier for each image, defaults as "filter_image" #' @param unique_name_row_identifier String that indicates the unique identifier for each image, defaults as "filter_image"
#' @export #' @export
#' @examples #' @examples
#' \dontrun{ #' \donttest{
#' list_of_relabeling =list( "PathCellObject" = "onlyDAPIPositve", #' # Set up relabeling list
#' "cCasp3" = "cCASP3", "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3", #' list_of_relabeling <- list(
#' "EpCAM_E-Cadherin" = "E-Cadherin", #' "PathCellObject" = "onlyDAPIPositve",
#' "EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3") #' "cCasp3" = "cCASP3",
#' bind_data <- data_binding(path_to_the_projects_folder = #' "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3",
#' system.file("extdata/to_merge/", package = "drugsens")) #' "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) #' 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 # pivot_longer
......
...@@ -7,6 +7,13 @@ ...@@ -7,6 +7,13 @@
#' @importFrom utils read.csv #' @importFrom utils read.csv
#' @importFrom stats setNames #' @importFrom stats setNames
#' @import roxygen2 #' @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 the files
list_all_files <- function(define_path, extension, recursive_search) { list_all_files <- function(define_path, extension, recursive_search) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#' @importFrom dplyr filter #' @importFrom dplyr filter
#' @return Invisibly returns NULL, but saves plots to disk if save_plots is TRUE #' @return Invisibly returns NULL, but saves plots to disk if save_plots is TRUE
#' @examples #' @examples
#' \dontrun{ #' \donttest{
#' # First process example data #' # First process example data
#' example_path <- system.file("extdata/to_merge/", package = "drugsens") #' example_path <- system.file("extdata/to_merge/", package = "drugsens")
#' raw_data <- data_binding(path_to_the_projects_folder = example_path) #' raw_data <- data_binding(path_to_the_projects_folder = example_path)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#' @importFrom ggplot2 ggplot aes geom_violin geom_boxplot facet_wrap theme element_text labs #' @importFrom ggplot2 ggplot aes geom_violin geom_boxplot facet_wrap theme element_text labs
#' geom_jitter position_jitter stat_summary aes_string #' geom_jitter position_jitter stat_summary aes_string
#' @examples #' @examples
#' \dontrun{ #' \donttest{
#' # First load and process example data #' # First load and process example data
#' example_path <- system.file("extdata/to_merge/", package = "drugsens") #' example_path <- system.file("extdata/to_merge/", package = "drugsens")
#' raw_data <- data_binding(path_to_the_projects_folder = example_path) #' raw_data <- data_binding(path_to_the_projects_folder = example_path)
......
...@@ -8,21 +8,28 @@ ...@@ -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" #' @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 #' @export
#' @examples #' @examples
#' \dontrun{ #' \donttest{
#' # First load example data
#' pkg_path <- system.file("extdata/to_merge/", package = "drugsens") #' pkg_path <- system.file("extdata/to_merge/", package = "drugsens")
#' bind_data <- data_binding( #' bind_data <- data_binding(
#' path_to_the_projects_folder = pkg_path, #' path_to_the_projects_folder = pkg_path,
#' files_extension_to_look_for = "csv" #' files_extension_to_look_for = "csv"
#' ) #' )
#'
#' # Process the data
#' counts_dataframe <- make_count_dataframe(bind_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 # adding the image number so to identify the distribution
......
# In make_run_config.R:
#' Generates and use a config txt file #' Generates and use a config txt file
#' @description #' @description
#' When this function run the first time, it will generated a config.txt file in the user working directory. #' When this function run the first time, it will generated a config.txt file in the user working directory.
...@@ -10,8 +8,9 @@ ...@@ -10,8 +8,9 @@
#' @export #' @export
#' @return A `dataframe`/`tibble`. #' @return A `dataframe`/`tibble`.
#' @examples #' @examples
#' \dontrun{ #' \donttest{
#' make_run_config() #' # Generate config in temporary directory
#' make_run_config(forcePath = tempdir())
#' } #' }
make_run_config <- function(overwrite_config = FALSE, forcePath = NULL) { make_run_config <- function(overwrite_config = FALSE, forcePath = NULL) {
......
...@@ -10,12 +10,15 @@ ...@@ -10,12 +10,15 @@
#' @param .data dataframe with parsed metadata #' @param .data dataframe with parsed metadata
#' @export #' @export
#' @examples #' @examples
#' # Basic example with sample data
#' input_data <- data.frame( #' input_data <- data.frame(
#' Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif" #' Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif"
#' ) #' )
#' test <- drugsens::string_parsing(input_data) #' 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 # Main function to bind data from multiple files
......
![](https://img.shields.io/badge/R-%3E%3D%204.0.0-blue) ![](https://img.shields.io/badge/R-%3E%3D%204.0.0-blue)
![](https://www.r-pkg.org/badges/version/drugsens)
# Overview # Overview
...@@ -10,6 +12,10 @@ This package is complementary to the STAR protocol: [*Protocol for quantifying d ...@@ -10,6 +12,10 @@ This package is complementary to the STAR protocol: [*Protocol for quantifying d
# Installation # Installation
``` r ``` r
Install from CRAN
install.packages("drugsens")
# Or for the latest changes:
devtools::install_git("https://git.scicore.unibas.ch/ovca-research/drugsens") devtools::install_git("https://git.scicore.unibas.ch/ovca-research/drugsens")
# OR # OR
devtools::install_github("https://github.com/flalom/drugsens") # this is the GitLab's mirroring repo devtools::install_github("https://github.com/flalom/drugsens") # this is the GitLab's mirroring repo
......
...@@ -30,15 +30,23 @@ This function gets the count data data.frame, that has a wider format and it ret ...@@ -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 Reformat the counts data in longer format
} }
\examples{ \examples{
\dontrun{ \donttest{
list_of_relabeling =list( "PathCellObject" = "onlyDAPIPositve", # Set up relabeling list
"cCasp3" = "cCASP3", "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3", list_of_relabeling <- list(
"EpCAM_E-Cadherin" = "E-Cadherin", "PathCellObject" = "onlyDAPIPositve",
"EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3") "cCasp3" = "cCASP3",
bind_data <- data_binding(path_to_the_projects_folder = "E-Cadherin: cCASP3" = "E-Cadherin and cCASP3",
system.file("extdata/to_merge/", package = "drugsens")) "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) 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)
} }
} }
...@@ -39,7 +39,7 @@ through make_count_dataframe() and change_data_format_to_longer() to ensure the ...@@ -39,7 +39,7 @@ through make_count_dataframe() and change_data_format_to_longer() to ensure the
data structure for plotting. data structure for plotting.
} }
\examples{ \examples{
\dontrun{ \donttest{
# First process example data # First process example data
example_path <- system.file("extdata/to_merge/", package = "drugsens") example_path <- system.file("extdata/to_merge/", package = "drugsens")
raw_data <- data_binding(path_to_the_projects_folder = example_path) raw_data <- data_binding(path_to_the_projects_folder = example_path)
......
...@@ -58,7 +58,7 @@ This function creates quality control plots and calculates basic statistics for ...@@ -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. The plots provide visual insights into marker expression patterns and data quality.
} }
\examples{ \examples{
\dontrun{ \donttest{
# First load and process example data # First load and process example data
example_path <- system.file("extdata/to_merge/", package = "drugsens") example_path <- system.file("extdata/to_merge/", package = "drugsens")
raw_data <- data_binding(path_to_the_projects_folder = example_path) raw_data <- data_binding(path_to_the_projects_folder = example_path)
......
...@@ -24,19 +24,27 @@ A \code{dataframe}/\code{tibble}. ...@@ -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 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{ \examples{
\dontrun{ \donttest{
# First load example data
pkg_path <- system.file("extdata/to_merge/", package = "drugsens") pkg_path <- system.file("extdata/to_merge/", package = "drugsens")
bind_data <- data_binding( bind_data <- data_binding(
path_to_the_projects_folder = pkg_path, path_to_the_projects_folder = pkg_path,
files_extension_to_look_for = "csv" files_extension_to_look_for = "csv"
) )
# Process the data
counts_dataframe <- make_count_dataframe(bind_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"
)
} }
} }
...@@ -20,7 +20,8 @@ It will import the data config file into the use environment. This data will be ...@@ -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. of the imported dataset and change the name of the markers that is often incorrectly exported.
} }
\examples{ \examples{
\dontrun{ \donttest{
make_run_config() # Generate config in temporary directory
make_run_config(forcePath = tempdir())
} }
} }
...@@ -17,11 +17,14 @@ This function will parse the data from the Image name and will return the metada ...@@ -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 The metadata will be then associated to the count file as well
} }
\examples{ \examples{
# Basic example with sample data
input_data <- data.frame( input_data <- data.frame(
Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif" Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif"
) )
test <- drugsens::string_parsing(input_data) test <- drugsens::string_parsing(input_data)
\dontrun{
data.parsed <- string_parsing(.data) \donttest{
# Example with actual data processing
data.parsed <- string_parsing(input_data)
} }
} }
...@@ -10,4 +10,12 @@ list_all_files(define_path, extension, recursive_search) ...@@ -10,4 +10,12 @@ list_all_files(define_path, extension, recursive_search)
\description{ \description{
This file contains internal utility functions for file handling and processing 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} \keyword{internal}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment