Learn R Programming

pRoloc (version 1.12.4)

filterBinMSnSet: Filter a binary MSnSet

Description

Removes columns or rows that have a certain proportion or absolute number of 0 values.

Usage

filterBinMSnSet(object, MARGIN = 2, t, q, verbose = TRUE)

Arguments

object
An MSnSet
MARGIN
1 or 2. Default is 2.
t
Rows/columns that have t or less 1s, it will be filtered out. When t and q are missing, default is to use t = 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 is TRUE.

Value

A filtered MSnSet.

Examples

Run this code
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)
## Remove columns with no 1s
exprs(filterBinMSnSet(x, MARGIN = 2, t = 0))
## Remove columns with one 1 or less
exprs(filterBinMSnSet(x, MARGIN = 2, t = 1))
## Remove columns with two 1s or less
exprs(filterBinMSnSet(x, MARGIN = 2, t = 2))
## Remove columns with three 1s 
exprs(filterBinMSnSet(x, MARGIN = 2, t = 3))
## Remove columns that have half or less of 1s
exprs(filterBinMSnSet(x, MARGIN = 2, q = 0.5))

Run the code above in your browser using DataLab