...
|
...
|
@@ -256,12 +256,19 @@ input data. Autmomatically reducing to smaller number.")
|
256
|
256
|
{
|
257
|
257
|
if(is.null(modellingParams@trainParams@getFeatures))
|
258
|
258
|
selectedFeatures <- originalFeatures[selectedFeaturesIndices]
|
259
|
|
- else selectedFeatures <- colnames(measurementsTrain)[rankedFeaturesIndices]
|
|
259
|
+ else selectedFeatures <- colnames(measurementsTrain)[selectedFeaturesIndices]
|
260
|
260
|
} else {
|
261
|
261
|
featureColumns <- na.omit(match(c("assay", "feature"), colnames(S4Vectors::mcols(measurementsTrain))))
|
262
|
|
- if(is.null(modellingParams@trainParams@getFeatures))
|
263
|
|
- selectedFeatures <- originalFeatures[selectedFeaturesIndices, ]
|
264
|
|
- else selectedFeatures <- S4Vectors::mcols(measurementsTrain)[selectedFeaturesIndices, featureColumns]
|
|
262
|
+ if(length(featureColumns) == 1)
|
|
263
|
+ {
|
|
264
|
+ if(is.null(modellingParams@trainParams@getFeatures))
|
|
265
|
+ selectedFeatures <- originalFeatures[selectedFeaturesIndices]
|
|
266
|
+ else selectedFeatures <- S4Vectors::mcols(measurementsTrain)[selectedFeaturesIndices, featureColumns]
|
|
267
|
+ } else {
|
|
268
|
+ if(is.null(modellingParams@trainParams@getFeatures))
|
|
269
|
+ selectedFeatures <- originalFeatures[selectedFeaturesIndices, ]
|
|
270
|
+ else selectedFeatures <- S4Vectors::mcols(measurementsTrain)[selectedFeaturesIndices, featureColumns]
|
|
271
|
+ }
|
265
|
272
|
}
|
266
|
273
|
importanceTable <- S4Vectors::DataFrame(selectedFeatures, performanceChanges)
|
267
|
274
|
if(ncol(importanceTable) == 2) colnames(importanceTable)[1] <- "feature"
|
...
|
...
|
@@ -272,6 +279,7 @@ input data. Autmomatically reducing to smaller number.")
|
272
|
279
|
if(!is.null(tuneDetailsSelect)) tuneDetails <- tuneDetailsSelect else tuneDetails <- tuneDetailsTrain
|
273
|
280
|
|
274
|
281
|
# Convert back into original, potentially unsafe feature identifiers unless it is a nested cross-validation.
|
|
282
|
+
|
275
|
283
|
if(is.null(.iteration) || .iteration != "internal")
|
276
|
284
|
{
|
277
|
285
|
if(!is.null(rankedFeaturesIndices))
|
...
|
...
|
@@ -283,9 +291,16 @@ input data. Autmomatically reducing to smaller number.")
|
283
|
291
|
else rankedFeatures <- colnames(measurementsTrain)[rankedFeaturesIndices]
|
284
|
292
|
} else {
|
285
|
293
|
featureColumns <- na.omit(match(c("assay", "feature"), colnames(S4Vectors::mcols(measurementsTrain))))
|
286
|
|
- if(is.null(modellingParams@trainParams@getFeatures))
|
287
|
|
- rankedFeatures <- originalFeatures[rankedFeaturesIndices, ]
|
288
|
|
- else rankedFeatures <- S4Vectors::mcols(measurementsTrain)[rankedFeaturesIndices, featureColumns]
|
|
294
|
+ if(length(featureColumns) == 1)
|
|
295
|
+ {
|
|
296
|
+ if(is.null(modellingParams@trainParams@getFeatures))
|
|
297
|
+ rankedFeatures <- originalFeatures[rankedFeaturesIndices]
|
|
298
|
+ else rankedFeatures <- S4Vectors::mcols(measurementsTrain)[rankedFeaturesIndices, featureColumns]
|
|
299
|
+ } else {
|
|
300
|
+ if(is.null(modellingParams@trainParams@getFeatures))
|
|
301
|
+ rankedFeatures <- originalFeatures[rankedFeaturesIndices, ]
|
|
302
|
+ else rankedFeatures <- S4Vectors::mcols(measurementsTrain)[rankedFeaturesIndices, featureColumns]
|
|
303
|
+ }
|
289
|
304
|
}
|
290
|
305
|
} else { rankedFeatures <- NULL}
|
291
|
306
|
if(!is.null(selectedFeaturesIndices))
|
...
|
...
|
@@ -297,9 +312,16 @@ input data. Autmomatically reducing to smaller number.")
|
297
|
312
|
else selectedFeatures <- colnames(measurementsTrain)[selectedFeaturesIndices]
|
298
|
313
|
} else {
|
299
|
314
|
featureColumns <- na.omit(match(c("assay", "feature"), colnames(S4Vectors::mcols(measurementsTrain))))
|
300
|
|
- if(is.null(modellingParams@trainParams@getFeatures))
|
301
|
|
- selectedFeatures <- originalFeatures[selectedFeaturesIndices, ]
|
302
|
|
- else selectedFeatures <- S4Vectors::mcols(measurementsTrain)[selectedFeaturesIndices, featureColumns]
|
|
315
|
+ if(length(featureColumns) == 1)
|
|
316
|
+ {
|
|
317
|
+ if(is.null(modellingParams@trainParams@getFeatures))
|
|
318
|
+ selectedFeatures <- originalFeatures[selectedFeaturesIndices]
|
|
319
|
+ else selectedFeatures <- S4Vectors::mcols(measurementsTrain)[selectedFeaturesIndices, featureColumns]
|
|
320
|
+ } else {
|
|
321
|
+ if(is.null(modellingParams@trainParams@getFeatures))
|
|
322
|
+ selectedFeatures <- originalFeatures[selectedFeaturesIndices, ]
|
|
323
|
+ else selectedFeatures <- S4Vectors::mcols(measurementsTrain)[selectedFeaturesIndices, featureColumns]
|
|
324
|
+ }
|
303
|
325
|
}
|
304
|
326
|
} else { selectedFeatures <- NULL}
|
305
|
327
|
} else { # Nested use in feature selection. No feature selection in inner execution, so ignore features.
|