Browse code

Attemtping to fix cache issue with vignette + small documenttion updates

Christian Arnold authored on 26/09/2022 08:17:09
Showing8 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: GRaNIE
2 2
 Title: GRaNIE: Reconstruction cell type specific gene regulatory networks including enhancers using chromatin accessibility and RNA-seq data
3
-Version: 1.1.13
3
+Version: 1.1.14
4 4
 Encoding: UTF-8
5 5
 Authors@R: c(person("Christian", "Arnold", email =
6 6
         "chrarnold@web.de", role = c("cre","aut")),
... ...
@@ -3966,6 +3966,7 @@ generateStatsSummary <- function(GRN,
3966 3966
                 
3967 3967
                 futile.logger::flog.debug(paste0("    TF_peak.connectionType = ", TF_peak.connectionTypeCur))
3968 3968
                 
3969
+                futile.logger::flog.threshold(futile.logger::WARN)
3969 3970
                 GRN = filterGRNAndConnectGenes(GRN, 
3970 3971
                                                TF_peak.fdr.threshold = TF_peak.fdr_cur, 
3971 3972
                                                TF_peak.connectionTypes = TF_peak.connectionTypeCur, 
... ...
@@ -3976,7 +3977,10 @@ generateStatsSummary <- function(GRN,
3976 3977
                                                allowMissingTFs = allowMissingTFsCur,
3977 3978
                                                peak_gene.r_range = peak_gene.r_range,
3978 3979
                                                filterTFs = NULL, filterGenes = NULL, filterPeaks = NULL,
3979
-                                               silent = TRUE)
3980
+                                               silent = FALSE)
3981
+                
3982
+                futile.logger::flog.threshold(futile.logger::INFO)
3983
+                
3980 3984
                 
3981 3985
                 results.l = .addStats(GRN@stats$connections, GRN@connections$all.filtered[[permIndex]], 
3982 3986
                                       perm = permutationCur, 
... ...
@@ -4217,6 +4221,11 @@ loadExampleObject <- function(forceDownload = FALSE, fileURL = "https://www.embl
4217 4221
   
4218 4222
   GRN = .makeObjectCompatible(GRN)
4219 4223
   
4224
+  # TODO remove once done already in the object
4225
+  GRN = add_TF_gene_correlation(GRN)
4226
+  
4227
+  # GRN = add_featureVariation(GRN, formula = "auto", metadata = "mt_frac")
4228
+  
4220 4229
   GRN
4221 4230
   
4222 4231
 }
... ...
@@ -2166,6 +2166,7 @@ plotGeneralGraphStats <- function(GRN, outputFolder = NULL, basenameOutput = NUL
2166 2166
 #' @return The same \code{\linkS4class{GRN}} object, without modifications.
2167 2167
 #' @seealso \code{\link{plotCommunitiesEnrichment}}
2168 2168
 #' @seealso \code{\link{plotTFEnrichment}}
2169
+#' @seealso \code{\link{calculateGeneralEnrichment}}
2169 2170
 #' @examples 
2170 2171
 #' # See the Workflow vignette on the GRaNIE website for examples
2171 2172
 #' GRN = loadExampleObject()
... ...
@@ -2194,6 +2195,7 @@ plotGeneralEnrichment <- function(GRN, outputFolder = NULL, basenameOutput = NUL
2194 2195
   checkmate::assertNumeric(p, lower = 0, upper = 1)
2195 2196
   checkmate::assertIntegerish(topn_pvalue, lower = 1)
2196 2197
   checkmate::assertFlag(display_pAdj)
2198
+  checkmate::assertIntegerish(maxWidth_nchar_plot, lower = 10)
2197 2199
   checkmate::assertFlag(plotAsPDF)
2198 2200
   checkmate::assertNumeric(pdf_width, lower = 5, upper = 99)
2199 2201
   checkmate::assertNumeric(pdf_height, lower = 5, upper = 99)
... ...
@@ -2546,6 +2548,7 @@ plotCommunitiesStats <- function(GRN, outputFolder = NULL, basenameOutput = NULL
2546 2548
 #' @return  The same \code{\linkS4class{GRN}} object, without modifications.
2547 2549
 #' @seealso \code{\link{plotGeneralEnrichment}}
2548 2550
 #' @seealso \code{\link{plotTFEnrichment}}
2551
+#' @seealso \code{\link{calculateCommunitiesEnrichment}}
2549 2552
 #' @examples 
2550 2553
 #' # See the Workflow vignette on the GRaNIE website for examples
2551 2554
 #' GRN = loadExampleObject()
... ...
@@ -2574,7 +2577,7 @@ plotCommunitiesEnrichment <- function(GRN, outputFolder = NULL, basenameOutput =
2574 2577
   checkmate::assertNumeric(nID, lower = 1)
2575 2578
   checkmate::assertFlag(display_pAdj)
2576 2579
   checkmate::assertFlag(plotAsPDF)
2577
-  checkmate::assertIntegerish(maxWidth_nchar_plot, lower = 10, upper = 500)
2580
+  checkmate::assertIntegerish(maxWidth_nchar_plot, lower = 10)
2578 2581
   checkmate::assertNumeric(pdf_width, lower = 5, upper = 99)
2579 2582
   checkmate::assertNumeric(pdf_height, lower = 5, upper = 99)
2580 2583
   checkmate::assert(checkmate::checkNull(pages), checkmate::checkIntegerish(pages, lower = 1))
... ...
@@ -2891,6 +2894,7 @@ plotCommunitiesEnrichment <- function(GRN, outputFolder = NULL, basenameOutput =
2891 2894
 #' @return The same \code{\linkS4class{GRN}} object, without modifications.
2892 2895
 #' @seealso \code{\link{plotGeneralEnrichment}}
2893 2896
 #' @seealso \code{\link{plotCommunitiesEnrichment}}
2897
+#' @seealso \code{\link{calculateTFEnrichment}}
2894 2898
 #' @examples 
2895 2899
 #' # See the Workflow vignette on the GRaNIE website for examples
2896 2900
 #' GRN = loadExampleObject()
... ...
@@ -2924,6 +2928,7 @@ plotTFEnrichment <- function(GRN, rankType = "degree", n = NULL, TF.names = NULL
2924 2928
   checkmate::assertNumeric(pdf_height, lower = 5, upper = 99)
2925 2929
   checkmate::assert(checkmate::checkNull(pages), checkmate::checkIntegerish(pages, lower = 1))
2926 2930
   checkmate::assertFlag(display_pAdj)
2931
+  checkmate::assertIntegerish(maxWidth_nchar_plot, lower = 10)
2927 2932
   checkmate::assert(checkmate::checkNull(outputFolder), checkmate::checkCharacter(outputFolder, min.chars = 1))
2928 2933
   checkmate::assert(checkmate::checkNull(basenameOutput), checkmate::checkCharacter(basenameOutput, len = 1, min.chars = 1, any.missing = FALSE))
2929 2934
   checkmate::assertFlag(forceRerun)
... ...
@@ -74,4 +74,6 @@ GRN = plotCommunitiesEnrichment(GRN, plotAsPDF = FALSE, pages = 1)
74 74
 \code{\link{plotGeneralEnrichment}}
75 75
 
76 76
 \code{\link{plotTFEnrichment}}
77
+
78
+\code{\link{calculateCommunitiesEnrichment}}
77 79
 }
... ...
@@ -62,4 +62,6 @@ GRN = plotGeneralEnrichment(GRN, plotAsPDF = FALSE, pages = 1)
62 62
 \code{\link{plotCommunitiesEnrichment}}
63 63
 
64 64
 \code{\link{plotTFEnrichment}}
65
+
66
+\code{\link{calculateGeneralEnrichment}}
65 67
 }
... ...
@@ -77,4 +77,6 @@ GRN = plotTFEnrichment(GRN, n = 5, plotAsPDF = FALSE, pages = 1)
77 77
 \code{\link{plotGeneralEnrichment}}
78 78
 
79 79
 \code{\link{plotCommunitiesEnrichment}}
80
+
81
+\code{\link{calculateTFEnrichment}}
80 82
 }
81 83
deleted file mode 100644
... ...
@@ -1,52 +0,0 @@
1
-test_that("multiplication works", {
2
-  expect_equal(2 * 2, 4)
3
-})
4
-
5
-test_that("addConnections_TF_peak", {
6
-  options(timeout = 500)
7
-  GRN = loadExampleObject(forceDownload = TRUE)
8
-  
9
-  GRN = addConnections_TF_peak(GRN, connectionTypes = c("expression"), outputFolder = ".", forceRerun = TRUE)
10
-  expect_s4_class(GRN, "GRN")
11
-  
12
-  expect_error(addConnections_TF_peak(GRN, connectionTypes = c("bla"), outputFolder = ".", forceRerun = TRUE), 
13
-               regexp = "Assertion on")
14
-  
15
-  expect_error(addConnections_TF_peak(GRN, connectionTypes = c("expression", "TF_activity"), outputFolder = ".", forceRerun = TRUE))
16
-  
17
-  expect_error(addConnections_TF_peak(GRN, connectionTypes = c("expression", "TF_activity"), outputFolder = ".", forceRerun = TRUE, removeNegativeCorrelation = c(FALSE)), 
18
-               regexp = "Assertion on")
19
-  
20
-  # Make sure TF activity is added now
21
-  # TODO: Add TF activity here
22
-  # GRN = addConnections_TF_peak(GRN, connectionTypes = c("expression", "TF_activity"), removeNegativeCorrelation = c(FALSE, TRUE), forceRerun = TRUE)
23
-  # expect_s4_class(GRN, "GRN")
24
-  # 
25
-  # GRN = addConnections_TF_peak(GRN, connectionTypes = c("expression", "TF_activity"), removeNegativeCorrelation = c(TRUE, FALSE), forceRerun = TRUE)
26
-  # expect_s4_class(GRN, "GRN")
27
-  # 
28
-  # GRN = addConnections_TF_peak(GRN, connectionTypes = c("TF_activity"), removeNegativeCorrelation = c(TRUE), forceRerun = TRUE)
29
-  # expect_s4_class(GRN, "GRN")
30
-  
31
-
32
-})
33
-
34
-test_that("AR wrapper", {
35
-    
36
-    # We need to increase the timeout, as sometimes, loading this from the internet (here: from our Zaugg download folder) is slow
37
-    options(timeout = 1000)
38
-    GRN = loadExampleObject()
39
-
40
-    # When we expect an error, we should always try to capture the error by something that is supposed to be captured by the code with a specific error message
41
-    expect_error(AR_classification_wrapper(GRN, significanceThreshold_Wilcoxon = 1.5, outputFolder = "."),  regexp = "Assertion on")
42
-    
43
-    # Run with TF activity and expression
44
-    GRN = AR_classification_wrapper(GRN, significanceThreshold_Wilcoxon = 0.05,
45
-                                            plot_minNoTFBS_heatmap = 100, plotDiagnosticPlots = TRUE,
46
-                                            outputFolder = ".", 
47
-                                            deleteIntermediateData = TRUE, forceRerun = TRUE)
48
-    
49
-    # What happens if TF activity is defined but addConnections_TF_peak with only expression?
50
-    
51
-    
52
-})
... ...
@@ -88,7 +88,7 @@ opts_chunk$set(
88 88
   cache = FALSE,
89 89
   message = FALSE,
90 90
   fig.align="center",
91
-  dpi=300,
91
+  dpi=200,
92 92
   fig.height=8,
93 93
   results='hold')
94 94
 ```