Skip to content

Commit 768237f

Browse files
Added returnData argument to plotFoldChange
1 parent 9ca6a8a commit 768237f

4 files changed

Lines changed: 32 additions & 3 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: pathlinkR
22
Type: Package
33
Title: Analyze and interpret RNA-Seq results
4-
Version: 1.5.2
4+
Version: 1.5.3
55
Authors@R: c(
66
person("Travis", "Blimkie", email = "travis.m.blimkie@gmail.com", role = "cre", comment = c(ORCID = "0000-0001-8778-8627")),
77
person("Andy", "An", email = "andy@hancocklab.com", role = "aut")

R/plotFoldChange.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
#' @param rowAngle Angle of row text, defaults to 0.
6666
#' @param rowCenter Whether to center column text. The default is FALSE, but it
6767
#' should be set to TRUE if vertical column name (e.g. `rowAngle=90`).
68+
#' @param returnData Boolean (FALSE). Whether to draw the heatmap (default) or
69+
#' return the underlying matrix.
6870
#'
6971
#' @return A heatmap of fold changes for genes of interest; an "ggplot" class
7072
#' object
@@ -145,7 +147,8 @@ plotFoldChange <- function(
145147
colAngle=90,
146148
colCenter=TRUE,
147149
rowAngle=0,
148-
rowCenter=FALSE
150+
rowCenter=FALSE,
151+
returnData=FALSE
149152
) {
150153

151154
stopifnot(
@@ -357,6 +360,10 @@ plotFoldChange <- function(
357360
rowSplit <- var
358361
}
359362

363+
if (returnData) {
364+
return(list("matFC" = matFC, "matP" = matP))
365+
}
366+
360367
draw(
361368
Heatmap(
362369
matrix=matFC,

man/plotFoldChange.Rd

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

tests/testthat/test-plotFoldChange.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,21 @@ test_that("fold change heatmaps are working with some customization", {
1414
)
1515
)
1616
})
17+
18+
test_that("argument 'returnData' is working.", {
19+
set.seed(1)
20+
21+
data("exampleDESeqResults")
22+
23+
expect_type(
24+
plotFoldChange(
25+
inputList = exampleDESeqResults,
26+
pathName = "Interferon alpha/beta signaling",
27+
hideNonsigFC = FALSE,
28+
invert = TRUE,
29+
clusterColumns = TRUE,
30+
returnData = TRUE
31+
),
32+
"list"
33+
)
34+
})

0 commit comments

Comments
 (0)