Learn R Programming

SPUTNIK (version 1.1)

applyPeaksFilter,msi.dataset-method: Apply the results of a peaks filter.

Description

applyPeaksFilter select the peaks returned by a peak filter. Custom filters can be created passing a named array of selected peak indices to createPeaksFilter. Names correspond to the m/z values of the selected peaks and must coincide with those of the MS dataset.

Usage

# S4 method for msi.dataset
applyPeaksFilter(object, peakFilter)

Arguments

object
peakFilter

peaks filter results.

Value

msi.dataset-class object with only selected peaks.

Examples

Run this code
# NOT RUN {
## Load package
library("SPUTNIK")

## Mass spectrometry intensity matrix
X <- matrix(rnorm(200), 20, 40)

## Print original dimensions
print(dim(X))

## m/z vector
mzVector <- seq(600, 900, by = (900 - 600) / 39)

## Read the image size
imSize <- c(5, 4)

## Construct the ms.dataset object
msiX <- msiDataset(X, mzVector, imSize[1], imSize[2])

## Calculate the p-values using the Clark Evans test, then apply Benjamini-
## Hochberg correction.
csr <- CSRPeaksFilter(msiData = msiX, method = "ClarkEvans",
                      calculateCovariate = FALSE, adjMethod = "BH")

## Print selected peaks
print(csr$q.value)

## Create a new filter selecting corrected p-values < 0.001
selIdx <- which(csr$q.value < 0.001)
csrFilter <- createPeaksFilter(selIdx)
# }

Run the code above in your browser using DataLab