Browse code

Fix for function not found if SnowParam parallelisation used.

Dario Strbenac authored on 02/08/2022 04:00:10
Showing 8 changed files

... ...
@@ -3,8 +3,8 @@ Type: Package
3 3
 Title: A framework for cross-validated classification problems, with
4 4
        applications to differential variability and differential
5 5
        distribution testing
6
-Version: 3.1.9
7
-Date: 2022-07-25
6
+Version: 3.1.10
7
+Date: 2022-08-02
8 8
 Author: Dario Strbenac, Ellis Patrick, John Ormerod, Graham Mann, Jean Yang
9 9
 Maintainer: Dario Strbenac <dario.strbenac@sydney.edu.au>
10 10
 VignetteBuilder: knitr
... ...
@@ -345,7 +345,7 @@ setMethod("crossValidate", "data.frame", # data.frame of numeric measurements.
345 345
                    nCores = 1,
346 346
                    characteristicsLabel = NULL)
347 347
           {
348
-              measurements <- DataFrame(measurements)
348
+              measurements <- S4Vectors::DataFrame(measurements)
349 349
               crossValidate(measurements = measurements,
350 350
                             outcome = outcome,
351 351
                             nFeatures = nFeatures,
... ...
@@ -170,7 +170,7 @@ standardGeneric("elasticNetGLMpredictInterface"))
170 170
 setMethod("elasticNetGLMpredictInterface", c("multnet", "matrix"),
171 171
           function(model, measurementsTest, ...)
172 172
 {
173
-  elasticNetGLMpredictInterface(model, DataFrame(measurementsTest, check.names = FALSE), ...)
173
+  elasticNetGLMpredictInterface(model, S4Vectors::DataFrame(measurementsTest, check.names = FALSE), ...)
174 174
 })
175 175
 
176 176
 # Sample information data, for example.
... ...
@@ -64,9 +64,9 @@ setGeneric("fisherDiscriminant", function(measurementsTrain, ...) standardGeneri
64 64
 #' @export
65 65
 setMethod("fisherDiscriminant", "matrix", function(measurementsTrain, classesTrain, measurementsTest, ...) # Matrix of numeric measurements.
66 66
 {
67
-  fisherDiscriminant(DataFrame(measurementsTrain[, , drop = FALSE], check.names = FALSE),
67
+  fisherDiscriminant(S4Vectors::DataFrame(measurementsTrain[, , drop = FALSE], check.names = FALSE),
68 68
                      classesTrain,
69
-                     DataFrame(measurementsTest[, , drop = FALSE], check.names = FALSE), ...)
69
+                     S4Vectors::DataFrame(measurementsTest[, , drop = FALSE], check.names = FALSE), ...)
70 70
 })
71 71
 
72 72
 #' @rdname fisherDiscriminant
... ...
@@ -144,7 +144,7 @@ standardGeneric("GLMpredictInterface"))
144 144
 setMethod("GLMpredictInterface", c("glm", "matrix"),
145 145
           function(model, measurementsTest, ...)
146 146
 {
147
-  GLMpredictInterface(model, DataFrame(measurementsTest, check.names = FALSE), ...)
147
+  GLMpredictInterface(model, S4Vectors::DataFrame(measurementsTest, check.names = FALSE), ...)
148 148
 })
149 149
 
150 150
 #' @rdname GLM
... ...
@@ -92,7 +92,7 @@ setMethod("runTest", "DataFrame", # Sample information data or one of the other
92 92
 function(measurementsTrain, outcomeTrain, measurementsTest, outcomeTest,
93 93
          crossValParams = CrossValParams(), # crossValParams might be used for tuning optimisation.
94 94
          modellingParams = ModellingParams(), characteristics = S4Vectors::DataFrame(), verbose = 1, .iteration = NULL)
95
-{if(!is.null(.iteration) && .iteration != "internal")
95
+{
96 96
   if(is.null(.iteration)) # Not being called by runTests but by user. So, check the user input.
97 97
   {
98 98
     if(is.null(rownames(measurementsTrain)))
... ...
@@ -258,7 +258,7 @@ input data. Autmomatically reducing to smaller number.")
258 258
     performanceChanges <- round(performancesWithoutEach - calcExternalPerformance(outcomeTest, predictedOutcome, performanceType), 2)
259 259
      
260 260
     if(is.null(S4Vectors::mcols(measurementsTrain))) selectedFeatures <- featuresInfo[selectedFeaturesIndices, "Original Feature"] else selectedFeatures <- featuresInfo[selectedFeaturesIndices, c("Original Assay", "Original Feature")]
261
-    importanceTable <- DataFrame(selectedFeatures, performanceChanges)
261
+    importanceTable <- S4Vectors::DataFrame(selectedFeatures, performanceChanges)
262 262
     if(ncol(importanceTable) == 2) colnames(importanceTable)[1] <- "feature"
263 263
     colnames(importanceTable)[ncol(importanceTable)] <- paste("Change in", performanceType)
264 264
   }
... ...
@@ -310,7 +310,7 @@ input data. Autmomatically reducing to smaller number.")
310 310
     }
311 311
 
312 312
     ClassifyResult(characteristics, allSamples, featuresInfo, list(rankedFeatures), list(selectedFeatures),
313
-                   list(models), tuneDetails, DataFrame(sample = rownames(measurementsTest), predictedOutcome, check.names = FALSE), allOutcome, importanceTable)
313
+                   list(models), tuneDetails, S4Vectors::DataFrame(sample = rownames(measurementsTest), predictedOutcome, check.names = FALSE), allOutcome, importanceTable)
314 314
   }  
315 315
 })
316 316
 
... ...
@@ -159,10 +159,10 @@ input data. Autmomatically reducing to smaller number.")
159 159
         predictsColumnName <- "risk"
160 160
     else # Classification task. A factor.
161 161
         predictsColumnName <- "class"
162
-    predictionsTable <- DataFrame(sample = unlist(lapply(results, "[[", "testSet")), splitsTestInfo, unlist(lapply(results, "[[", "predictions")), check.names = FALSE)
162
+    predictionsTable <- S4Vectors::DataFrame(sample = unlist(lapply(results, "[[", "testSet")), splitsTestInfo, unlist(lapply(results, "[[", "predictions")), check.names = FALSE)
163 163
     colnames(predictionsTable)[ncol(predictionsTable)] <- predictsColumnName
164 164
   } else { # data frame
165
-    predictionsTable <- DataFrame(sample = unlist(lapply(results, "[[", "testSet")), splitsTestInfo, do.call(rbind, lapply(results, "[[", "predictions")), check.names = FALSE)
165
+    predictionsTable <- S4Vectors::DataFrame(sample = unlist(lapply(results, "[[", "testSet")), splitsTestInfo, do.call(rbind, lapply(results, "[[", "predictions")), check.names = FALSE)
166 166
   }
167 167
   rownames(predictionsTable) <- NULL
168 168
   tuneList <- lapply(results, "[[", "tune")
... ...
@@ -578,12 +578,12 @@
578 578
       renamedInfo[rowsAssay, "feature"] <- paste("Feature", seq_along(rowsAssay), sep = '')
579 579
       renamedInfo[rowsAssay, "assay"] <- renamedAssays[match(assay, assays)]
580 580
     }
581
-    featuresInfo <- DataFrame(originalInfo, renamedInfo)
581
+    featuresInfo <- S4Vectors::DataFrame(originalInfo, renamedInfo)
582 582
     colnames(featuresInfo) <- c("Original Assay", "Original Feature", "Renamed Assay", "Renamed Feature")
583 583
   } else {
584 584
     originalFeatures <- colnames(measurements)
585 585
     renamedInfo <- paste("Feature", seq_along(measurements), sep = '')
586
-    featuresInfo <- DataFrame(originalFeatures, renamedInfo)
586
+    featuresInfo <- S4Vectors::DataFrame(originalFeatures, renamedInfo)
587 587
     colnames(featuresInfo) <- c("Original Feature", "Renamed Feature")
588 588
   }
589 589
   featuresInfo