Removes columns or rows that have a certain proportion or absolute number of 0 values.
Arguments
- object
An
MSnSet
- MARGIN
1 or 2. Default is 2.
- t
Rows/columns that have
t
or less1
s, it will be filtered out. Whent
andq
are missing, default is to uset = 1
.- q
If a row has a higher quantile than defined by
q
, it will be filtered out.- verbose
A
logical
defining of a message is to be printed. Default isTRUE
.
Examples
set.seed(1)
m <- matrix(sample(0:1, 25, replace=TRUE), 5)
m[1, ] <- 0
m[, 1] <- 0
rownames(m) <- colnames(m) <- letters[1:5]
fd <- data.frame(row.names = letters[1:5])
x <- MSnSet(exprs = m, fData = fd, pData = fd)
exprs(x)
#> a b c d e
#> a 0 0 0 0 0
#> b 0 0 0 1 0
#> c 0 0 0 1 0
#> d 0 1 0 1 0
#> e 0 1 0 0 0
## Remove columns with no 1s
exprs(filterBinMSnSet(x, MARGIN = 2, t = 0))
#> Removing 3 column(s)
#> b d
#> a 0 0
#> b 0 1
#> c 0 1
#> d 1 1
#> e 1 0
## Remove columns with one 1 or less
exprs(filterBinMSnSet(x, MARGIN = 2, t = 1))
#> Removing 3 column(s)
#> b d
#> a 0 0
#> b 0 1
#> c 0 1
#> d 1 1
#> e 1 0
## Remove columns with two 1s or less
exprs(filterBinMSnSet(x, MARGIN = 2, t = 2))
#> Removing 4 column(s)
#> d
#> a 0
#> b 1
#> c 1
#> d 1
#> e 0
## Remove columns with three 1s
exprs(filterBinMSnSet(x, MARGIN = 2, t = 3))
#> Removing 5 column(s)
#>
#> a
#> b
#> c
#> d
#> e
## Remove columns that have half or less of 1s
exprs(filterBinMSnSet(x, MARGIN = 2, q = 0.5))
#> Removing 3 column(s)
#> b d
#> a 0 0
#> b 0 1
#> c 0 1
#> d 1 1
#> e 1 0