Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/nilsmechtel/MetAlyzer into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
nilsmechtel committed Feb 25, 2024
2 parents 7abf7ae + 0fa9909 commit 42c1fe8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion R/MetAlyzer_handler.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion R/calculate_anova.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = " * "), ")... "))
Expand Down
5 changes: 4 additions & 1 deletion R/plot_log2FC.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) +
Expand Down
8 changes: 5 additions & 3 deletions R/plot_network.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand All @@ -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

Expand Down
18 changes: 9 additions & 9 deletions inst/extdata/polarity.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Binary file added network_green_magenta.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion vignettes/MetAlyzer_User_Guide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,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) %>%
Expand Down

0 comments on commit 42c1fe8

Please sign in to comment.