From 039a55bfdc44e93464606bab9967f22f95b1fb51 Mon Sep 17 00:00:00 2001 From: Luis Herfurth Date: Sun, 12 Nov 2023 11:23:24 +0100 Subject: [PATCH 1/3] unnecessary hopefully --- inst/extdata/metalyzer_colors.RDS | Bin 180 -> 217 bytes inst/extdata/updated_metalyzer_colors.RDS | Bin 217 -> 0 bytes inst/python/draw_network.py | 115 ---------------------- vignettes/MetAlyzer_User_Guide.Rmd | 75 ++++++-------- 4 files changed, 28 insertions(+), 162 deletions(-) delete mode 100644 inst/extdata/updated_metalyzer_colors.RDS delete mode 100644 inst/python/draw_network.py diff --git a/inst/extdata/metalyzer_colors.RDS b/inst/extdata/metalyzer_colors.RDS index a7a53f4e7b4d242b583c2b64a865f0177fa76c74..79accaa307b6a1b055f73b511478cd7a53743fe6 100644 GIT binary patch literal 217 zcmV;~04Dz*iwFP!0000017(j*4#FT1g)y};b>$IET$@abQn&yo(8TTh!2ORPXfjZR z5cu9ahR5q@j2X;+*qLE0M>9Sj@#@RrRMy$-%~bZo1s$hk73aKqx+&%|LQtedvPVU0 z5f*M{3fP&GopJ7}LfPf6^O^w^8B1@c=+H`N4|x&G>n0Vo%#;WPyBHqUrQHRZ#r837 zu2soOaxHUamULH?P-io9X(lZ*C*pgTDv5q@y2J=&cu)bLN*kd{oe<-XqvFOc@QQnkyf#S9RV<| z>|v@ngcTNChOUq$8zyIqu_I%fojN82ss2$B0nUF`0RRBvn^M*Q diff --git a/inst/extdata/updated_metalyzer_colors.RDS b/inst/extdata/updated_metalyzer_colors.RDS deleted file mode 100644 index 79accaa307b6a1b055f73b511478cd7a53743fe6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 217 zcmV;~04Dz*iwFP!0000017(j*4#FT1g)y};b>$IET$@abQn&yo(8TTh!2ORPXfjZR z5cu9ahR5q@j2X;+*qLE0M>9Sj@#@RrRMy$-%~bZo1s$hk73aKqx+&%|LQtedvPVU0 z5f*M{3fP&GopJ7}LfPf6^O^w^8B1@c=+H`N4|x&G>n0Vo%#;WPyBHqUrQHRZ#r837 zu2soOaxHUamULH?P-io9X(lZ*C*pgTDv5q@y2J=&cu)bLN*kd{oe<-XqvFO 3', '1.5 < FC < 3', '0.5 < FC < 1.5', '-1.5 < FC < -0.5','-3 < FC < -1.5','FC < -3', 'No fold change'] - - leg_position = {'FC > 3': (2100, 1500),'1.5 < FC < 3': (2100, 1400),'0.5 < FC < 1.5': (2100, 1300), - '-1.5 < FC < -0.5': (2100, 1100),'-3 < FC < -1.5': (2100, 1000),'FC < -3': (2100, 900), - 'No fold change': (2100, 1200)} - - leg_color = ['#FF0000', '#FF6666', '#FF9999', '#00CCCC', '#3399FF', '#0066CC', '#A0A0A0'] - - nx.draw_networkx_nodes(G, pos = leg_position, ax=ax_network, nodelist=leg_nodes, - node_size=node_size, node_shape='o', - node_color=leg_color) - nx.draw_networkx_labels(G, pos = leg_position, labels={n: n for n in leg_nodes},font_size=15, font_color='k', font_family='sans-serif', font_weight='bold') - - - - # draw network edges - for rad in edge_df['Rad'].unique(): - rad_spec_edges = edges_list[edge_df['Rad'].values == rad] - nx.draw_networkx_edges(G, nx.get_node_attributes(G, 'pos'), ax=ax_network, edgelist=rad_spec_edges, - edge_color=edge_color, arrowstyle='-', connectionstyle=f'arc3,rad={rad}') - - # draw network node labels - nx.draw_networkx_labels(G, nx.get_node_attributes(G, 'pos'), ax=ax_network, - labels={label: re.sub('#[0-9]+$', '', label) for - label, pos in nx.get_node_attributes(G, 'pos').items() - if label in nodes_df['Label'].values}, - font_size=font_size, font_color=font_color, font_weight='bold') - - # draw network annotations - nx.draw_networkx_labels(G, nx.get_node_attributes(G, 'pos'), ax=ax_network, - labels={label: label for label, pos in nx.get_node_attributes(G, 'pos').items() - if label in annotation_df['Annotation'].values}, - font_size=ann_font_size, font_color=ann_font_color) - - fig.tight_layout() - - # save figure - fig.savefig(output) diff --git a/vignettes/MetAlyzer_User_Guide.Rmd b/vignettes/MetAlyzer_User_Guide.Rmd index 7a50acf..95fd7b8 100755 --- a/vignettes/MetAlyzer_User_Guide.Rmd +++ b/vignettes/MetAlyzer_User_Guide.Rmd @@ -22,11 +22,16 @@ The package provides methods to read output files from the MetIDQ™ software in ## Install There is a version available on CRAN. - ``` {r} install.packages("MetAlyzer") ``` +But for the latest Version you can also install directly from the github repository. +``` {r} +library(devtools) +install_github("nilsmechtel/MetAlyzer") +``` + ## Overview ![](%60r%20rprojroot::is_r_package$find_file('vignettes/MetAlyzer_workflow.png')%60){width="100%"} @@ -44,6 +49,7 @@ Set data paths to the example data and a meta data file: ```{r set_data_path} fpath <- system.file("extdata", "extraction_data.xlsx", package = "MetAlyzer") +test_big <- "/Users/luisherfurth/Downloads/Test_xl_data_pmol_per_mio.xlsx" mpath <- system.file("extdata", "example_meta_data.rds", package = "MetAlyzer") ``` @@ -155,32 +161,6 @@ cat("Number of zero values after imputation:", sum(metadata(MetAlyzer_proj)$aggregated_data$imputed_Conc == 0, na.rm = TRUE), "\n") ``` -**<--! #THIS WILL ONLY WORK IF WE INCLUDE METHOD AND TISSUE INTO THE AGGREGATED DATA -->** -For example, we can filter for glutamic acid (Glu) and plot the concentration. - -```{r, glu_plot, fig.width=7, fig.height=4.5} -glu_df <- filter(metadata(MetAlyzer_proj)$aggregated_data, Metabolite == "Glu") - -ggplot(glu_df, aes(Method, Concentration, color = Status)) + - geom_point() + - scale_color_manual(values = c("Valid" = "#00CD66", - "LOQ" = "#87CEEB", - "LOD" = "#6A5ACD")) + - ylab("Concentration [pmol/mg Tissue]") + - facet_grid(~ Tissue) -``` - -To plot imputed and transformed data, we choose the column "log2_Conc": - -```{r, glu_plot_transformed, fig.width=7, fig.height=4.5} -ggplot(glu_df, aes(Method, log2_Conc, color = Status)) + - geom_point() + - scale_color_manual(values = c("Valid" = "#00CD66", - "LOQ" = "#87CEEB", - "LOD" = "#6A5ACD")) + - facet_grid(~ Tissue) -``` - This is just for visualisation, the imputation and transformation is also included into the function *calculate_log2FC*. Next we can calculate the log2 Fold Change between the extraction methods for each metabolite. As the are 6 extraction methods, the function only calculates for the first 2 Methods. We can use the perviously mentioned function *filterMetaData* to specify the groups. @@ -190,7 +170,7 @@ MetAlyzer_proj <- filterMetaData(MetAlyzer_proj, Method %in% 3:6) log2FC_df <- calculate_log2FC(MetAlyzer_proj, Method, perc_of_min = 0.2, impute_NA = TRUE) ``` -Here we can see the functions calculates between the third and fourth method and drops the method 5 & 6. +Here we can see the functions calculates between the third and fourth method after filtering out the first and second method and dropping the methods 5 & 6. This can be visualized with a volcano plot: @@ -213,26 +193,27 @@ network <- plot_network(log2FC_df) network ``` - - - - - +Incase you want to analyze a dataset from the MxP®Quant 500 XL kit, nothing changes regarding the use of the package. The only difference is the visualized output as there are more metabolites included with this kit. - - - - +```{r} +Metalyzer_big_data <- MetAlyzer_dataset(file_path = test_big) +Metalyzer_big_data <- renameMetaData(Metalyzer_big_data, Method = 'Sample Description') - - - +log2FC_df_big <- calculate_log2FC(Metalyzer_big_data, Method, perc_of_min = 0.2, impute_NA = TRUE) +``` +These visualisations will look like this: +```{r plot_log2FCt, fig.width=7, fig.height=4.5} +p_vulcano_big <- plot_log2FC(log2FC_df_big, hide_labels_for = rownames(rowData(MetAlyzer_proj)), vulcano=TRUE) +p_vulcano_big +``` +```{r plot_log2FC, fig.width=7, fig.height=4.5} +p_fc_big <- plot_log2FC(log2FC_df_big, hide_labels_for = rownames(rowData(MetAlyzer_proj)), vulcano=FALSE) +p_fc_big +``` - +## THIS WILL BE PATCHED IN SOON +```{r plot_network, fig.width=7, fig.height=4.5} +network_big <- plot_network(log2FC_df_big) +network_big +``` - - - - - - From c611cf0940475d9896b9690b374c4413f0bda91b Mon Sep 17 00:00:00 2001 From: Luis Herfurth Date: Sun, 12 Nov 2023 12:02:46 +0100 Subject: [PATCH 2/3] Description + R CMD Check --- .Rbuildignore | 4 +- DESCRIPTION | 10 +- R/draw_FC_network.R | 311 -------------------------------------------- R/plot_log2FC.R | 8 +- R/plot_network.R | 24 +++- 5 files changed, 32 insertions(+), 325 deletions(-) delete mode 100644 R/draw_FC_network.R diff --git a/.Rbuildignore b/.Rbuildignore index 63f2ba8..b2c097c 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,10 +14,8 @@ ^R/do_anova_2w\.R$ ^R/filter_groupwise\.R$ ^R/perform_ANOVA\.R$ - -^R/draw_FC_network\.R$ +^R/two_way_anova\.R$ ^R/plot_2w_anvova\.R$ -^R/plot_network\.R$ ^tests$ diff --git a/DESCRIPTION b/DESCRIPTION index 0416866..8f0049b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,7 +14,11 @@ Authors@R: person("Daniel", "Huebschmann", email = "d.huebschmann@dkfz-heidelberg.de", role = c("aut"), - comment = c(ORCID = "0000-0002-6041-7049"))) + comment = c(ORCID = "0000-0002-6041-7049")), + person("Luis", "Herfurth", + email = "luis.herfurth@stud.uni-heidelberg.de", + role = c("aut"), + comment = c(ORCID = "0009-0000-9933-3056"))) Depends: R (>= 4.0.0) Imports: @@ -30,7 +34,9 @@ Imports: rlang, grDevices, SummarizedExperiment, - S4Vectors + S4Vectors, + BiocManager, + qvalue Description: The 'MetAlyzer' S4 object provides methods to read and reformat metabolomics data for convenient data handling, statistics and downstream analysis. The resulting format corresponds to input data of the Shiny app 'MetaboExtract' (). License: GPL-3 Encoding: UTF-8 diff --git a/R/draw_FC_network.R b/R/draw_FC_network.R deleted file mode 100644 index 59bc31b..0000000 --- a/R/draw_FC_network.R +++ /dev/null @@ -1,311 +0,0 @@ -#' Draw metabolic pathway -#' -#' This function ... -#' -#' @param log2FC_df log2FC_df -#' @param output output -#' @param q_value q_value -#' @param pathway_file pathway_file -#' @param figsize figsize -#' @param colbar_width colbar_width -#' @param bg_color bg_color -#' @param node_size node_size -#' @param font_size font_size -#' @param font_color font_color -#' @param edge_color edge_color -#' @param ann_font_size ann_font_size -#' @param ann_font_color ann_font_color -#' @param colors colors -#' @param path_to_conda path_to_conda -#' -#' @import dplyr -#' @importFrom utils install.packages -#' @importFrom utils installed.packages -#' @importFrom stringr str_trim -#' @importFrom rlang .data -#' @export -#' -#' @examples -#' \dontrun{ -#' print(1) -#' } - -# log2FC_df <- readRDS("../change_test_df.RDS") %>% -# filter(Tissue == "Zebrafish Liver") -# output <- "../pathway.png" -# pathway_file=fpath <- "inst/extdata/pathway.xlsx" -# -# draw_network(log2FC_df, output, pathway_file=pathway_file) - -draw_FC_network <- function( - log2FC_df, - output, - q_value=0.05, - figsize=c(40, 36), - dpi=300, - bg_color="#FFFFFF", # white - na_color="#D3DDDC", # lightgrey - node_size=500, - font_size=15, - font_color="#000000", # black - edge_color="#757575", # grey - ann_font_size=25, - ann_font_color="#046C9A", # blue - font_family="sans-serif", - pathway_file=system.file("extdata", "pathway.xlsx", package = "MetAlyzer"), - path_to_conda=NULL) { - - ## Check for reticulate installation - installed_packages <- utils::installed.packages()[, "Package"] - if (! "reticulate" %in% installed_packages) { - cat('Installing package "reticulate":\n') - utils::install.packages("reticulate") - cat("\n") - } - - cat("Configuring Python... ") - ## Check for conda environment - if (!is.null(path_to_conda)) { - options(reticulate.conda_binary = path_to_conda) - } - envs <- tryCatch(reticulate::conda_list(), - error = function(e) { - cat("\nNo installation of conda could be found.", - paste0("Installing miniconda to ", - reticulate::miniconda_path()), "\n") - reticulate::install_miniconda( - path = reticulate::miniconda_path(), - update = TRUE, - force = FALSE - ) - }, - finally = reticulate::conda_list() - ) - if (!"MetAlyzer_networkx_env" %in% envs$name) { - reticulate::conda_create( - envname = "MetAlyzer_networkx_env", - packages = c("networkx", "matplotlib", "pandas", "openpyxl", "regex") - ) - envs <- reticulate::conda_list() - } - - ## Initialize Python - python_dir <- envs$python[envs$name == "MetAlyzer_networkx_env"] - tryCatch( - reticulate::use_python(python_dir), - error = function(e) { - # cat("\nPython version has already been initialized.\n") - "" - } - ) - - ## Source python script for network visualization - reticulate::source_python(system.file("python", "draw_network.py", - package = "MetAlyzer")) - cat("finished!\n") - - ## Read pathway file - nodes_df <- openxlsx::read.xlsx(pathway_file, sheet="Nodes") %>% - select(.data$Label, - .data$x, - .data$y, - .data$Shape, - .data$Metabolites) - nodes_df$Label <- stringr::str_trim(nodes_df$Label) - - edge_df <- openxlsx::read.xlsx(pathway_file, sheet="Edges") %>% - select(.data$Node1, - .data$Node2, - .data$Rad) - edge_df$Node1 <- stringr::str_trim(edge_df$Node1) - edge_df$Node2 <- stringr::str_trim(edge_df$Node2) - - annotation_df <- openxlsx::read.xlsx(pathway_file, sheet="Annotations") %>% - select(.data$Annotation, - .data$x, - .data$y) - annotation_df$Annotation <- stringr::str_trim(annotation_df$Annotation) - - ## Remove invalid nodes, edges or annotations (= NA) - invalid_nodes <- which(rowSums(is.na(nodes_df[,1:4])) > 0) - n_invalid_nodes <- length(invalid_nodes) - - invalid_edges <- which(rowSums(is.na(edge_df)) > 0) - n_invalid_edges <- length(invalid_edges) - - invalid_annotation <- which(rowSums(is.na(annotation_df)) > 0) - n_invalid_annotation <- length(invalid_annotation) - - if (n_invalid_nodes > 0) { - cat("Dropping invalid nodes (", n_invalid_nodes, "):\n - ", - paste(nodes_df$Label[invalid_nodes], collapse = "\n - "), "\n", - sep = "") - nodes_df <- nodes_df[-invalid_nodes,] - } - if (n_invalid_edges) { - cat("Dropping invalid edges (", n_invalid_edges, "):\n - ", - paste(sapply(invalid_edges, function(i) { - paste(edge_df[i, 1:2], collapse = " <-> ") - }), collapse = "\n - "), "\n", sep = "") - edge_df <- edge_df[-invalid_edges,] - } - if (n_invalid_annotation) { - cat("Dropping invalid annotations (", n_invalid_annotation, "):\n - ", - paste(annotation_df$Annotation[invalid_annotation], collapse = "\n - "), - "\n", sep = "") - annotation_df <- annotation_df[-invalid_annotation,] - } - - ## Print nodes with no assigned metabolite - not_assigned_nodes <- which(is.na(nodes_df$Metabolites)) - n_not_assigned_nodes <- length(not_assigned_nodes) - - if (n_not_assigned_nodes > 0) { - cat("Nodes which are not assigned to any metabolite (", n_not_assigned_nodes, "):\n - ", - paste(nodes_df$Label[not_assigned_nodes], collapse = "\n - "), "\n", - sep = "") - } - - ## Remove not assignable edges - mismatched_edges <- which(sapply(1:nrow(edge_df), function(i) { - any(!edge_df$Node1[i] %in% nodes_df$Label, - !edge_df$Node2[i] %in% nodes_df$Label) - })) - n_mismatched_edges <- length(mismatched_edges) - - if (n_mismatched_edges > 0) { - cat("Edges with at least one missing node (", n_mismatched_edges, "):\n - ", - paste(sapply(mismatched_edges, function(i) { - paste(edge_df[i, 1:2], collapse = " <-> ") - }), collapse = "\n - "), "\n", sep = "") - edge_df <- edge_df[-mismatched_edges,] - } - - ## Print metabolites that could not been found in input data - network_metabos <- nodes_df$Metabolites[!is.na(nodes_df$Metabolites)] - network_metabos <- stringr::str_trim(unlist(strsplit(network_metabos, ";"))) - network_metabos <- unique(network_metabos) - unfound_metabos <- which(!network_metabos %in% levels(log2FC_df$Metabolite)) - n_unfound_metabos <- length(unfound_metabos) - - if (n_unfound_metabos > 0) { - cat("Metabolites which could not be found in input (Metabolite levels) (", - n_unfound_metabos, "):\n - ", - paste(network_metabos[unfound_metabos], collapse = "\n - "), "\n", - sep = "") - } - - ## Print un-mapped metabolites - unmapped_metabos <- which(!levels(log2FC_df$Metabolite) %in% network_metabos) - n_unmapped_metabos <- length(unmapped_metabos) - - if (n_unmapped_metabos > 0) { - cat("Metabolites which are not included in the network (", - n_unmapped_metabos, "):\n - ", - paste(levels(log2FC_df$Metabolite)[unmapped_metabos], - collapse = "\n - "), "\n", sep = "") - } - - ## Add log2FC to nodes_df - signif_df <- filter(log2FC_df, - !is.na(.data$log2FC), - !is.na(.data$qval), - .data$qval <= q_value) - - nodes_df$log2FC <- sapply(strsplit(nodes_df$Metabolites, ";"), function(m_vec) { - if (length(m_vec) > 1) { - # Nodes with more than 1 metabolite assigned - tmp_df <- filter(signif_df, .data$Metabolite %in% m_vec) - if (nrow(tmp_df) > 0) { - # At least one of the metabolites is significantly change - # -> take the mean log2 fold change - l2fc <- sum(tmp_df$log2FC) / length(m_vec) - } else { - if (any(tmp_df$Metabolite %in% levels(log2FC_df$Metabolite))) { - # At least one metabolite was measured but none are significantly changed - l2fc <- 0 - } else { - # None of the metabolites were measured - l2fc <- NA - } - } - } else { - # Nodes with 0 or 1 metabolite assigned - if (m_vec %in% signif_df$Metabolite) { - # Metabolite is significantly changed - l2fc <- signif_df$log2FC[which(signif_df$Metabolite == m_vec)] - } else if (m_vec %in% levels(log2FC_df$Metabolite)) { - # Metabolite was measured but is not significantly changed - l2fc <- 0 - } else { - # Metabolite was not measured - l2fc <- NA - } - } - return(l2fc) - }) - - ## Add node color based on log2FC - colors <- list( - "3 ≤ FC "= "#FF0000", - "1.5 ≤ FC < 3 "= "#FF6666", - "0.5 ≤ FC < 1.5"= "#FF9999", - "No fold change"= "#A0A0A0", - "Not measured"= na_color, - "-1.5 < FC ≤ -0.5"= "#00CCCC", - " -3 < FC ≤ -1.5"= "#3399FF", - " FC ≤ -3"= "#0066CC" - ) - - nodes_df$Color <- "" - nodes_df$Color[is.na(nodes_df$log2FC)] <- colors["Not measured"] - nodes_df$Color[nodes_df$log2FC >= 3] <- colors["3 ≤ FC "] - nodes_df$Color[nodes_df$log2FC < 3] <- colors["1.5 ≤ FC < 3 "] - nodes_df$Color[nodes_df$log2FC < 1.5] <- colors["0.5 ≤ FC < 1.5"] - nodes_df$Color[nodes_df$log2FC < 0.5] <- colors["No fold change"] - nodes_df$Color[nodes_df$log2FC <= -0.5] <- colors["-1.5 < FC ≤ -0.5"] - nodes_df$Color[nodes_df$log2FC <= -1.5] <- colors[" -3 < FC ≤ -1.5"] - nodes_df$Color[nodes_df$log2FC <= -3] <- colors[" FC ≤ -3"] - nodes_df$Color <- as.character(nodes_df$Color) - - ## Add nodes of legend to nodes_df - legend_df <- data.frame(matrix(nrow = length(colors), ncol = ncol(nodes_df))) - colnames(legend_df) <- colnames(nodes_df) - legend_df$Label <- names(colors) - legend_df$x <- max(nodes_df$x, na.rm=TRUE) * 1.1 - legend_df$Shape <- "o" - legend_df$Color <- as.character(colors) - span_y <- (max(nodes_df$y, na.rm=TRUE) - min(nodes_df$y, na.rm=TRUE)) - legend_y_center <- span_y / 2 - legend_y_step <- span_y * 0.05 - legend_ys <- legend_y_center + seq(from=3.5 * legend_y_step, - to=-3.5 * legend_y_step, - by=-legend_y_step) - legend_df$y <- round(legend_ys) - # legend_df$Metabolites <- "" - # legend_df$log2FC <- 0 - - # nodes_legend_df <- rbind(nodes_df, legend_df) - - - ## Draw network - cat("Drawing network... ") - draw_network_py( - nodes_df=rbind(nodes_df, legend_df), - edge_df=edge_df, - annotation_df=annotation_df, - output=output, - f_width=figsize[1], - f_height=figsize[2], - dpi=dpi, - bg_color=bg_color, - node_size=node_size, - font_size=font_size, - font_color=font_color, - font_family=font_family, - edge_color=edge_color, - ann_font_size=ann_font_size, - ann_font_color=ann_font_color - ) - cat("finished!\n") -} diff --git a/R/plot_log2FC.R b/R/plot_log2FC.R index 64a7acf..4ae4288 100644 --- a/R/plot_log2FC.R +++ b/R/plot_log2FC.R @@ -18,9 +18,11 @@ #' @export #' #' @examples -#' \dontrun{ -#' print(1) -#' } +#' metalyzer_se <- MetAlyzer_dataset(file_path = extraction_data()) +#' metalyzer_se <- renameMetaData(metalyzer_se, Method = 'Sample Description') +#' +#' log2FC_df <- calculate_log2FC(metalyzer_se, Method, perc_of_min = 0.2, impute_NA = TRUE) +#' network <- plot_network(log2FC_df, q_value = 0.05) # classes <- c('Acylcarnitines', 'Alkaloids', 'Amine Oxides', 'Aminoacids', # 'Aminoacids Related', 'Bile Acids', 'Biogenic Amines', 'Carboxylic Acids', diff --git a/R/plot_network.R b/R/plot_network.R index f81e7bc..4edc700 100644 --- a/R/plot_network.R +++ b/R/plot_network.R @@ -1,8 +1,20 @@ -# Load the required packages -library(dplyr) -library(ggplot2) -library(ggrepel) - +#' @title Plot Pathway Network +#' +#' @description This function plots the log2 fold change for each metabolite and visualizes it, in a pathway network. +#' +#' @param log2FC_df A data frame with the log2 fold change for each metabolite +#' @param q_value The q-value threshold for significance +#' @return ggplot object +#' @export +#' +#' @examples +#' metalyzer_se <- MetAlyzer_dataset(file_path = extraction_data()) +#' metalyzer_se <- renameMetaData(metalyzer_se, Method = 'Sample Description') +#' +#' log2FC_df <- calculate_log2FC(metalyzer_se, Method, perc_of_min = 0.2, impute_NA = TRUE) +#' +#' p_vulcano <- plot_log2FC(log2FC_df, hide_labels_for = rownames(rowData(MetAlyzer_proj)), vulcano=TRUE) +#' p_fc <- plot_log2FC(log2FC_df, hide_labels_for = rownames(rowData(MetAlyzer_proj)), vulcano=FALSE) read_named_region <- function(file_path, named_region) { full_sheet <- openxlsx::read.xlsx( @@ -237,7 +249,7 @@ plot_network <- function(log2FC_df, q_value=0.05) { theme(plot.title = element_text(hjust = 0.5)) network - ggsave("network.pdf", network, width = 15, height = 10, bg = "white") + #ggsave("network.pdf", network, width = 15, height = 10, bg = "white") } From b8041397f766769e3732550c2717944115def86f Mon Sep 17 00:00:00 2001 From: Luis Herfurth Date: Sun, 12 Nov 2023 18:21:05 +0100 Subject: [PATCH 3/3] R CMD fix --- DESCRIPTION | 5 ----- 1 file changed, 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8f0049b..fa01052 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,14 +25,9 @@ Imports: openxlsx, dplyr, tidyr, - tibble, stringr, - ggplot2, - ggrepel, - methods, utils, rlang, - grDevices, SummarizedExperiment, S4Vectors, BiocManager,