CSRPeaksFilter {SPUTNIK} | R Documentation |
Performs the peak selection based on complete spatial randomness test.
Description
CSRPeaksFilter
returns the significance for the null hypothesis that the
spatial distribution of the peak intensities follow a random pattern. A
significant p-value (q-values can be returned after applying multiple testing
correction) allows to reject the hypothesis that the spatial distribution of
a peak signal is random. The tests are performed using the functions available
in the statspat
R package.
Usage
CSRPeaksFilter(
msiData,
method = "ClarkEvans",
covariateImage = NULL,
adjMethod = "bonferroni",
returnQvalues = TRUE,
plotCovariate = FALSE,
cores = 1,
verbose = TRUE,
...
)
Arguments
msiData |
msi.dataset-class object. See msiDataset. |
method |
string (default =
|
covariateImage |
ms.image-class object. An image used as covariate (required for Kolmogorov-Smirnov test). |
adjMethod |
string (default = |
returnQvalues |
logical (default = |
plotCovariate |
logical (default = |
cores |
integer (default = 1). Number of CPU cores. Parallel computation if greater than 1. |
verbose |
logical (default = |
... |
additional parameters compatible with the |
Value
List of the p-values and adjusted p-values for the CSR test.
Author(s)
Paolo Inglese p.inglese14@imperial.ac.uk
References
Baddeley, A., & Turner, R. (2005). Spatstat: an R package for analyzing spatial point patterns. Journal of statistical software, 12(6), 1-42.
Clark, P.J. and Evans, F.C. (1954) Distance to nearest neighbour as a measure of spatial relationships in populations. Ecology 35, 445–453.
Berman, M. (1986) Testing for spatial association between a point process and another stochastic process. Applied Statistics 35, 54–62.
Examples
## Load package
library("SPUTNIK")
## Mass spectrometry intensity matrix
X <- matrix(rnorm(16000), 400, 40)
X[X < 0] <- 0
## Print original dimensions
print(dim(X))
## m/z vector
mzVector <- seq(600, 900, by = (900 - 600) / 39)
## Read the image size
imSize <- c(20, 20)
## 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)