This function extracts a stratified sample of an MSnSet
.
Arguments
- object
An instance of class
MSnSet
- fcol
The feature meta-data column name containing the marker (vector or matrix) definitions on which the MSnSet will be stratified. Default is
markers
.- size
The size of the stratified sample to be extracted. Default is 0.2 (20 percent).
- seed
The optional random number generator seed.
Value
A stratified sample (according to the defined fcol
)
which is an instance of class "MSnSet"
.
See also
testMSnSet
unknownMSnSet
markerMSnSet
. See markers
for details
about markers encoding.
Examples
library(pRolocdata)
data(tan2009r1)
dim(tan2009r1)
#> [1] 888 4
smp <- sampleMSnSet(tan2009r1, fcol = "markers")
#> Warning: New sample contains classes with < 6 markers
dim(smp)
#> [1] 182 4
getMarkers(tan2009r1)
#> organelleMarkers
#> Cytoskeleton ER Golgi Lysosome Nucleus
#> 7 28 13 8 21
#> PM Peroxisome Proteasome Ribosome 40S Ribosome 60S
#> 34 4 15 20 32
#> mitochondrion unknown
#> 29 677
getMarkers(smp)
#> organelleMarkers
#> Cytoskeleton ER Golgi Lysosome Nucleus
#> 2 6 3 2 5
#> PM Peroxisome Proteasome Ribosome 40S Ribosome 60S
#> 7 1 3 4 7
#> mitochondrion unknown
#> 6 136