Learn R Programming

mQTL.NMR (version 1.6.0)

matchSegments: Matching the segment of interest to the corresponding reference

Description

The algorithm makes use of a fuzzy logic approach to match the segment of interest to the corresponding reference

Usage

matchSegments(refSp, intSp, intSegments, refSegments, MAX_DIST_FACTOR, MIN_RC)

Arguments

refSp
a vector specifying the spectrum of reference
intSp
a vector specifying the spetcrum of interest (test spectrum)
intSegments
a list characterizing the segments of spectrum of interest
refSegments
a list characterizing the segments of the reference spectrum (start, end, peaks, center)
MAX_DIST_FACTOR
distance matching parameter (0.5*peak_width)
MIN_RC
minimum resamblance coefficient

Value

A list:
testSegs
a list characterizing the matched test segments
refSegs
a list characterizing the matched reference segments

Details

Algorithm:
  1. pick-up segment of interest
  2. pick-up reference segments
  3. calculate relative distance between them
  4. calculate relative resamblance between them
  5. find min value of relative distance and resamblance
  6. use it as representative of similiarity between target and reference segments
  7. find the segment that has the highest value of both relative distance and resamblance

References

Veselkov,K. et al (2009) Recursive Segment-Wise Peak Alignment of Biological 1H NMR Spectra for Improved Metabolic Biomarker Recovery, Anal. Chem., 81(1), 56-66.

See Also

attachSegments

Examples

Run this code

## Data
load_datafiles()
Sp<-t(read.table(phenofile))
ppm<-as.numeric(colnames(Sp))

## Normalization
normSp<-normalise(abs(Sp),'CS')

##Segmentation and matching parameters
setupRSPA(ppm)

##reference spectrum selection
attach(normSp)
index<-selectRefSp(Sp,recursion$step)
refSp<-Sp[index,]

##segmentate a reference spectrum
refSegments<- segmentateSp(refSp, peakParam) # segmentate reference spectrum

##segmentate a test spectrum
testSegments<- segmentateSp(Sp[1,], peakParam) # segmentate test spectrum (1st sample)

##attach test and reference segments
attachedSegs<-attachSegments(refSegments,testSegments)

##Match test and reference segments
attach(attachedSegs)
Segs<-matchSegments(refSp,Sp[1,],testSegmentsNew,refSegmentsNew,MAX_DIST_FACTOR, MIN_RC)

Run the code above in your browser using DataLab