R: Concatenation of test and reference segments

attachSegments {mQTL} | R Documentation

## Concatenation of test and reference segments

### Description

Concatenation of test and reference segments to ensure one-to-one correspondence.

### Usage

    attachSegments(refSegments,testSegments)

### Arguments

`refSegments` | segments of the reference spectrum
`testSegments` | segments of the test spectrum

### Details

The algorithm:

1. For each reference segment within segment boundaries, i.e. between initial and final positions, find all centre (middle) positions of test segments and merge those segments, if more than one centre position is found

2. Apply the same procedure for each test segment

### Value

A list:

`segments$start` | start of each concatenated test segment
`segments$PeakLeftBoundary` | peak left boundary of each concatenated test segment
`segments$PeakRightBoundary` | peak right boundary of each concatenated test segment
`segments$Peaks` | peaks of each concatenated test segment
`segments$end` | end of each concatenated test segment
`segments$end` | center of each concatenated test segment

### Author(s)

Lyamine Hedjazi

### 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

`matchSegments`

### Examples

    ## Not run:

    ## Data

    Sp=matrix(rnorm(10*13454,mean=0,sd=1), nrow=10,ncol=13454)

    ##Segmentation parameters

    peakParam=list()
    peakParam$ppmDist <- 0.03# (ppm)  # distance to concatenate adjacent peaks #default 0.03#
    peakParam$ampThr <- 0.3 # amplitude value to threshold small peaks #
    peakParam$minPeakWidth <- 0.005 #min peak width in ppm scale
    peakParam$iFrameLen<-11 #Savitzky-Golay frame length in ppm scale
    peakParam$iOrder<-3 #polynomial order of Savitzky - Golay filter
    peakParam$peakEdgeMax<-0.2

    ##Reference spectrum selection

    step<-0.02 # Recursion step (default 0.02)
    index<-selectRefSp(Sp,step)
    refSp<-Sp[index,]

    #segmentate a reference spectrum

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

    #segmentate a test spectrum

    spectrum<-Sp[10,]
    testSegments<- segmentateSp(spectrum, peakParam) # segmentate test spectrum (10th sample)

    # match test and reference segments

    attachedSegs<-attachSegments(refSegments,testSegments)

    ## End(Not run)

[Package mQTL version 1.0 Index]