Skip to content

Commit 7df962e

Browse files
authored
Merge pull request #42 from mpc-bioinformatics/workflow-ttest
Changed file locations for testing + documentation
2 parents 8822a0b + dd2bd5c commit 7df962e

27 files changed

+83
-156
lines changed

R/volcanoPlots.R

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
#' The limits for x-axis.
3333
#' @param ylim \strong{numeric} \cr
3434
#' The limits for y-axis.
35+
#' @param alpha \strong{numeric} \cr
36+
#' The transparency of the data points.
37+
#' @param point_size \strong{numeric} \cr
38+
#' The size of the data points.
3539
#'
3640
#' @return A ggplot showing the volcano plot.
3741
#' @export
@@ -55,7 +59,8 @@ VolcanoPlot <- function(p,
5559
legend_position = "bottom",
5660
base_size = NULL,
5761
xlim = NULL,
58-
ylim = NULL, alpha = 0.5,
62+
ylim = NULL,
63+
alpha = 0.5,
5964
point_size = 3) {
6065

6166

@@ -134,6 +139,11 @@ VolcanoPlot <- function(p,
134139
#' The columns name for adjusted p-value.
135140
#' @param columnname_FC \strong{character} \cr
136141
#' The column name for fold change.
142+
#'
143+
#' @param thres_fc \strong{numeric} \cr
144+
#' The threshold for fold change.
145+
#' @param thres_p \strong{numeric} \cr
146+
#' The threshold for p-value.
137147
#' @param log_base_fc \strong{numeric} \cr
138148
#' The base for the fold changes log-transformation.
139149
#' @param log_base_p \strong{numeric} \cr
@@ -142,31 +152,14 @@ VolcanoPlot <- function(p,
142152
#' If \code{TRUE}, fold change is already log-transformed.
143153
#' @param is_p_log \strong{logical} \cr
144154
#' If \code{TRUE}, p-value is already log-transformed.
145-
#' @param thres_fc \strong{numeric} \cr
146-
#' The threshold for fold change.
147-
#' @param thres_p \strong{numeric} \cr
148-
#' The threshold for p-value.
155+
#'
149156
#' @param show_thres_line \strong{logical} \cr
150157
#' If \code{TRUE}, threshold lines will be shown.
151-
#' @param colour1 \strong{character} \cr
152-
#' The color for not significant proteins.
153-
#' @param colour2 \strong{character} \cr
154-
#' The color for significant proteins.
155-
#' @param colour3 \strong{character} \cr
156-
#' The color for significant proteins after FDR correction.
157158
#' @param groupname1 \strong{character} \cr
158159
#' The name of first group.
159160
#' @param groupname2 \strong{character} \cr
160161
#' The name of second group.
161-
#' @param xlim \strong{numeric} \cr
162-
#' The limits for x-axis.
163-
#' @param ylim \strong{numeric} \cr
164-
#' The limits for y-axis.
165-
#' @param symmetric_x \strong{logical} \cr
166-
#' If \code{TRUE}, x-axis limits will be made symmetric (not used if xlim is defined).
167-
#' @param legend_position \strong{character} \cr
168-
#' The positioning of the legend.
169-
#' Options are "none", "left", "right", "bottom", "top" and "inside".
162+
#'
170163
#' @param plot_height \strong{numeric} \cr
171164
#' The height of plot.
172165
#' @param plot_width \strong{numeric} \cr
@@ -176,14 +169,16 @@ VolcanoPlot <- function(p,
176169
#' @param plot_device \strong{character} \cr
177170
#' The plot device that is used for the resulting plot.
178171
#' Options are "pdf" and "png".
172+
#'
179173
#' @param output_path \strong{character} \cr
180174
#' The path for output file.
181175
#' @param suffix \strong{character} \cr
182176
#' The suffix for output file.
183-
#' @param base_size \strong{numeric} \cr
184-
#' The base size for theme.
185177
#' @param add_annotation \strong{logical} \cr
186178
#' If \code{TRUE}, annotation will be added.
179+
#'
180+
#' @param ... Additional arguments for the plot.
181+
#'
187182
#'
188183
#' @return A ggplot object of the volcano plot from a ttest result.
189184
#' @export
@@ -197,19 +192,23 @@ VolcanoPlot_ttest <- function(RES,
197192
columnname_p = "p",
198193
columnname_padj = "padj",
199194
columnname_FC = "FC",
200-
thres_p = 0.05,
195+
201196
thres_fc = 2,
197+
thres_p = 0.05,
202198
log_base_fc = 2,
203199
log_base_p = 10,
204200
is_FC_log = FALSE,
205201
is_p_log = FALSE,
202+
206203
show_thres_line = TRUE,
207204
groupname1 = "group1",
208205
groupname2 = "group2",
206+
209207
plot_height = 15,
210208
plot_width = 15,
211209
plot_dpi = 300,
212210
plot_device="pdf",
211+
213212
output_path = NULL,
214213
suffix = NULL,
215214
add_annotation = TRUE,

R/workflow_ttest.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#' @param p_value_zeros_to_min \strong{logical} \cr
3232
#' If \code{TRUE}, then \code{p_values == 0} will be set to the next smallest value of the p-values.
3333
#'
34+
#' @param volcano_base_size \strong{numeric} \cr
35+
#' The base size of the volcano plot.
36+
#'
37+
#'
3438
#' @param significant_after_FDR \strong{logical} \cr
3539
#' If \code{TRUE}, candidates for the boxplots and heatmap need to be significant after FDR correction, otherwise all significant candidates will be used.
3640
#' @param max_valid_values_off \strong{integer} \cr
@@ -48,6 +52,9 @@
4852
#' The plot width in cm.
4953
#' @param plot_dpi \strong{integer} \cr
5054
#' The "dots per inch" of the plot aka. the plot resolution.
55+
#'
56+
#' @param column_name_protein \strong{character} \cr
57+
#' The column name containing the proteins.
5158
#'
5259
#'
5360
#' @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.

inst/extdata/MA_plot_snapshot.png

2.87 KB
Loading
17.9 KB
Binary file not shown.

inst/extdata/test01.xlsx

9.44 KB
Binary file not shown.

inst/extdata/test_file_MA_plots.xlsx

12.3 KB
Binary file not shown.

man/VolcanoPlot.Rd

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/VolcanoPlot_ttest.Rd

Lines changed: 12 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/workflow_ttest.Rd

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-ANOVA.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test_that("Calculate ANOVA ", {
55
dir.create(temp_dir)
66
on.exit(unlink(temp_dir, recursive = TRUE))
77

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

1010
expect_snapshot(data[["D"]])
1111
expect_snapshot(data[["ID"]])

tests/testthat/test-Boxplot.R

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
1-
# test_that("Boxplot with groups", {
2-
# pData <- prepareData(data_path = test_path("testdata", "test01.xlsx"), intensity_columns = 3:11, use_groups = TRUE)
3-
# pResult <- Boxplots(D_long = pData[["D_long"]], method = "boxplot")
4-
# plot <- pResult[["plot"]]
5-
# vdiffr::expect_doppelganger("Boxplot", plot)
6-
# })
7-
8-
# test_that("Violinplot without groups", {
9-
# pData <- prepareData(data_path = test_path("testdata", "test01.xlsx"), intensity_columns = 3:11, use_groups = FALSE)
10-
# pResult <- Boxplots(D_long = pData[["D_long"]], method = "violinplot")
11-
# plot <- pResult[["plot"]]
12-
# vdiffr::expect_doppelganger("Violinplot", plot)
13-
# })
14-
15-
16-
17-
# NEW #
181

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

269
test_that("Violinplot without groups for test_file_1", {
27-
pData <- prepareData(data_path = test_path("testdata", "test_file_1.xlsx"), intensity_columns = 3:11, use_groups = FALSE)
10+
pData <- prepareData(data_path = system.file("extdata", "test_file_1.xlsx", package = "ProtStatsWF"), intensity_columns = 3:11, use_groups = FALSE)
2811
pResult <- Boxplots(D_long = pData[["D_long"]], method = "violinplot")
2912
plot <- pResult[["plot"]]
3013
vdiffr::expect_doppelganger("Violinplot_test_file_1", plot)

tests/testthat/test-MA_Plot.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test_that("Single MA plot", {
1212

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

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

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

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

0 commit comments

Comments
 (0)