Skip to content

Commit

Permalink
Description + R CMD Check
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherfurth committed Nov 12, 2023
1 parent 039a55b commit c611cf0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 325 deletions.
4 changes: 1 addition & 3 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -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$

Expand Down
10 changes: 8 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ Authors@R:
person("Daniel", "Huebschmann",
email = "[email protected]",
role = c("aut"),
comment = c(ORCID = "0000-0002-6041-7049")))
comment = c(ORCID = "0000-0002-6041-7049")),
person("Luis", "Herfurth",
email = "[email protected]",
role = c("aut"),
comment = c(ORCID = "0009-0000-9933-3056")))
Depends:
R (>= 4.0.0)
Imports:
Expand All @@ -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' (<https://www.metaboextract.shiny.dkfz.de/MetaboExtract/>).
License: GPL-3
Encoding: UTF-8
Expand Down
311 changes: 0 additions & 311 deletions R/draw_FC_network.R

This file was deleted.

8 changes: 5 additions & 3 deletions R/plot_log2FC.R
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
24 changes: 18 additions & 6 deletions R/plot_network.R
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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")
}


0 comments on commit c611cf0

Please sign in to comment.