Learn R Programming

SPUTNIK (version 1.4)

refImageContinuous: refImageContinuous returns the reference image, calculated using the refMethod. This images represents the basic measure for the filters in SPUTNIK.

Description

refImageContinuous returns the reference image, calculated using the refMethod. This images represents the basic measure for the filters in SPUTNIK.

Usage

refImageContinuous(
  msiData,
  method = "sum",
  mzQueryRef = numeric(),
  mzTolerance = Inf,
  useFullMZRef = TRUE,
  doSmooth = FALSE,
  smoothSigma = 2,
  alignTo = "detected",
  invertAligned = FALSE,
  verbose = TRUE
)

Arguments

msiData

msiDataset object..

method

string (default = "sum"). Method used to calculate the reference image. Valid values are:

  • "sum": peak intensities sum

  • "mean": average peak intensities (without zeros)

  • "median": median peak intensities (without zeros)

  • "pca": first principal component scores.

mzQueryRef

numeric. Values of m/z used to calculate the reference image. 2 values are interpreted as interval, multiple or single values are searched in the m/z vector. It overrides the param useFullMZRef.

mzTolerance

numeric (default = Inf). Tolerance in PPM to match the mzQueryRef values in the m/z vector.

useFullMZRef

logical (default = TRUE). Whether all the peaks should be used to calculate the reference image.

doSmooth

logical (default = FALSE). Whether the reference image should be smoothed before binarizing. Only valid for roiMethod = "otsu".

smoothSigma

numeric (default = 2). Standard deviation of Gaussian kernel.

alignTo

string (default = "detected"). Image used as reference for aligning the estimated reference and ROI image. Valid values are:

  • "detected": number of detected peaks

  • "tic": total-ion-count image

invertAligned

logical (default = FALSE). Whether the reference image colors should be positively or negatively correlated with the sample reference (defined by the argument alignTo). In case the sample reference is **higher** outside of the sample region, set it to TRUE.

verbose

logical (default = TRUE). Additional output text.

Author

Paolo Inglese p.inglese14@imperial.ac.uk

Details

Function to extract the continuous reference image from a msi.dataset-class object. Multiple methods can be used to extract the reference image, which afterwards can be used as argument for the globalPeaksFilter filter.

See Also

msiDataset

Examples

Run this code
## Load package
library("SPUTNIK")

## Mass spectrometry intensity matrix
X <- matrix(rnorm(200), 20, 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(5, 4)

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

## Calculate the reference and ROI images from the ms.dataset-class object msiX.
## The reference is calculated as the first principal component scores scaled
## in [0, 1]; the binary ROI is calculated applying k-means on the entire dataset.
## Use only m/z values in the range of [700, 900]. The interval extremal values
## are matched within a tolerance of 50 ppm.

refImg <- refImageContinuous(msiX, method = "sum")
roiImg <- refImageBinaryOtsu(refImg)

## Plot the reference and region of interest ROI
## plot(ref.roi$Reference)
## plot(ref.roi$ROI)

Run the code above in your browser using DataLab