corrPairsMSIchunks: Calculate correlations of pairs of mass peaks from MSI data...

Description Usage Arguments Details Value See Also

View source: R/corrPairsMSIchunks.R

Description

Calculate correlations of pairs of mass peaks from MSI data (imported to R with the msimat function). The list of pairs is supplied as a data.frame with the parameter pairs, but is broken up into "chunks" for processing, to avoid going over a specified memory limit.

Usage

1
2
3
corrPairsMSIchunks(d, diff, p.val = 0.05, method = c("pearson",
  "kendall", "spearman"), alternative = c("two.sided", "less",
  "greater"), ncores = NULL, mem.limit = 5, ...)

Arguments

d

msimat; MSI data with peaks as columns and pixels as rows, output from msimat function

diff

massdiff; List of mass differences, parent and putative adduct ions, as produced by function massdiff

p.val

numeric; p-value cutoff (before Bonferroni correction) (default: 0.05)

method

string; Method to use for cor.test (default: "pearson")

alternative

string; Which alternative for cor.test (default: "greater")

ncores

integer; Number of cores if using parallel version. Default is total number of cores minus one.

mem.limit

integer; Memory limit estimate (in Gb). (default: 5)

...

Other parameters to pass to cor.test

Details

This function is otherwise equivalent to corrPairsMSI with option how="parallel". It uses forking processes and is therefore not suitable for Windows systems. The memory requirement is estimated conservatively but has only been tested empirically (i.e. the process might go over the limit in practice).

Example usage scenario for this function: Mass differences for all pairwise combinations of masses are tabulated with massdiff, and the peak pairs corresponding to a specific adduct of interest are extracted with diffGetPeaks. Check which peaks are significantly correlated to each other with this function.

Correlation is calculated with cor.test function and by default uses the Pearson method (two-sided, because correlations can be both positive and negative). The Bonferroni correction is applied to the p-values before assessing significance, but the original p-value is reported in column "P.value" and can be used e.g. for false discovery rate analysis.

Value

Object of class data.frame with the following fields:

A - First peak mass in each pair

B - Second peak mass in the pair

Estimate - Estimated correlation

P.value - P-value for the correlation

Significance - Whether p-value meets cutoff (specified by "p.val", with Bonferroni correction)

See Also

corrPairsMSI function which does not split input into chunks.


kbseah/mass2adduct documentation built on June 9, 2021, 9:20 p.m.