Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions R/volcanoPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#' The limits for x-axis.
#' @param ylim \strong{numeric} \cr
#' The limits for y-axis.
#' @param alpha \strong{numeric} \cr
#' The transparency of the data points.
#' @param point_size \strong{numeric} \cr
#' The size of the data points.
#'
#' @return A ggplot showing the volcano plot.
#' @export
Expand All @@ -55,7 +59,8 @@ VolcanoPlot <- function(p,
legend_position = "bottom",
base_size = NULL,
xlim = NULL,
ylim = NULL, alpha = 0.5,
ylim = NULL,
alpha = 0.5,
point_size = 3) {


Expand Down Expand Up @@ -134,6 +139,11 @@ VolcanoPlot <- function(p,
#' The columns name for adjusted p-value.
#' @param columnname_FC \strong{character} \cr
#' The column name for fold change.
#'
#' @param thres_fc \strong{numeric} \cr
#' The threshold for fold change.
#' @param thres_p \strong{numeric} \cr
#' The threshold for p-value.
#' @param log_base_fc \strong{numeric} \cr
#' The base for the fold changes log-transformation.
#' @param log_base_p \strong{numeric} \cr
Expand All @@ -142,31 +152,14 @@ VolcanoPlot <- function(p,
#' If \code{TRUE}, fold change is already log-transformed.
#' @param is_p_log \strong{logical} \cr
#' If \code{TRUE}, p-value is already log-transformed.
#' @param thres_fc \strong{numeric} \cr
#' The threshold for fold change.
#' @param thres_p \strong{numeric} \cr
#' The threshold for p-value.
#'
#' @param show_thres_line \strong{logical} \cr
#' If \code{TRUE}, threshold lines will be shown.
#' @param colour1 \strong{character} \cr
#' The color for not significant proteins.
#' @param colour2 \strong{character} \cr
#' The color for significant proteins.
#' @param colour3 \strong{character} \cr
#' The color for significant proteins after FDR correction.
#' @param groupname1 \strong{character} \cr
#' The name of first group.
#' @param groupname2 \strong{character} \cr
#' The name of second group.
#' @param xlim \strong{numeric} \cr
#' The limits for x-axis.
#' @param ylim \strong{numeric} \cr
#' The limits for y-axis.
#' @param symmetric_x \strong{logical} \cr
#' If \code{TRUE}, x-axis limits will be made symmetric (not used if xlim is defined).
#' @param legend_position \strong{character} \cr
#' The positioning of the legend.
#' Options are "none", "left", "right", "bottom", "top" and "inside".
#'
#' @param plot_height \strong{numeric} \cr
#' The height of plot.
#' @param plot_width \strong{numeric} \cr
Expand All @@ -176,14 +169,16 @@ VolcanoPlot <- function(p,
#' @param plot_device \strong{character} \cr
#' The plot device that is used for the resulting plot.
#' Options are "pdf" and "png".
#'
#' @param output_path \strong{character} \cr
#' The path for output file.
#' @param suffix \strong{character} \cr
#' The suffix for output file.
#' @param base_size \strong{numeric} \cr
#' The base size for theme.
#' @param add_annotation \strong{logical} \cr
#' If \code{TRUE}, annotation will be added.
#'
#' @param ... Additional arguments for the plot.
#'
#'
#' @return A ggplot object of the volcano plot from a ttest result.
#' @export
Expand All @@ -197,19 +192,23 @@ VolcanoPlot_ttest <- function(RES,
columnname_p = "p",
columnname_padj = "padj",
columnname_FC = "FC",
thres_p = 0.05,

thres_fc = 2,
thres_p = 0.05,
log_base_fc = 2,
log_base_p = 10,
is_FC_log = FALSE,
is_p_log = FALSE,

show_thres_line = TRUE,
groupname1 = "group1",
groupname2 = "group2",

plot_height = 15,
plot_width = 15,
plot_dpi = 300,
plot_device="pdf",

output_path = NULL,
suffix = NULL,
add_annotation = TRUE,
Expand Down
7 changes: 7 additions & 0 deletions R/workflow_ttest.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#' @param p_value_zeros_to_min \strong{logical} \cr
#' If \code{TRUE}, then \code{p_values == 0} will be set to the next smallest value of the p-values.
#'
#' @param volcano_base_size \strong{numeric} \cr
#' The base size of the volcano plot.
#'
#'
#' @param significant_after_FDR \strong{logical} \cr
#' If \code{TRUE}, candidates for the boxplots and heatmap need to be significant after FDR correction, otherwise all significant candidates will be used.
#' @param max_valid_values_off \strong{integer} \cr
Expand All @@ -48,6 +52,9 @@
#' The plot width in cm.
#' @param plot_dpi \strong{integer} \cr
#' The "dots per inch" of the plot aka. the plot resolution.
#'
#' @param column_name_protein \strong{character} \cr
#' The column name containing the proteins.
#'
#'
#' @return Returns a message log of the workflow. The log contains an overview of the settings and gives some information e.g number of significant candidates or on-off-proteins.
Expand Down
Binary file added inst/extdata/MA_plot_snapshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/extdata/MA_plots.pdfMA_Plots_.pdf
Binary file not shown.
Binary file added inst/extdata/test01.xlsx
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added inst/extdata/test_file_MA_plots.xlsx
Binary file not shown.
10 changes: 9 additions & 1 deletion man/VolcanoPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 12 additions & 42 deletions man/VolcanoPlot_ttest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion man/workflow_ttest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-ANOVA.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test_that("Calculate ANOVA ", {
dir.create(temp_dir)
on.exit(unlink(temp_dir, recursive = TRUE))

data <- prepareTtestData(data_path = test_path("testdata", "test_file_2.xlsx"), intensity_columns = 3:11)
data <- prepareTtestData(data_path = system.file("extdata", "test_file_2.xlsx", package = "ProtStatsWF"), intensity_columns = 3:11)

expect_snapshot(data[["D"]])
expect_snapshot(data[["ID"]])
Expand Down
21 changes: 2 additions & 19 deletions tests/testthat/test-Boxplot.R
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
# test_that("Boxplot with groups", {
# pData <- prepareData(data_path = test_path("testdata", "test01.xlsx"), intensity_columns = 3:11, use_groups = TRUE)
# pResult <- Boxplots(D_long = pData[["D_long"]], method = "boxplot")
# plot <- pResult[["plot"]]
# vdiffr::expect_doppelganger("Boxplot", plot)
# })

# test_that("Violinplot without groups", {
# pData <- prepareData(data_path = test_path("testdata", "test01.xlsx"), intensity_columns = 3:11, use_groups = FALSE)
# pResult <- Boxplots(D_long = pData[["D_long"]], method = "violinplot")
# plot <- pResult[["plot"]]
# vdiffr::expect_doppelganger("Violinplot", plot)
# })



# NEW #

test_that("Boxplot with groups for test_file_1", {
pData <- prepareData(data_path = test_path("testdata", "test_file_1.xlsx"), intensity_columns = 3:11, use_groups = TRUE)
pData <- prepareData(data_path = system.file("extdata", "test_file_1.xlsx", package = "ProtStatsWF"), intensity_columns = 3:11, use_groups = TRUE)
pResult <- Boxplots(D_long = pData[["D_long"]], method = "boxplot")
plot <- pResult[["plot"]]
vdiffr::expect_doppelganger("Boxplot_test_file_1", plot)
})

test_that("Violinplot without groups for test_file_1", {
pData <- prepareData(data_path = test_path("testdata", "test_file_1.xlsx"), intensity_columns = 3:11, use_groups = FALSE)
pData <- prepareData(data_path = system.file("extdata", "test_file_1.xlsx", package = "ProtStatsWF"), intensity_columns = 3:11, use_groups = FALSE)
pResult <- Boxplots(D_long = pData[["D_long"]], method = "violinplot")
plot <- pResult[["plot"]]
vdiffr::expect_doppelganger("Violinplot_test_file_1", plot)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-MA_Plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_that("Single MA plot", {

png_file_path <- file.path(temp_dir, "result_MA_plot_snapshot.png")

pData <- prepareData(data_path = test_path("testdata", "test_file_MA_plots.xlsx"), intensity_columns = 3:6)
pData <- prepareData(data_path = system.file("extdata", "test_file_MA_plots.xlsx", package = "ProtStatsWF"), intensity_columns = 3:6)
D = pData[["D"]]
s1 = D[,1]
s2 = D[,2]
Expand All @@ -32,7 +32,7 @@ test_that("plot", {
dir.create(temp_dir)
on.exit(unlink(temp_dir, recursive = TRUE))

pData <- prepareData(data_path = test_path("testdata", "test_file_MA_plots.xlsx"), intensity_columns = 3:6)
pData <- prepareData(data_path = system.file("extdata", "test_file_MA_plots.xlsx", package = "ProtStatsWF"), intensity_columns = 3:6)
D = pData[["D"]]

pResult <- MA_Plots(D = D, do_log_transformation = FALSE, output_path = temp_dir, suffix = "_result")
Expand Down
Loading