Skip to content

Commit

Permalink
resolved merge conflicts, greatly updated README file, made final Doc…
Browse files Browse the repository at this point in the history
…kerfile for Docker image of package
  • Loading branch information
Thomas-Rauter committed Jun 11, 2024
1 parent 51533f5 commit 9ce0430
Show file tree
Hide file tree
Showing 69 changed files with 884 additions and 4,856 deletions.
12 changes: 12 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Rauter"
given-names: "Thomas"
orcid: "https://orcid.org/0000-0000-0000-0000"
title: "SplineOmics: A Tool for Time-Series Omics Data Analysis"
version: 0.1.0
doi: 10.5281/zenodo.1234567
date-released: 2024-06-11
url: "https://github.com/csbg/SplineOmics"

4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by roxygen2: do not edit by hand

export(cluster_hits)
export(create_gsea_report)
export(download_enrichr_databases)
export(explore_data)
export(extract_data)
export(limma_hyperparams_screen)
export(run_gsea)
export(run_limma_splines)
export(screen_limma_hyperparams)
importFrom(ComplexHeatmap,Heatmap)
importFrom(ComplexHeatmap,draw)
importFrom(ComplexHeatmap,ht_opt)
Expand Down
38 changes: 19 additions & 19 deletions R/run_gsea.R → R/create_gsea_report.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This function uses the function run_gsea to run
# This function uses the function create_gsea_report to run



Expand Down Expand Up @@ -29,22 +29,22 @@
#'
#' @export
#'
run_gsea <- function(levels_clustered_hits,
genes,
databases,
report_info,
params = NA,
plot_titles = NA,
background = NULL,
report_dir = here::here()) {
create_gsea_report <- function(levels_clustered_hits,
genes,
databases,
report_info,
params = NA,
plot_titles = NA,
background = NULL,
report_dir = here::here()) {

# Check report_info and report_dir
args <- lapply(as.list(match.call()[-1]), eval, parent.frame())
input_control <- InputControl$new(args)
input_control$auto_validate()

# Control the test not covered by the InputControl class
control_inputs_gsea_report(levels_clustered_hits = levels_clustered_hits,
control_inputs_create_gsea_report(levels_clustered_hits = levels_clustered_hits,
genes = genes,
databases = databases,
params = params,
Expand Down Expand Up @@ -81,8 +81,8 @@ run_gsea <- function(levels_clustered_hits,
plots_sizes = plots_sizes,
report_info = report_info,
level_headers_info = level_headers_info,
report_type = "gsea_report",
filename = "gsea_report",
report_type = "create_gsea_report",
filename = "create_gsea_report",
report_dir = report_dir)

return(plots)
Expand All @@ -108,7 +108,7 @@ run_gsea <- function(levels_clustered_hits,
#' matching `levels_clustered_hits`.
#' @param background A character vector of background genes or NULL.
#'
control_inputs_gsea_report <- function(levels_clustered_hits,
control_inputs_create_gsea_report <- function(levels_clustered_hits,
genes,
databases,
params,
Expand Down Expand Up @@ -149,13 +149,13 @@ control_inputs_gsea_report <- function(levels_clustered_hits,
#' @description
#' This function manages the GSEA analysis for a specific level. It extracts
#' genes associated with the clustered hits, removes rows with `NA` values,
#' and runs the GSEA analysis using the `run_gsea` function.
#' and runs the GSEA analysis using the `create_gsea_report` function.
#'
#' @param clustered_hits A dataframe containing the clustered hits for a
#' specific level. It must include a column named `feature` to extract genes.
#' @param level_name A character string representing the name of the level.
#'
#' @return The result of the `run_gsea` function, which typically includes
#' @return The result of the `create_gsea_report` function, which typically includes
#' various plots and enrichment results.
#'
manage_gsea_level <- function(clustered_hits,
Expand All @@ -167,7 +167,7 @@ manage_gsea_level <- function(clustered_hits,

message(paste("\n\n Running clusterProfiler for the level:", level_name))

result <- run_gsea_level(clustered_genes = clustered_hits,
result <- create_gsea_report_level(clustered_genes = clustered_hits,
databases = databases,
params = clusterProfiler_params,
plot_title = level_name)
Expand Down Expand Up @@ -246,7 +246,7 @@ process_result <- function(level_result,
#' processing individual plots. The TOC is inserted into the HTML content,
#' which is then finalized and written to the specified output file.
#'
build_gsea_report <- function(header_section,
build_create_gsea_report <- function(header_section,
plots,
plots_sizes,
level_headers_info,
Expand Down Expand Up @@ -541,7 +541,7 @@ check_params <- function(params) {
#'
#' @importFrom clusterProfiler enricher
#'
run_gsea_level <- function(clustered_genes,
create_gsea_report_level <- function(clustered_genes,
databases,
params = NA,
plot_title = "",
Expand Down Expand Up @@ -726,7 +726,7 @@ generate_section_content <- function(section_info,
base64_df <- sprintf('<a href="%s" download="count2small_results.xlsx">
<button>Download count2small_results.xlsx</button></a>',
encode_df_to_base64(section_info$raw_enrich_results,
"gsea_report"))
"create_gsea_report"))

html_content <- paste(html_content,
section_header,
Expand Down
18 changes: 9 additions & 9 deletions R/limma_report.R → R/create_limma_report.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# The function limma_report() takes the top_tables of the three different
# The function create_limma_report() takes the top_tables of the three different
# categories (within level time diff, between level average diff, and
# between level average and time diff) and makes histogram and vulcano plots
# and places them into a nice HTML report.



# Exported function: limma_report() --------------------------------------------
# Exported function: create_limma_report() --------------------------------------------


limma_report <- function(run_limma_splines_result,
report_info,
adj_pthresh = 0.05,
report_dir = here::here()) {
create_limma_report <- function(run_limma_splines_result,
report_info,
adj_pthresh = 0.05,
report_dir = here::here()) {

# Control the function arguments
args <- lapply(as.list(match.call()[-1]), eval, parent.frame())
Expand Down Expand Up @@ -120,8 +120,8 @@ limma_report <- function(run_limma_splines_result,
report_info,
data = all_top_tables,
level_headers_info = section_headers_info,
report_type = "limma_report",
filename = "limma_report",
report_type = "create_limma_report",
filename = "create_limma_report",
report_dir = report_dir)

return(plots)
Expand Down Expand Up @@ -268,7 +268,7 @@ shorten_names <- function(name,
#' @seealso
#' \code{\link{plot2base64}}, \code{\link{create_progress_bar}}
#'
build_limma_report <- function(header_section,
build_create_limma_report <- function(header_section,
plots,
plots_sizes,
level_headers_info,
Expand Down
12 changes: 6 additions & 6 deletions R/limma_hyperparams_screen.R → R/screen_limma_hyperparams.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' limma_hyperparams_screen.R contains the exported package function
#' limma_hyperparams_screen and all the functions that make up the
#' functionality of limma_hyperparams_screen. limma_hyperparams_screen runs the
#' screen_limma_hyperparams.R contains the exported package function
#' screen_limma_hyperparams and all the functions that make up the
#' functionality of screen_limma_hyperparams. screen_limma_hyperparams runs the
#' other package function, run_limma_splines, for a time series omics dataset,
#' for different hyperparameters. Such are for example degree of freedom of the
#' spline, type of spline, limma design formula, and different versions of the
Expand All @@ -9,7 +9,7 @@
#' and structured manner. Therefore, this function streamlines that process.


# Exported function: limma_hyperparams_screen() --------------------------------
# Exported function: screen_limma_hyperparams() --------------------------------


#' Limma Hyperparameters Screening
Expand Down Expand Up @@ -49,7 +49,7 @@
#'
#' @export
#'
limma_hyperparams_screen <- function(datas,
screen_limma_hyperparams <- function(datas,
datas_descr,
metas,
designs,
Expand Down Expand Up @@ -1016,7 +1016,7 @@ process_combo_pair <- function(combo_pair,
generate_report_html(plots = plots,
plots_sizes = plots_len,
report_info = report_info,
report_type = "limma_hyperparams_screen",
report_type = "screen_limma_hyperparams",
filename = combo_pair_name,
timestamp = timestamp,
report_dir = report_dir, )
Expand Down
28 changes: 14 additions & 14 deletions R/utils_report_generation.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @param meta A dataframe, containing metadata that should
#' be directly embedded in the HTML report for downloading.
#' @param report_type A character string specifying the report type
#' ('limma_hyperparams_screen' or 'cluster_hits').
#' ('screen_limma_hyperparams' or 'cluster_hits').
#' @param mode A character string specifying the mode
#' ('isolated' or 'integrated').
#' @param filename A character string specifying the filename for the report.
Expand Down Expand Up @@ -60,18 +60,18 @@ generate_report_html <- function(plots,
} else {
title <- "explore batch-corrected data"
}
} else if (report_type == "limma_hyperparams_screen") {
} else if (report_type == "screen_limma_hyperparams") {
title <- paste("hyperparams screen |", filename)
} else if (report_type == "limma_report") {
} else if (report_type == "create_limma_report") {
title <- "limma report"
} else if (report_type == "cluster_hits") {
title <- "clustered hits | within level"
} else if (report_type == "gsea_report") {
} else if (report_type == "create_gsea_report") {
title <- "gsea"

} else {
stop(paste("report_type must be explore_hits, limma_hyperparams_screen,",
"limma_report, or cluster_hits"),
stop(paste("report_type must be explore_hits, screen_limma_hyperparams,",
"create_limma_report, or cluster_hits"),
call. = FALSE)
}

Expand Down Expand Up @@ -103,7 +103,7 @@ generate_report_html <- function(plots,

if (field == "data" && !any(is.na(data))) {

if (report_type == "limma_report") {
if (report_type == "create_limma_report") {
base64_df <- sprintf('<a href="%s" download="top_tables.xlsx">
<button>Download top_tables.xlsx</button></a>',
encode_df_to_base64(data))
Expand Down Expand Up @@ -138,7 +138,7 @@ generate_report_html <- function(plots,
# Close the table
header_section <- paste(header_section, "</table>", sep = "\n")

if (report_type == "gsea_report") {
if (report_type == "create_gsea_report") {
databases_text <- paste(report_info$databases, collapse = ", ")
header_section <- paste(header_section,
"<p style='font-size: 20px;'>Databases used: ",
Expand All @@ -161,24 +161,24 @@ generate_report_html <- function(plots,
plots_sizes = plots_sizes,
output_file_path = output_file_path)

} else if (report_type == "limma_hyperparams_screen") {
} else if (report_type == "screen_limma_hyperparams") {

build_hyperparams_screen_report(header_section = header_section,
plots = plots,
plots_sizes = plots_sizes,
output_file_path = output_file_path)

} else if (report_type == "limma_report") {
} else if (report_type == "create_limma_report") {

build_limma_report(header_section = header_section,
build_create_limma_report(header_section = header_section,
plots = plots,
plots_sizes = plots_sizes,
level_headers_info = level_headers_info,
output_file_path = output_file_path)

} else if (report_type == "gsea_report") {
} else if (report_type == "create_gsea_report") {

build_gsea_report(header_section = header_section,
build_create_gsea_report(header_section = header_section,
plots = plots,
plots_sizes = plots_sizes,
level_headers_info = level_headers_info,
Expand Down Expand Up @@ -306,7 +306,7 @@ encode_df_to_base64 <- function(df,
# Convert list of dataframes to Excel with multiple sheets

if (!is.na(report_type)) {
if (report_type == "gsea_report") {
if (report_type == "create_gsea_report") {
all_names <- names(df)
sheet_names <- sapply(all_names, extract_and_combine)
}
Expand Down
Loading

0 comments on commit 9ce0430

Please sign in to comment.