Browse code

Added a new argument to addConnections_TF_peak for special cases

Christian Arnold authored on 11/08/2022 13:45:45
Showing2 changed files

... ...
@@ -1761,6 +1761,7 @@ AR_classification_wrapper<- function (GRN, significanceThreshold_Wilcoxon = 0.05
1761 1761
 #' @param connectionTypes Character vector. Default \code{expression}. Vector of connection types to include for the TF-peak connections. If an additional connection type is specified here, it has to be available already within the object (EXPERIMENTAL). See the function \code{\link{addData_TFActivity}} for details.
1762 1762
 #' @param removeNegativeCorrelation  Vector of \code{TRUE} or \code{FALSE}. Default \code{FALSE}. EXPERIMENTAL. Must be a logical vector of the same length as the parameter \code{connectionType}. Should negatively correlated TF-peak connections be removed for the specific connection type? For connection type expression, the default is \code{FALSE}, while for any TF Activity related connection type, we recommend setting this to \code{TRUE}.  
1763 1763
 #' @param maxFDRToStore Numeric. Default 0.3. Maximum TF-peak FDR value to permanently store a particular TF-peak connection in the object? This parameter has a large influence on the overall memory size of the object, and we recommend not storing connections with a high FDR due to their sheer number.
1764
+#' @param addForPermuted \code{TRUE} or \code{FALSE}.  Default \code{FALSE}. Add connections also for permuted data. Leave at \code{TRUE} unless you know what you are doing.
1764 1765
 #' @param useGCCorrection \code{TRUE} or \code{FALSE}.  Default \code{FALSE}. EXPERIMENTAL. Should a GC-matched background be used when calculating FDRs?
1765 1766
 #' @param percBackground_size Numeric (0 to 100). Default 75. EXPERIMENTAL. Description will follow. Only relevant if \code{useGCCorrection} is set to \code{TRUE}, ignored otherwise.
1766 1767
 #' @param percBackground_resample \code{TRUE} or \code{FALSE}.  Default \code{TRUE}. EXPERIMENTAL. Should resampling be enabled for those GC bins for which not enough background peaks are available?. Only relevant if \code{useGCCorrection} is set to \code{TRUE}, ignored otherwise.
... ...
@@ -1776,6 +1777,7 @@ addConnections_TF_peak <- function (GRN, plotDiagnosticPlots = TRUE, plotDetails
1776 1777
                                     connectionTypes = c("expression"),
1777 1778
                                     removeNegativeCorrelation = c(FALSE),
1778 1779
                                     maxFDRToStore = 0.3, 
1780
+                                    addForPermuted = TRUE,
1779 1781
                                     useGCCorrection = FALSE, percBackground_size = 75, percBackground_resample = TRUE,
1780 1782
                                     forceRerun = FALSE) {
1781 1783
   
... ...
@@ -1785,6 +1787,7 @@ addConnections_TF_peak <- function (GRN, plotDiagnosticPlots = TRUE, plotDetails
1785 1787
   checkmate::assertFlag(plotDiagnosticPlots)
1786 1788
   checkmate::assertFlag(plotDetails)
1787 1789
   checkmate::assertChoice(corMethod, c("pearson", "spearman"))
1790
+  checkmate::assertFlag(addForPermuted)
1788 1791
   
1789 1792
   GRN = .checkAndUpdateConnectionTypes(GRN) # For compatibility with older versions
1790 1793
   checkmate::assertSubset(connectionTypes, GRN@config$TF_peak_connectionTypes)
... ...
@@ -1814,6 +1817,10 @@ addConnections_TF_peak <- function (GRN, plotDiagnosticPlots = TRUE, plotDetails
1814 1817
     }
1815 1818
     
1816 1819
     for (permutationCur in 0:.getMaxPermutation(GRN)) {
1820
+        
1821
+      if(!addForPermuted & permutationCur != 0) {
1822
+          next
1823
+      }
1817 1824
       
1818 1825
       futile.logger::flog.info(paste0("\n", .getPermStr(permutationCur), "\n"))
1819 1826
       permIndex = as.character(permutationCur)
... ...
@@ -13,6 +13,7 @@ addConnections_TF_peak(
13 13
   connectionTypes = c("expression"),
14 14
   removeNegativeCorrelation = c(FALSE),
15 15
   maxFDRToStore = 0.3,
16
+  addForPermuted = TRUE,
16 17
   useGCCorrection = FALSE,
17 18
   percBackground_size = 75,
18 19
   percBackground_resample = TRUE,
... ...
@@ -36,6 +37,8 @@ addConnections_TF_peak(
36 37
 
37 38
 \item{maxFDRToStore}{Numeric. Default 0.3. Maximum TF-peak FDR value to permanently store a particular TF-peak connection in the object? This parameter has a large influence on the overall memory size of the object, and we recommend not storing connections with a high FDR due to their sheer number.}
38 39
 
40
+\item{addForPermuted}{\code{TRUE} or \code{FALSE}.  Default \code{FALSE}. Add connections also for permuted data. Leave at \code{TRUE} unless you know what you are doing.}
41
+
39 42
 \item{useGCCorrection}{\code{TRUE} or \code{FALSE}.  Default \code{FALSE}. EXPERIMENTAL. Should a GC-matched background be used when calculating FDRs?}
40 43
 
41 44
 \item{percBackground_size}{Numeric (0 to 100). Default 75. EXPERIMENTAL. Description will follow. Only relevant if \code{useGCCorrection} is set to \code{TRUE}, ignored otherwise.}