From 7b377281ed4fb846d871240439d463d973f9eaad Mon Sep 17 00:00:00 2001 From: flalom <flavio.lombardo@unibas.ch> Date: Fri, 10 Jan 2025 17:30:52 +0100 Subject: [PATCH] Typos and fixes to the tests --- DESCRIPTION | 26 +++++++++++--------- DRUGSENS.Rproj | 1 + NAMESPACE | 3 +++ NEWS.md | 8 +++--- R/change_data_format_to_longer.R | 2 +- R/data_binding.R | 17 ++++++++++++- R/get_QC_plots.R | 2 +- R/get_QC_plots_and_stats.R | 2 +- R/make_count_dataframe.R | 6 +++-- R/make_run_config.R | 30 ++++++++++++++--------- R/parsers.R | 12 +++------ README.md | 38 ++++++++++++++--------------- cran-comments.md | 2 +- man/change_data_format_to_longer.Rd | 2 +- man/data_binding.Rd | 2 +- man/make_count_dataframe.Rd | 4 ++- man/make_run_config.Rd | 6 +++-- man/string_parsing.Rd | 7 ++---- tests/testthat.R | 4 +-- tests/testthat/test_cases.R | 16 ++++++------ 20 files changed, 107 insertions(+), 83 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6355ffc..9baf8b0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,20 +1,25 @@ -Package: DRUGSENS -Title: Allows users to automatically analyze QuPathâ„¢'s output data from imaging analysis. - In addition, it will automatically extract metadata from the QuPath's data. +Package: drugsens +Title: Automated Analysis of QuPath Output Data and Metadata Extraction +Description: A comprehensive toolkit for analyzing microscopy data output from + QuPath software. Provides functionality for automated data processing, + metadata extraction, and statistical analysis of imaging results. + Designed to complement the STAR Protocol Protocol for quantifying drug + sensitivity in 3D patient-derived ovarian cancer models + 10.1016/j.xpro.2024.103274. Version: 0.1.0 -BugReports: https://git.scicore.unibas.ch/ovca-research/DRUGSENS/issues +BugReports: https://git.scicore.unibas.ch/ovca-research/drugsens/-/issues +SystemRequirements: QuPathâ„¢ 4.0.0 or higher Authors@R: c( person("Flavio", "Lombardo", , "flavio.lombardo@unibas.ch", role = c("aut", "cre", "cph")), person("Ricardo Coelho", role = c("cph")), person("Ovarian Cancer Research", role = c("cph")), person("University of Basel and University Hospital Basel", role = c("cph")) ) -URL: https://git.scicore.unibas.ch/ovca-research/DRUGSENS/ +URL: https://git.scicore.unibas.ch/ovca-research/drugsens/ Maintainer: Flavio Lombardo <flavio.lombardo@unibas.ch> -Description: This package simplifies the analysis of QuPath data is complementary to the STAR Protocol: - "DRUG-SENS: Quantification of Drug Sensitivity in 3D Patient-derived Ovarian Cancer Models" License: MIT + file LICENSE Imports: + utils, dplyr, tidyr, readr, @@ -24,15 +29,12 @@ Imports: ggpubr, roxygen2, tidyselect, - testthat + testthat (>= 3.0.0) Depends: R (>= 4.2) -VignetteBuilder: - knitr Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Suggests: - testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/DRUGSENS.Rproj b/DRUGSENS.Rproj index 497f8bf..f6148a8 100644 --- a/DRUGSENS.Rproj +++ b/DRUGSENS.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: f74fea1e-5558-4d73-88d5-cd26abfa4378 RestoreWorkspace: Default SaveWorkspace: Default diff --git a/NAMESPACE b/NAMESPACE index 0a598ef..579ce91 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,11 +10,14 @@ export(make_run_config) import(ggplot2) import(ggpubr) import(knitr) +import(roxygen2) import(testthat) importFrom(dplyr,filter) importFrom(dplyr,select) importFrom(readr,write_excel_csv) +importFrom(stats,setNames) importFrom(stringr,str_count) importFrom(stringr,str_extract) importFrom(tidyr,pivot_longer) importFrom(tidyselect,any_of) +importFrom(utils,read.csv) diff --git a/NEWS.md b/NEWS.md index 4b15134..1e13e86 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ -# DRUGSENS Changelog +# drugsens Changelog -All notable changes to the DRUGSENS project will be documented in this file. +All notable changes to the drugsens project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- Initial creation of the DRUGSENS tool for analyzing drug sensitivity in cancer cell lines and cancer patients. +- Initial creation of the drugsens tool for analyzing drug sensitivity in cancer cell lines and cancer patients. - Addition of `make_count_dataframe` function for counting cell marker expressions. - Implementation of `change_data_format_to_longer` function to reformat data into a longer format for easier analysis. @@ -30,7 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.0] - 2024-01-01 ### Added -- Launch of the first version of DRUGSENS, providing functionalities for drug sensitivity analysis in translational research. +- Launch of the first version of drugsens, providing functionalities for drug sensitivity analysis in translational research. - Support for `.csv` files. - Comprehensive metadata extraction from microscopy images, including patient ID, tissue type, and treatment details. - Testing diff --git a/R/change_data_format_to_longer.R b/R/change_data_format_to_longer.R index 80d3b19..c10a11e 100644 --- a/R/change_data_format_to_longer.R +++ b/R/change_data_format_to_longer.R @@ -16,7 +16,7 @@ #' "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")) +#' system.file("extdata/to_merge/", package = "drugsens")) #' counts_dataframe <- make_count_dataframe(bind_data) #' plotting_ready_dataframe <- #' change_data_format_to_longer(counts_dataframe) diff --git a/R/data_binding.R b/R/data_binding.R index f49f746..2347259 100644 --- a/R/data_binding.R +++ b/R/data_binding.R @@ -3,6 +3,19 @@ #' This function lists the content of a selected folder either recursively or not #' @keywords internal #' @returns list +#' @name "Name", "list_of_relabeling", "marker_positivity","marker_positivity_ratio", "x", "y" +#' @importFrom utils read.csv +#' @importFrom stats setNames +#' @import roxygen2 +#' + +# important for the scripts +globalVariables(c( + "Name", "list_of_relabeling", "marker_positivity", + "marker_positivity_ratio", "x", "y" +)) + +# list all the files list_all_files <- function(define_path, extension, recursive_search) { list_listed_files <- list.files( path = define_path, @@ -23,6 +36,8 @@ list_all_files <- function(define_path, extension, recursive_search) { # Helper function to read and process a single file #' @description #' This function returns a processed single file +#' @param file_path Path to the file +#' @param extension String File extension to filter #' @keywords internal #' @returns dataframe process_file <- function(file_path, @@ -83,7 +98,7 @@ process_file <- function(file_path, #' @export #' @examples #' bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", -#' package = "DRUGSENS")) +#' package = "drugsens")) #' #This will return the dataframe of all the data in the folder # Main function to bind data from multiple files data_binding <- function(path_to_the_projects_folder, diff --git a/R/get_QC_plots.R b/R/get_QC_plots.R index 9ad11a3..6f24033 100644 --- a/R/get_QC_plots.R +++ b/R/get_QC_plots.R @@ -14,7 +14,7 @@ #' @importFrom dplyr filter #' @return A `dataframe`/`tibble`. #' @example -#' get_QC_plots(longer_format_dataframe, patient_column_name = "PID", save_plots = TRUE, folder_name = "figures") +#' \dontrun{get_QC_plots(longer_format_dataframe, patient_column_name = "PID", save_plots = TRUE, folder_name = "figures")} #' @export get_QC_plots <- function(.data, patient_column_name = "PID", diff --git a/R/get_QC_plots_and_stats.R b/R/get_QC_plots_and_stats.R index f70b173..cf1ebd2 100644 --- a/R/get_QC_plots_and_stats.R +++ b/R/get_QC_plots_and_stats.R @@ -23,7 +23,7 @@ #' @importFrom dplyr filter #' @return A `list`/`NULL`. #' @example -#' ui <- get_QC_plots_parsed_merged_data(bind_data, save_plots = TRUE, save_list_of_plots = TRUE) +#' \dontrun {qc <- get_QC_plots_parsed_merged_data(bind_data, save_plots = TRUE, save_list_of_plots = TRUE)} #' @export get_QC_plots_parsed_merged_data <- function(.data, diff --git a/R/make_count_dataframe.R b/R/make_count_dataframe.R index 202320c..d0c783a 100644 --- a/R/make_count_dataframe.R +++ b/R/make_count_dataframe.R @@ -8,11 +8,13 @@ #' @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 -#' bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "DRUGSENS"), files_extension_to_look_for = "csv") +#' bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens"), files_extension_to_look_for = "csv") #' counts_dataframe <- make_count_dataframe(bind_data) #' plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) #' @example -#' make_count_dataframe(data, name_of_the_markers_column = "Name", unique_name_row_identifier = "filter_image") +#' \dontrun{make_count_dataframe(data, name_of_the_markers_column = "Name", unique_name_row_identifier = "filter_image")} +#' @return text file + # adding the image number so to identify the distribution make_count_dataframe <- function(.data, unique_name_row_identifier = "filter_image", name_of_the_markers_column = "Name") { diff --git a/R/make_run_config.R b/R/make_run_config.R index 2227812..232cdc4 100644 --- a/R/make_run_config.R +++ b/R/make_run_config.R @@ -3,25 +3,31 @@ #' When this function run the first time, it will generated a config.txt file in the user working directory. #' It will import the data config file into the use environment. This data will be used to change the column names #' of the imported dataset and change the name of the markers that is often incorrectly exported. -#' @param overwrite_config Boolean, if TRUE the `config_DRUGSENS.txt` will be overwritten (default is FALSE) +#' @param overwrite_config Boolean, if TRUE the `config_drugsens.txt` will be overwritten (default is FALSE) +#' @param forcePath String, Define a custom path for the config file #' @export #' @return A `dataframe`/`tibble`. #' @example -make_run_config <- function(overwrite_config = FALSE) { - if (file.exists("config_DRUGSENS.txt")) { +#' \dontrun {make_run_config()} +make_run_config <- function(overwrite_config = FALSE, forcePath = NULL) { + + if (is.null(forcePath)) currentPath <- getwd() else currentPath <- forcePath + + if (file.exists("config_drugsens.txt")) { tryCatch( expr = { - source("config_DRUGSENS.txt", local = FALSE) + source("config_drugsens.txt", local = FALSE) }, error = function(error) { - message("DRUGSENS could not load the 'config.txt' file. - Please, generate a valid config file with the substitution names form the dataframe - and the name of the columns to use for your project. - Once the 'config.txt' is available re-run run_config to veryfy that the data was correctly read") + message("drugsens could not load the 'config.txt' file. + Please, generate a valid config file with the substitution + names form the dataframe and the name of the columns to use + for your project. Once the 'config.txt' is available re-run + run_config to veryfy that the data was correctly read") } ) } else if (overwrite_config){ - message("Overwriting config_DRUGSENS.txt") + message("Overwriting config_drugsens.txt") write( x = ( @@ -36,9 +42,9 @@ make_run_config <- function(overwrite_config = FALSE) { "EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3" )' ), - file = paste0(path.expand(getwd()), "/config_DRUGSENS.txt") + file = paste0(path.expand(currentPath), "/config_drugsens.txt") ) - message("config_DRUGSENS.txt has been overwritten correctly.") + message("config_drugsens.txt has been overwritten correctly.") } else { write( x = @@ -54,7 +60,7 @@ make_run_config <- function(overwrite_config = FALSE) { "EpCAM_E-Cadherin and cCASP3" = "E-Cadherin and cCASP3" )' ), - file = paste0(path.expand(getwd()), "/config_DRUGSENS.txt") + file = paste0(path.expand(currentPath), "/config_drugsens.txt") ) } } diff --git a/R/parsers.R b/R/parsers.R index 7507a49..ed40c09 100644 --- a/R/parsers.R +++ b/R/parsers.R @@ -9,15 +9,11 @@ #' @return A `dataframe`/`tibble`. #' @param .data dataframe with parsed metadata #' @examples -#' 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) -#' -#' +#' 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) #' @example -#' data.parsed <- string_parsing(.data) -#' -#' #This will return the dataframe of all the data in the folder +#' \dontrun {data.parsed <- string_parsing(.data)} + # Main function to bind data from multiple files string_parsing <- function(.data) { # add the image name diff --git a/README.md b/README.md index 0cfd4f7..7fd35d7 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,20 @@ # Overview -DRUGSENS is a R-package that allows users to automatically analyze QuPath™'s output data from imaging analysis. -Here we include a QuPath™ script (the same that we regularly use) to run reproducible QuPath™-based image analysis, and some examples on how DRUGSENS can be used. For more detailed examples of QuPath™ scripting and usage please refer to [QuPath™'s Documentation](https://qupath.readthedocs.io/en/stable/). +drugsens is a R-package that allows users to automatically analyze QuPath™'s output data from imaging analysis. +Here we include a QuPath™ script (the same that we regularly use) to run reproducible QuPath™-based image analysis, and some examples on how drugsens can be used. For more detailed examples of QuPath™ scripting and usage please refer to [QuPath™'s Documentation](https://qupath.readthedocs.io/en/stable/). This script should be placed into scripts manager within QuPath™. We tested this code with previous versions of QuPath™, but new versions should also be compatible. -This package is complementary to the STAR protocol: [*Protocol for quantifying drug sensitivity in 3D patient-derived ovarian cancer models DOI: DOI: 10.1016/j.xpro.2024.103274*](https://doi.org/10.1016/j.xpro.2024.103274). +This package is complementary to the STAR protocol: [*Protocol for quantifying drug sensitivity in 3D patient-derived ovarian cancer models DOI: 10.1016/j.xpro.2024.103274*](https://doi.org/10.1016/j.xpro.2024.103274). # Installation ``` r 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 ``` -`devtools` is required to install DRUGSENS. If `devtools` is not installed yet you can install it with: +`devtools` is required to install drugsens. If `devtools` is not installed yet you can install it with: ``` r # Install devtools from CRAN @@ -155,7 +153,7 @@ print "Done!" ## Example -We recommend making a new project when working with `DRUGSENS`, to have clear and defined path. This will make the data analysis much easier and reproducible. +We recommend making a new project when working with `drugsens`, to have clear and defined path. This will make the data analysis much easier and reproducible. You can also set you working directory with `setwd()`. ### QuPath data in R @@ -163,26 +161,26 @@ You can also set you working directory with `setwd()`. To make the QuPath script locally available within the working directory, with the currents date: ``` r -library("DRUGSENS") +library("drugsens") generate_qupath_script() ``` This function will generate a `script_for_qupath.txt` file with the code that one can copy/paste into the __QuPath's script manager__. All the sections that contain \<\> should be replaced with the user experimental information. The `columnsToInclude` in the script should also be user defined, depending on the markers used. -It is very important that the file naming structure of the QuPath's output is maintained for `DRUGSENS` to work correctly. +It is very important that the file naming structure of the QuPath's output is maintained for `drugsens` to work correctly. > ðŸ“**NOTE** ->The column `Image` must be present in the data for DRUGSENS to parse the metadata correctly. Title style (This Is An Example) is fine, but if you have a drug combination refer to the formatting as described below [Handling drug combinations](#bind-qupath-files). +>The column `Image` must be present in the data for drugsens to parse the metadata correctly. Title style (This Is An Example) is fine, but if you have a drug combination refer to the formatting as described below [Handling drug combinations](#bind-qupath-files). ### Generate configuration file -This command will generate a `config_DRUGSENS.txt` that should be edited to include the names of the cell markers that have been used by the experimenter. +This command will generate a `config_drugsens.txt` that should be edited to include the names of the cell markers that have been used by the experimenter. In our case we replaced `"PathCellObject"` with `"onlyDAPIPositve"`. ``` r make_run_config() ``` -Once the file `config_DRUGSENS.txt` has been modified; you can feed it back to `R`; this will be done automatically once you run `data_binding()`. -Now the `list_of_relabeling` should be available in the R environment and it can be used by `DRUGSENS` to work. `list_of_relabeling` is a named list that is required for relabeling the markers name, that is often not user friendly. +Once the file `config_drugsens.txt` has been modified; you can feed it back to `R`; this will be done automatically once you run `data_binding()`. +Now the `list_of_relabeling` should be available in the R environment and it can be used by `drugsens` to work. `list_of_relabeling` is a named list that is required for relabeling the markers name, that is often not user friendly. In case the markers naming doesn't need corrections/relabeling you can leave the `list_of_relabeling` unchanged (but one should still check it). > ðŸ“**NOTE** It is recommended having no spaces and using camelCase style for the **list of cell markers**: @@ -196,21 +194,21 @@ In case the markers naming doesn't need corrections/relabeling you can leave the We present here a few mock datasets, as example workflow. Those files can be explored from the user's R package path: ``` r -system.file("extdata/to_merge/", package = "DRUGSENS") +system.file("extdata/to_merge/", package = "drugsens") ``` ### Bind QuPath files At first the data is a bunch of separate files which are difficult to make sense of; therefore as first step let's bind them together into a single R dataframe! The example data can be bound together with this command: ``` r -bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "DRUGSENS"), files_extension_to_look_for = "csv") +bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens"), files_extension_to_look_for = "csv") ``` You will be now able to `View(bind_data)`. You should see all the image stacks from the QuPath in one dataframe. This dataframe will have all the metadata parsed from the `Image` column value for every stack (image x) (this is the first column defined in the in `columnsToInclude` within the `script_for_qupath.txt`). In this code snippets we show an example of mock data `unique(bind_data$PID)` with PIDs: `"A8759" "B36" "B37", "B38", "B39"` and tissue `"Spleen", "p.wash", "Ascites", "Eye"``. You will have all the metadata in one go and also for drug combinations! > âš ï¸ **WARNING**: As long as you keep the formatting as the above examples. The dates should also be in the format **yyy-mm-dd**. For the combinations of two drugs they should be written together with each of the different drug capilized (**C**arboplatin**P**aclitaxel) and the rest lowercased letters. -For example **CarboplatinPaclitaxel_100_uM_10_nM**. This indicates a drug combination of Carboplatin 100_uM and Paclitaxel 10_nM. Each drug amount and each unit should always be separated by `_`. The first 100_uM belongs to the Carboplatin and the 10_nM belongs to the Paclitaxel. Those constrains are due to the parsing of the strings into useful metadata. If some of the data is not present, you can use a `.` separated by `_`. If you need additional data parsing, please let us know by filing an issue on GitLab [GitLab Issue]("https://git.scicore.unibas.ch/ovca-research/DRUGSENS/issues"). +For example **CarboplatinPaclitaxel_100_uM_10_nM**. This indicates a drug combination of Carboplatin 100_uM and Paclitaxel 10_nM. Each drug amount and each unit should always be separated by `_`. The first 100_uM belongs to the Carboplatin and the 10_nM belongs to the Paclitaxel. Those constrains are due to the parsing of the strings into useful metadata. If some of the data is not present, you can use a `.` separated by `_`. If you need additional data parsing, please let us know by filing an issue on GitLab [GitLab Issue]("https://git.scicore.unibas.ch/ovca-research/drugsens/-/issues"). ### Counting the number of positiive cells for each marker in every image This function will take the previous step's generated dataframe and it will counts image by image (sum the markers of every stack) for every sample the number of marker occurrences. @@ -247,7 +245,7 @@ get_QC_plots(plotting_ready_dataframe, save_plots = TRUE, isolate_a_specific_pat ## Run with user's data -Let's run `DRUGSENS` with your data. `DRUGSENS` is not very strict about the capitalization of the file name but is very strict on the position of the parameters. This to avoid potential parsing problems. Here how the labeled data should look like in your QuPath generated file. Here below is shown a the first row from the file `A8759_drug1..conc2.csv` contained as example in `system.file("extdata/to_merge/", package = "DRUGSENS")` +Let's run `drugsens` with your data. `drugsens` is not very strict about the capitalization of the file name but is very strict on the position of the parameters. This to avoid potential parsing problems. Here how the labeled data should look like in your QuPath generated file. Here below is shown a the first row from the file `A8759_drug1..conc2.csv` contained as example in `system.file("extdata/to_merge/", package = "drugsens")` ``` A8759_p.wash_2020.11.10_DOC2001.10.05_compoundX34542_10000_uM_EpCAM_Ecad_cCasp3_(series 01).tif @@ -263,7 +261,7 @@ For example **CarboplatinPaclitaxel_100_uM_10_nM**. This indicates a drug combin ### Data Binding and Processing -These lines sets stage for `DRUGSENS` to find the directory path where the microscopy image data are located. `defined_path` is a predefined variable that should contain the base path. This makes it easier to access and manage the files during processing. It is convenient also to define the `desired_file_extensions_of_the_files`, usually `csv` is a good start. +These lines sets stage for `drugsens` to find the directory path where the microscopy image data are located. `defined_path` is a predefined variable that should contain the base path. This makes it easier to access and manage the files during processing. It is convenient also to define the `desired_file_extensions_of_the_files`, usually `csv` is a good start. ``` r defined_path <- "<USER_DEFINED_PATH>" @@ -290,7 +288,7 @@ Each file is read, and additional metadata is extracted. This will return a data - `Concentration` = The amount of the drug treatment applied (concentration), quantitatively described. - `ConcentrationUnits` = The units in which the drug concentration is measured, such as micromolar (uM) or nanomolar (nM) - `ReplicaOrNot` = Indicates whether the sample is a replica or repeat of a previous experiment -- `Name` = The standardized name of the cell markers as defined in the `config_DRUGSENS.txt` file. This ensures consistency and accuracy in identifying and referring to specific cell markers. +- `Name` = The standardized name of the cell markers as defined in the `config_drugsens.txt` file. This ensures consistency and accuracy in identifying and referring to specific cell markers. ### A first QC plot @@ -388,6 +386,6 @@ Renv will automatically activate and install the necessary packages as specified </details> ### Reporting Issues -If you encounter any bugs or have suggestions for improvements, please file an issue using our [GitLab Issue]("https://git.scicore.unibas.ch/ovca-research/DRUGSENS/issues"). Be sure to include as much information as possible to help us understand and address the issue. +If you encounter any bugs or have suggestions for improvements, please file an issue using our [GitLab Issue]("https://git.scicore.unibas.ch/ovca-research/drugsens/-/issues"). Be sure to include as much information as possible to help us understand and address the issue. Please make sure to file the issue in the GitLab repo as this one in GitHub is a forward-only mirror repo. diff --git a/cran-comments.md b/cran-comments.md index 858617d..6c9bbe3 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## R CMD check results -0 errors | 0 warnings | 1 note +0 errors | 0 warnings | 3 notes * This is a new release. diff --git a/man/change_data_format_to_longer.Rd b/man/change_data_format_to_longer.Rd index d314779..93849cb 100644 --- a/man/change_data_format_to_longer.Rd +++ b/man/change_data_format_to_longer.Rd @@ -32,7 +32,7 @@ list_of_relabeling =list( "PathCellObject" = "onlyDAPIPositve", "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")) +system.file("extdata/to_merge/", package = "drugsens")) counts_dataframe <- make_count_dataframe(bind_data) plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) diff --git a/man/data_binding.Rd b/man/data_binding.Rd index dc6401c..1f1ebcc 100644 --- a/man/data_binding.Rd +++ b/man/data_binding.Rd @@ -28,6 +28,6 @@ with that information. Finally the data is combined and combined them into one f } \examples{ bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", -package = "DRUGSENS")) +package = "drugsens")) #This will return the dataframe of all the data in the folder } diff --git a/man/make_count_dataframe.Rd b/man/make_count_dataframe.Rd index bc758d1..b118319 100644 --- a/man/make_count_dataframe.Rd +++ b/man/make_count_dataframe.Rd @@ -19,12 +19,14 @@ make_count_dataframe( } \value{ A \code{dataframe}/\code{tibble}. + +text file } \description{ 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{ -bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "DRUGSENS"), files_extension_to_look_for = "csv") +bind_data <- data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens"), files_extension_to_look_for = "csv") counts_dataframe <- make_count_dataframe(bind_data) plotting_ready_dataframe <- change_data_format_to_longer(counts_dataframe) } diff --git a/man/make_run_config.Rd b/man/make_run_config.Rd index 0ae4c04..40042ef 100644 --- a/man/make_run_config.Rd +++ b/man/make_run_config.Rd @@ -4,10 +4,12 @@ \alias{make_run_config} \title{Generates and use a config txt file} \usage{ -make_run_config(overwrite_config = FALSE) +make_run_config(overwrite_config = FALSE, forcePath = NULL) } \arguments{ -\item{overwrite_config}{Boolean, if TRUE the \code{config_DRUGSENS.txt} will be overwritten (default is FALSE)} +\item{overwrite_config}{Boolean, if TRUE the \code{config_drugsens.txt} will be overwritten (default is FALSE)} + +\item{forcePath}{String, Define a custom path for the config file} } \value{ A \code{dataframe}/\code{tibble}. diff --git a/man/string_parsing.Rd b/man/string_parsing.Rd index 1c002c6..c6d8fc1 100644 --- a/man/string_parsing.Rd +++ b/man/string_parsing.Rd @@ -17,9 +17,6 @@ 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{ - 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) - - + 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) } diff --git a/tests/testthat.R b/tests/testthat.R index e102ff6..baca212 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -7,6 +7,6 @@ # * https://testthat.r-lib.org/articles/special-files.html library(testthat) -library(DRUGSENS) +library(drugsens) -test_check("DRUGSENS") +test_check("drugsens") diff --git a/tests/testthat/test_cases.R b/tests/testthat/test_cases.R index 6a79e38..06d85a8 100644 --- a/tests/testthat/test_cases.R +++ b/tests/testthat/test_cases.R @@ -1,10 +1,10 @@ test_that("Verify that the internal file in to_merge examples in exdata are available", { - list_files_exdata <- system.file("extdata/to_merge/", package = "DRUGSENS") |> list.files() + list_files_exdata <- system.file("extdata/to_merge/", package = "drugsens") |> list.files() expect_true(length(list_files_exdata) > 3 ) }) test_that("Verify that the internal file examples in exdata merged are available", { - list_files_exdata <- system.file("extdata/merged/", package = "DRUGSENS") |> list.files() + list_files_exdata <- system.file("extdata/merged/", package = "drugsens") |> list.files() expect_true(length(list_files_exdata) >= 1 ) }) @@ -42,24 +42,24 @@ test_that("list_all_files returns correct file paths", { test_that("Check that the config.txt is made and that it can be read", { expect_silent(make_run_config()) expect_silent(make_run_config()) - expect_true(file.exists(path.expand(path = paste0(getwd(), "/config_DRUGSENS.txt")))) + expect_true(file.exists(path.expand(path = paste0(getwd(), "/config_drugsens.txt")))) expect_true(exists("list_of_relabeling")) }) test_that("Check that the example file can be read correctly", { - datas <- DRUGSENS::data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "DRUGSENS")) + datas <- drugsens::data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens")) expect_true(exists("datas")) expect_equal(ncol(datas), expected = 28) }) test_that("Check that the drugs combination have two unit and two concentration and control none", { - datas <- DRUGSENS::data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "DRUGSENS")) + datas <- drugsens::data_binding(path_to_the_projects_folder = system.file("extdata/to_merge/", package = "drugsens")) expect_true(datas[datas$Treatment == "GentamicinePaclitaxel", "Treatment_complete"][1] == "GentamicinePaclitaxel100uM-10uM" || datas[datas$Treatment == "GentamicinePaclitaxel", "Treatment_complete"][1] == "gentamicinePaclitaxel100uM-10uM") expect_true(datas[datas$Treatment == "Control", "Treatment_complete"][1] == "Control" || datas[datas$Treatment == "Control", "Treatment_complete"][1] == "control") }) test_that("Config file was there and removed correctly", { - expect_silent( file.remove(path.expand(paste0(getwd(), "/config_DRUGSENS.txt"))) ) + expect_silent( file.remove(path.expand(paste0(getwd(), "/config_drugsens.txt"))) ) }) test_that("The parsing is working", { @@ -78,7 +78,7 @@ test_that("The parsing is working", { ConcentrationUnits1 = "uM", ConcentrationUnits2 = "nm", Treatment_complete = "TreatmentRana10uM-15nm") - expect_equal(DRUGSENS:::string_parsing(input_data), expected = expected_output) + expect_equal(drugsens:::string_parsing(input_data), expected = expected_output) }) test_that("Another parsing test", { @@ -97,7 +97,7 @@ test_that("Another parsing test", { ConcentrationUnits1 = NA_character_, ConcentrationUnits2 = NA_character_, Treatment_complete = "dmso") - expect_equal(DRUGSENS:::string_parsing(input_data), expected = expected_output) + expect_equal(drugsens:::string_parsing(input_data), expected = expected_output) # Image1 <- "B516_Ascites_2023-11-25_DOC2020-12-14_CarboplatinPaclitaxel_100_uM_10_nM_Ecad_cCasp3_(series 01).tif" # Image2 <- "A8759_Spleen_2020.11.10_DOC2001.10.05_compoundX34542_1000_uM_EpCAM_Ecad_cCasp3_(series 01).tif" # Image3 <- "A8759_Spleen_2020.11.10_DOC2001.10.05_compoundX34542_1000_uM_EpCAM_Ecad_cCasp3_(series 01).tif" -- GitLab