Browse code

bugfixes #3

alexq authored on 27/08/2024 06:34:53
Showing 2 changed files

... ...
@@ -84,40 +84,21 @@ lisa <-
84 84
       BPcellType <- BPPARAM
85 85
     }
86 86
 
87
-    if (!fast) {
88
-      message("Generating local L-curves. ")
89
-      if (identical(BPimage, BPcellType)) {
90
-        message("You might like to consider setting BPPARAM to run the calculations in parallel.")
91
-      }
92
-      curveList <-
93
-        BiocParallel::bplapply(
94
-          cellSummary,
95
-          generateCurves,
96
-          Rs = Rs,
97
-          window = window,
98
-          window.length = window.length,
99
-          BPcellType = BPcellType,
100
-          BPPARAM = BPimage,
101
-          sigma = sigma
102
-        )
103
-    }
104 87
 
105
-    if (fast) {
106
-      message("Generating local L-curves. If you run out of memory, try 'fast = FALSE'.")
107
-
108
-      curveList <-
109
-        BiocParallel::bplapply(
110
-          cellSummary,
111
-          inhomLocalK,
112
-          Rs = Rs,
113
-          sigma = sigma,
114
-          window = window,
115
-          window.length = window.length,
116
-          minLambda = minLambda,
117
-          lisaFunc = lisaFunc,
118
-          BPPARAM = BPimage
119
-        )
120
-    }
88
+    message("Generating local L-curves.")
89
+
90
+    curveList <-
91
+      BiocParallel::bplapply(
92
+        cellSummary,
93
+        inhomLocalK,
94
+        Rs = Rs,
95
+        sigma = sigma,
96
+        window = window,
97
+        window.length = window.length,
98
+        minLambda = minLambda,
99
+        lisaFunc = lisaFunc,
100
+        BPPARAM = BPimage
101
+      )
121 102
 
122 103
     curvelist <- lapply(curveList, as.data.frame)
123 104
     curves <- as.matrix(dplyr::bind_rows(curvelist))
... ...
@@ -17,8 +17,6 @@
17 17
 #' @param sigma A numeric variable used for scaling when filting inhomogeneous L-curves.
18 18
 #' @param lisaFunc Either "K" or "L" curve.
19 19
 #' @param minLambda  Minimum value for density for scaling when fitting inhomogeneous L-curves.
20
-#' @param fast A logical describing whether to use a fast approximation of the
21
-#' inhomogeneous local L-curves.
22 20
 #'
23 21
 #' @return A matrix of LISA curves
24 22
 #'
... ...
@@ -66,8 +64,7 @@ lisaClust <-
66 64
            whichParallel = "imageID",
67 65
            sigma = NULL,
68 66
            lisaFunc = "K",
69
-           minLambda = 0.05,
70
-           fast = TRUE) {
67
+           minLambda = 0.05) {
71 68
     if (methods::is(cells, "SummarizedExperiment")) {
72 69
       cd <- spicyR:::.format_data(
73 70
         cells, imageID, cellType, spatialCoords, FALSE
... ...
@@ -81,8 +78,7 @@ lisaClust <-
81 78
                          whichParallel = whichParallel,
82 79
                          sigma = sigma,
83 80
                          lisaFunc = lisaFunc,
84
-                         minLambda = minLambda,
85
-                         fast = fast
81
+                         minLambda = minLambda
86 82
       )
87 83
       kM <- kmeans(lisaCurves, k)
88 84
       regions <- paste("region", kM$cluster, sep = "_")
... ...
@@ -103,8 +99,7 @@ lisaClust <-
103 99
                 whichParallel = whichParallel,
104 100
                 sigma = sigma,
105 101
                 lisaFunc = lisaFunc,
106
-                minLambda = minLambda,
107
-                fast = fast
102
+                minLambda = minLambda
108 103
             )
109 104
 
110 105
             kM <- kmeans(lisaCurves, k)