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

Init DRUGSENS

parents
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/change_data_format_to_longer.R
\name{change_data_format_to_longer}
\alias{change_data_format_to_longer}
\title{Reformat the counts data in longer format}
\usage{
change_data_format_to_longer(
.data,
pattern_column_markers = "_ratio_of_total_cells",
unique_name_row_identifier = "filter_image",
additional_columns = TRUE
)
}
\arguments{
\item{.data}{The markers count dataframe that is coming from the processing of the microscopy data}
\item{pattern_column_markers}{The markers' pattern name to obtain the column with ratios of the markers (it defaults to "_ratio_of_total_cells")}
\item{unique_name_row_identifier}{String that indicates the unique identifier for each image, defaults as "filter_image"}
\item{additional_columns}{columns that can be additionally added to the longer formatted data.frame, "Defaults as c("Treatment", "PID", "Image_number", "Tissue", "Concentration", "DOC")"}
}
\value{
A \code{dataframe}/\code{tibble}.
}
\description{
This function gets the count data data.frame, that has a wider format and it returns a longer-formatted data.frame
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_binding.R
\name{data_binding}
\alias{data_binding}
\title{Merge all the dataframes coming out from the QuPath}
\usage{
data_binding(
path_to_the_projects_folder,
files_extension_to_look_for,
recursive_search = FALSE
)
}
\arguments{
\item{path_to_the_projects_folder}{The path where the files coming out of QuPath are located}
\item{files_extension_to_look_for}{The extension of the file outputted from QuPath}
\item{recursive_search}{Boolean, it defined the behavior of the file search, if recursive or not, (default is FALSE)}
}
\value{
A \code{dataframe}/\code{tibble}.
}
\description{
This function try to guess the string patterns that are in the dataset and then fill the dataframe
with that information. Finally the data is combined and combined them into one file
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate_qu_path_script.R
\name{generate_qupath_script}
\alias{generate_qupath_script}
\title{Generate the groovy script used for the analysis}
\usage{
generate_qupath_script()
}
\value{
\verb{script_for_qupath.txt in local dir}.
}
\description{
Generate a useful script to consistently save the output data from QuPath in .csv format following the naming conventions
followed during the package development.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_QC_plots.R
\name{get_QC_plots}
\alias{get_QC_plots}
\title{Plot some QC plots to define that everything ran correctly}
\usage{
get_QC_plots(
.data,
patient_column_name = "PID",
colors = c("darkgreen", "red", "orange", "pink"),
save_plots = FALSE,
folder_name = "figures",
x_plot_var = "Treatment_complete",
isolate_a_specific_patient = NULL
)
}
\arguments{
\item{.data}{The preprocessed data (after running make_count_dataframe() and change_data_format_to_longer()) merged data.frame that should be visualized}
\item{patient_column_name}{The PID's column name in the merged data.frame (defaults to "PID")}
\item{colors}{A list of colors to supply to personalize the plot, as default 4 colors c("dark green", "red", "orange", "pink")}
\item{save_plots}{A Boolean value indicating if the plots should be saved or not, TRUE for saving in the current working directory, FALSE to not. Default is FALSE}
\item{folder_name}{A string indicating the name of the folder where to save the plots in case that save_plots = TRUE}
\item{x_plot_var}{A string indicating the treatment's full name for the QC plots (default is "Treatment_complete")}
\item{isolate_a_specific_patient}{A string indicating the patient name to isolate for single plot case (default is NULL)}
}
\value{
A \code{dataframe}/\code{tibble}.
}
\description{
Plot data to visualize immediate trends
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_count_dataframe.R
\name{make_count_dataframe}
\alias{make_count_dataframe}
\title{Count the main marker expression}
\usage{
make_count_dataframe(
.data,
unique_name_row_identifier = "filter_image",
name_of_the_markers_column = "Name"
)
}
\arguments{
\item{.data}{The dataframe that is coming from the processing of the microscopy data}
\item{unique_name_row_identifier}{The name of the column of the .data where the unique name can be used to counts (it defaults to "filter_image")}
\item{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"}
}
\value{
A \code{dataframe}/\code{tibble}.
}
\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
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_run_config.R
\name{make_run_config}
\alias{make_run_config}
\title{Generates and use a config txt file}
\usage{
make_run_config()
}
\value{
A \code{dataframe}/\code{tibble}.
}
\description{
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.
}
This diff is collapsed.
library/
local/
cellar/
lock/
python/
sandbox/
staging/
This diff is collapsed.
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html
library(testthat)
library(DRUGSENS)
test_check("DRUGSENS")
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()
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()
expect_true(length(list_files_exdata) >= 1 )
})
test_that("list_all_files returns correct file paths", {
# Setup: Create temporary files and directory
temp_dir <- tempdir()
file.create(file.path(temp_dir, "file1.csv"))
file.create(file.path(temp_dir, "file2.csv"))
file.create(file.path(temp_dir, "file3.txt"))
file.create(file.path(temp_dir, "file4.tsv"))
# Test 1
files_list <- list_all_files(define_path = temp_dir, extension = "\\.csv$",
recursive_search = T)
expect_length(files_list, 2)
expect_true(all(grepl("file1.csv|file2.csv", files_list)))
# Test 2
files_list <- list_all_files(define_path = temp_dir, extension = "\\.txt$",
recursive_search = T)
expect_length(files_list, 1)
expect_true(all(grepl("file3.txt", files_list)))
# Test 3
files_list <- list_all_files(define_path = temp_dir, extension = "\\.tsv$",
recursive_search = T)
expect_length(files_list, 1)
expect_true(all(grepl("file4.tsv", files_list)))
# remove the dir
unlink(temp_dir, recursive = TRUE)
})
test_that("Check that the config.txt is made and can be read", {
expect_silent(make_run_config())
expect_silent(make_run_config())
expect_true(exists("list_of_relabeling"))
})
# WIP add for the regex in preprocessing
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment