Last data update: 2014.03.03

R: Base function for Spectrum Alignment
alignSpR Documentation

Base function for Spectrum Alignment

Description

Alignment of spectrum segement to the spectrum of interest

Usage

alignSp(refSp, refSegments, intSp, intSegments, recursion, MAX_DIST_FACTOR, MIN_RC)

Arguments

refSp

a vector specifying the reference spectrum

refSegments

a list characterizing the reference segments (start, end, peaks, ...)

intSp

a vector specifiying the spectrum of intrest

intSegments

a list characterizing the segment of interest (start, end, peaks, ...)

recursion

A list defining defaut values of the parameters of recursive alignment(minimal segment width, recursion step, resamblance, acceptance, ...)

MAX_DIST_FACTOR

distance matching parameter (0.5*peak width)

MIN_RC

minimum resamblance coefficient

Value

alignedSpectrum

aligned spectrum as a vector

Author(s)

Lyamine Hedjazi

See Also

align_mQTL

Examples


## 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 a test spectrum
testSegments<- segmentateSp(Sp[1,], peakParam) 

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

##Align test spectrum
attach(Segs)
SpAlg<- alignSp(refSp,refSegs,Sp[1,],testSegs,recursion,MAX_DIST_FACTOR,MIN_RC)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(mQTL.NMR)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/mQTL.NMR/alignSp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: alignSp
> ### Title: Base function for Spectrum Alignment
> ### Aliases: alignSp
> ### Keywords: function
> 
> ### ** Examples
> 
> 
> ## Data
> load_datafiles()
> Sp<-t(read.table(phenofile))
> ppm<-as.numeric(colnames(Sp))
> 
> ## Normalization
> normSp<-normalise(abs(Sp),'CS')
[1] "Start constant sum normalisation:"
> 
> ##Segmentation and matching parameters
> setupRSPA(ppm)
> 
> ##reference spectrum selection
> attach(normSp)
The following object is masked _by_ .GlobalEnv:

    Sp

> index<-selectRefSp(Sp,recursion$step)
There were 40 warnings (use warnings() to see them)
> refSp<-Sp[index,]
> 
> ##segmentate a reference spectrum
> refSegments<- segmentateSp(refSp, peakParam) 
> 
> ##segmentate a test spectrum
> testSegments<- segmentateSp(Sp[1,], peakParam) 
> 
> ##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)
> 
> ##Align test spectrum
> attach(Segs)
> SpAlg<- alignSp(refSp,refSegs,Sp[1,],testSegs,recursion,MAX_DIST_FACTOR,MIN_RC)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>