diff --git a/R/MetAlyzer_handler.R b/R/MetAlyzer_handler.R index 48ed96d..973041d 100644 --- a/R/MetAlyzer_handler.R +++ b/R/MetAlyzer_handler.R @@ -408,7 +408,7 @@ filterMetabolites <- function(metalyzer_se, } # Get all metabolites with at least one concentration being NA - if (!is.null(drop_NA_concentration)) { + if (drop_NA_concentration) { conc_values <- SummarizedExperiment::assay( metalyzer_se, "conc_values" ) diff --git a/R/calculate_anova.R b/R/calculate_anova.R index 00e5b0e..84b65ee 100755 --- a/R/calculate_anova.R +++ b/R/calculate_anova.R @@ -82,7 +82,7 @@ calculate_anova <- function(metalyzer_se, categorical, groups = NULL, impute_per mutate(ANOVA_n = sum(!is.na(.data$log2_Conc))) anova_data <- aggregated_data %>% - rename(Categorical = all_of(categorical)) %>% + dplyr::rename(Categorical = all_of(categorical)) %>% ungroup(.data$Categorical) cat(paste0("Info: Calculating ANOVA (groupwise: ", paste(groups(anova_data), collapse = " * "), ")... ")) diff --git a/R/plot_log2FC.R b/R/plot_log2FC.R index e11d9c9..cf502c5 100644 --- a/R/plot_log2FC.R +++ b/R/plot_log2FC.R @@ -188,6 +188,9 @@ plot_log2FC <- function(metalyzer_se, select(.data$x) %>% max() + # Create y-axis limits for the rectangles + ylims <- c(min(log2FC_df$log2FC) - 0.75, max(log2FC_df$log2FC) + 0,75) + ## Plot graph p_fc <- ggplot(p_data, aes(x = .data$x, @@ -197,7 +200,7 @@ plot_log2FC <- function(metalyzer_se, geom_rect(data = rects_df, inherit.aes = FALSE, aes(xmin = .data$Start, xmax = .data$End, - ymin = -Inf, ymax = Inf, + ymin = ylims[1], ymax = ylims[2], fill = .data$Class), show.legend = TRUE, alpha = 0.4) + diff --git a/R/plot_network.R b/R/plot_network.R index 35a7479..52b6495 100644 --- a/R/plot_network.R +++ b/R/plot_network.R @@ -146,8 +146,8 @@ plot_network <- function(metalyzer_se, q_value=0.05) { # Create a plot of the network using ggplot2 and ggrepel label_size <- 3 - area_size <- 5 - edge_size <- 1 + area_size <- 4 + edge_size <- 0.75 annotation_size <- 6 network <- ggplot() @@ -199,6 +199,8 @@ plot_network <- function(metalyzer_se, q_value=0.05) { size = label_size, color = "white" ) + + scale_fill_gradient2(low = "green", high = "magenta", mid = "black") + + # Add annotations geom_text( data = pathways, @@ -216,7 +218,7 @@ plot_network <- function(metalyzer_se, q_value=0.05) { # ylim(0, 10) + theme_void() + # Add a title and remove the x and y axis labels - ggtitle("Example Network Plot with Colored Area Behind Curved Edges") + + ggtitle("") + theme(plot.title = element_text(hjust = 0.5)) network diff --git a/inst/extdata/polarity.csv b/inst/extdata/polarity.csv index 2584d7b..c922f0f 100644 --- a/inst/extdata/polarity.csv +++ b/inst/extdata/polarity.csv @@ -22,12 +22,12 @@ "21","Sugars","FIA" "22","Triacylglycerols","FIA" "23","Vitamins & Cofactors","LC" -"24","Monoacylglycerols","LC" -"25","Phosphatidic Acids","LC" -"26","Phosphatidylcholines","LC" -"27","Phosphatidylethanolamines","LC" -"28","Phosphatidylglycerols","LC" -"29","Phosphatidylinositols","LC" -"30","Phosphatidylserines","LC" -"31","Sphingoid Bases","LC" -"32","Sphingomyelins","LC" +"24","Monoacylglycerols","FIA" +"25","Phosphatidic Acids","FIA" +"26","Phosphatidylcholines","FIA" +"27","Phosphatidylethanolamines","FIA" +"28","Phosphatidylglycerols","FIA" +"29","Phosphatidylinositols","FIA" +"30","Phosphatidylserines","FIA" +"31","Sphingoid Bases","FIA" +"32","Sphingomyelins","FIA" diff --git a/network_green_magenta.pdf b/network_green_magenta.pdf new file mode 100644 index 0000000..5559472 Binary files /dev/null and b/network_green_magenta.pdf differ diff --git a/vignettes/MetAlyzer_User_Guide.Rmd b/vignettes/MetAlyzer_User_Guide.Rmd index 651ddb3..a66219e 100755 --- a/vignettes/MetAlyzer_User_Guide.Rmd +++ b/vignettes/MetAlyzer_User_Guide.Rmd @@ -189,7 +189,7 @@ metalyzer_se <- calculate_anova( categorical = "Extraction_Method", groups = c("Tissue", "Metabolite"), impute_perc_of_min = 0.2, - impute_NA = FALSE + impute_NA = TRUE ) aggregated_data <- aggregatedData(metalyzer_se) %>%