msc.sample.correlation {caMassClass}R Documentation

Sample Correlation

Description

Calculates correlations between different samples and correlations between different copies of the same sample

Usage

msc.sample.correlation(X, PeaksOnly=FALSE)

Arguments

X Spectrum data either in matrix format [nFeatures x nSamples] or in 3D array format [nFeatures x nSamples x nCopies]. Row names (rownames(X)) store M/Z mass of each row.
PeaksOnly Should only peaks be used in calculating the correlation? In case of raw mass spectra data it does not make much sense to calculate correlation of "valleys" between peaks so one can set this flag to TRUE and only points above sample mean will be used.

Details

Function calculates for each copy of each sample two variables:

Value

Returns list with two components: innerCor and outerCor both of size [nSamples x nCopies].

Author(s)

Jarek Tuszynski (SAIC) jaroslaw.w.tuszynski@saic.com

See Also

Examples

   # load input data 
  if (!file.exists("Data_IMAC.Rdata")) example("msc.project.read")
  load("Data_IMAC.Rdata")
  
  # run in 3D input data using long syntax
  out = msc.mass.adjust.calc (X);
  Y   = msc.mass.adjust.apply(X, out$ShiftX, out$ScaleY, out$ShiftY)
  
  # check what happen to sample correlation
  A = msc.sample.correlation(X, PeaksOnly=TRUE)
  B = msc.sample.correlation(Y, PeaksOnly=TRUE)
  cat("Mean corelation between two copies of the same sample:\n")
  cat(" before: ", ai<-mean(A$innerCor)," after: ", bi<-mean(B$innerCor), "\n")
  cat("Mean corelation between unrelated samples:\n")
  cat(" before: ", ao<-mean(A$outerCor)," after: ", bo<-mean(B$outerCor), "\n")
  stopifnot(ao<bo, ai<bi, bo<bi, abs(bi-0.91)<0.01, abs(ao-0.75)<0.01)
 

[Package caMassClass version 1.6 Index]