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

Add more unit testing, fix typos

parent b242240a
No related branches found
No related tags found
No related merge requests found
Package: DRUGSENS
Title: Get Data From QuPath For Data Analysis
Title: DRUGSENS is a R-package that allows users to automatically analyze QuPath™'s output data from imaging analysis.
In addition, it will automatically extract metadata from the QuPath's data.
Version: 0.1.0
BugReports: https://git.scicore.unibas.ch/ovca-research/DRUGSENS/issues
Authors@R: c(
......@@ -9,7 +10,7 @@ Authors@R: c(
person("University of Basel and University Hospital Basel", role = c("cph"))
)
URL: https://git.scicore.unibas.ch/ovca-research/DRUGSENS/
Maintainer: Flavio C. Lombardo <flavio.lombardo@unibas.cht>
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
......
......@@ -39,28 +39,68 @@ test_that("list_all_files returns correct file paths", {
})
test_that("Check that the config.txt is made and can be read", {
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(exists("list_of_relabeling"))
})
# WIP add for the regex in processing the data
# test_that("Check that parsig does work", {
#
# 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"
# Image4 <- "B38_Eye_2023.11.10_DOC2023.10.05_GentamicinePaclitaxel_100_uM_10_nM_EpCAM_Ecad_cCasp3_(series 01).tif"
#
# # make a dataframe of those images examples
# dt <- data.frame(
# Image = c(Image1, Image2, Image3, Image4),
# Example = c("Protocol", "Fake", "Fake", "Fake")
# )
#
# # run parser
# dt1 <- DRUGSENS:::string_parsing(dt)
#
# 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"))
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"))
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"))) )
})
test_that("The parsing is working", {
input_data <- data.frame(Image = "PID1_Tissue1_2024-02-13_DOC2024.02.13_TreatmentRana_10_uM_15_nm_Replica_(series.10)")
expected_output <- data.frame(
Image = "PID1_Tissue1_2024-02-13_DOC2024.02.13_TreatmentRana_10_uM_15_nm_Replica_(series.10)",
Image_number = "series.10",
PID = "PID1",
Tissue = "Tissue1",
Date1 = "2024-02-13",
DOC = "2024.02.13",
ReplicaOrNot = "Replica",
Treatment = "TreatmentRana",
Concentration1 = "10",
Concentration2 = "15",
ConcentrationUnits1 = "uM",
ConcentrationUnits2 = "nm",
Treatment_complete = "TreatmentRana10uM-15nm")
expect_equal(DRUGSENS:::string_parsing(input_data), expected = expected_output)
})
test_that("Another parsing test", {
input_data <- data.frame(Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif")
expected_output <- data.frame(
Image = "B516_Ascites_2023-11-25_DOC2020-12-14_dmso_rep_Ecad_cCasp3_(series 01).tif",
Image_number = "series 01",
PID = "B516",
Tissue = "Ascites",
Date1 = "2023-11-25",
DOC = "2020-12-14",
ReplicaOrNot = "Replica",
Treatment = "dmso",
Concentration1 = NA_character_, #WIP
Concentration2 = NA_integer_,
ConcentrationUnits1 = NA_character_,
ConcentrationUnits2 = NA_character_,
Treatment_complete = "dmso")
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"
# Image4 <- "B38_Eye_2023.11.10_DOC2023.10.05_GentamicinePaclitaxel_100_uM_10_nM_EpCAM_Ecad_cCasp3_(series 01).tif"
})
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