This function applies
predict.randomForest
to a 'pDMP' object
provided in the argument \(newdata\).
predict(object, newdata = NULL, ...)
# S4 method for RandomForest,GRanges
predict(
object,
newdata,
type = c("class", "response", "prob", "votes"),
predict.all = FALSE,
keep.data = FALSE,
...
)
# S4 method for RandomForest,pDMP
predict(
object,
newdata,
type = c("class", "response", "prob", "votes"),
predict.all = FALSE,
keep.data = FALSE,
num.cores = 1L,
tasks = 0L,
...
)
# S4 method for randomForestformula,GRanges
predict(
object,
newdata,
type = c("class", "response", "prob", "votes"),
predict.all = FALSE,
keep.data = FALSE,
...
)
# S4 method for randomForestformulaList,GRangesList
predict(
object,
newdata,
type = c("class", "response", "prob", "votes"),
predict.all = FALSE,
keep.data = FALSE,
num.cores = 1L,
tasks = 0L,
...
)
an object of 'RandomForest-class', as that created by the
function evaluateDIMPclass
. If \(newdata\) is a
GRanges-class
, then 'newdata' must be an
element of a pDMP-class object, i.e., it must have the same structure as
the GRanges-class elements in a pDMP-class object.
A 'pDMP' object generated with function
selectDIMP
.
The same as in
predict.randomForest
.
Logical. Whether to preserve the original class from object \('newdata'\). If TRUE, then the predicted class and the posterior probability of the treatment class are added as a metacolumns of \('newdata'\).
Parameters for parallel computation using package
BiocParallel-package
: the number of cores to
use, i.e. at most how many child processes will be run simultaneously (see
bplapply
and the number of tasks per job (only
for Linux OS).
The same results as given by function
predict.randomForest
.
The generic function just call function
predict
from 'stats' R package.
If \(newdata\) is a GRanges-class
, then
'newdata' must be an element of a pDMP-class object, i.e., it must have
the same structure as the GRanges-class elements in a pDMP-class object.
## Load a DMP data set
data(dmps, package = 'MethylIT')
## Let's accomplish the classification by using Random Forest
## algorithm
perf <- evaluateDIMPclass(LR = dmps,
column = c(hdiv = TRUE, TV = TRUE,
wprob = TRUE, pos = TRUE),
classifier = 'random_forest',
n.pc = 4L,
control.names = c('C1', 'C2', 'C3'),
treatment.names = c('T1', 'T2', 'T3'),
center = FALSE,
scale = FALSE,
prop = 0.6)
predict(object = perf$model, newdata = dmps, keep.data = TRUE)
#> pDMP object of length: 6
#> -------
#> $C1
#> GRanges object with 45 ranges and 13 metadata columns:
#> seqnames ranges strand | c1 t1 c2 t2
#> <Rle> <IRanges> <Rle> | <numeric> <numeric> <numeric> <numeric>
#> [1] 1 233 - | 40 122 162 0
#> [2] 1 732 + | 50 154 200 4
#> [3] 1 1045 - | 45 115 160 0
#> [4] 1 1409 - | 44 132 176 0
#> [5] 1 1739 - | 48 145 193 0
#> ... ... ... ... . ... ... ... ...
#> [41] 1 8945 - | 37 111 148 0
#> [42] 1 9205 + | 47 144 188 3
#> [43] 1 9238 - | 156 55 0 211
#> [44] 1 9249 + | 52 138 187 3
#> [45] 1 9383 - | 40 122 162 0
#> p1 p2 TV bay.TV hdiv jdiv wprob
#> <numeric> <numeric> <numeric> <numeric> <numeric> <numeric> <numeric>
#> [1] 0.245757 0.989442 0.753086 0.743685 136.153 3.03720 0.001431041
#> [2] 0.244258 0.972183 0.735294 0.727925 150.759 2.45917 0.000747885
#> [3] 0.277937 0.989312 0.718750 0.711375 124.864 2.81337 0.002371176
#> [4] 0.248754 0.990272 0.750000 0.741518 148.040 3.06399 0.000843622
#> [5] 0.247631 0.991120 0.751295 0.743489 164.066 3.12473 0.000415743
#> ... ... ... ... ... ... ... ...
#> [41] 0.248534 0.98845689 0.750000 0.739923 122.543 2.96573 0.002631713
#> [42] 0.245127 0.97548911 0.738220 0.730362 143.991 2.53338 0.001009617
#> [43] 0.714772 0.00156955 -0.739336 -0.713202 183.531 3.79371 0.000177204
#> [44] 0.271268 0.97536149 0.710526 0.704094 134.321 2.37020 0.001552899
#> [45] 0.245757 0.98944187 0.753086 0.743685 136.153 3.03720 0.001431041
#> class posterior
#> <factor> <numeric>
#> [1] CT 0.1100
#> [2] CT 0.0050
#> [3] CT 0.0725
#> [4] CT 0.0275
#> [5] CT 0.0050
#> ... ... ...
#> [41] CT 0.1225
#> [42] CT 0.0325
#> [43] CT 0.0300
#> [44] CT 0.0550
#> [45] CT 0.1075
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
#>
#> ...
#> <5 more GRanges elements>
#> -------