corPrt: Retention Time Penalized Correlation

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/metrics.R

Description

This function calculates the similarity of all pairs of peaks from 2 samples, using the spectra similarity and the rretention time differencies

Usage

1
corPrt(d1, d2, t1, t2, D, penality=0.2)

Arguments

d1

data matrix for sample 1

d2

data matrix for sample 2

t1

vector of retention times for sample 1

t2

vector of retention times for sample 2

D

retention time window for the matching

penality

penalization applied to the matching between two mass spectra if (t1-t2)>D

Details

Computes the Pearson carrelation between every pair of peak vectors in the retention time window (D)and returns the similarity matrix.

Value

matrix of similarities

Author(s)

Riccardo Romoli

See Also

peaksAlignment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not Run
require(gcspikelite)
gcmsPath <- paste(find.package("gcspikelite"), "data", sep="/")
cdfFiles <- dir(gcmsPath,"CDF", full=TRUE)
## read data, peak detection results
pd <- peaksDataset(cdfFiles[1:3], mz=seq(50,550), rtrange=c(7.5,10.5))
pd <- addXCMSPeaks(files=cdfFiles[1:3], object=pd, peakPicking=c('mF'),
                   snthresh=3, fwhm=10,  step=0.1, steps=2, mzdiff=0.5,
                   sleep=0)
## review peak picking
plot(pd, rtrange=c(7.5, 10.5), runs=c(1:3))

r <- corPrt(pd@peaksdata[[1]], pd@peaksdata[[2]],
           pd@peaksrt[[1]], pd@peaksrt[[2]], D=50, penality=0.2)
## End (Not Run)

flagme documentation built on Nov. 8, 2020, 5:24 p.m.