meanCorOl: Compute average pairwise correlation and overlapping area

Description Usage Arguments Details Value Examples

View source: R/ncGTWutility.R

Description

This function computes average pairwise correlation and overlapping area of each sample pair.

Usage

1
meanCorOl(ncGTWinput, sampleRt)

Arguments

ncGTWinput

A list in which each element is a ncGTWinput object.

sampleRt

A list of the same length as the sample number in which each element is a vector corresponding to the sample raw/adjusted RT.

Details

This function computes the pairwise correlation and overlapping area of each sample pair from the input feature, and then takes average.

Value

A list in which the first element is average pairwise correlation, and the second one is average overlapping area.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# obtain data
data('xcmsExamples')
xcmsLargeWin <- xcmsExamples$xcmsLargeWin
xcmsSmallWin <- xcmsExamples$xcmsSmallWin
ppm <- xcmsExamples$ppm

# detect misaligned features
excluGroups <- misalignDetect(xcmsLargeWin, xcmsSmallWin, ppm)

# obtain the paths of the sample files
filepath <- system.file("extdata", package = "ncGTW")
file <- list.files(filepath, pattern="mzxml", full.names=TRUE)

tempInd <- matrix(0, length(file), 1)
for (n in seq_along(file)){
    tempCha <- file[n]
    tempLen <- nchar(tempCha)
    tempInd[n] <- as.numeric(substr(tempCha, regexpr("example", tempCha) + 7,
        tempLen - 6))
}
# sort the paths by data acquisition order
file <- file[sort.int(tempInd, index.return = TRUE)$ix]

# load the sample profiles
ncGTWinputs <- loadProfile(file, excluGroups)

XCMSCor <- matrix(0, length(ncGTWinputs), 1)
XCMSOl <- matrix(0, length(ncGTWinputs), 1)
for (n in seq_along(ncGTWinputs)){
    XCMSmean <- meanCorOl(ncGTWinputs[[n]],
        slot(xcmsLargeWin, 'rt')$corrected)
    XCMSCor[n] <- XCMSmean$cor
    XCMSOl[n] <- XCMSmean$ol
}

ncGTW documentation built on Nov. 8, 2020, 8:08 p.m.