group.nearest: Group peaks from different samples together

Description Arguments Value Methods See Also Examples

Description

Group peaks together across samples by creating a master peak list and assigning corresponding peaks from all samples. It is inspired by the alignment algorithm of mzMine. For further details check http://mzmine.sourceforge.net/ and

Katajamaa M, Miettinen J, Oresic M: MZmine: Toolbox for processing and visualization of mass spectrometry based molecular profile data. Bioinformatics (Oxford, England) 2006, 22:634?636.

Currently, there is no equivalent to minfrac or minsamp.

Arguments

object

the xcmsSet object

mzVsRTbalance

Multiplicator for mz value before calculating the (euclidean) distance between two peaks.

mzCheck

Maximum tolerated distance for mz.

rtCheck

Maximum tolerated distance for RT.

kNN

Number of nearest Neighbours to check

Value

An xcmsSet object with peak group assignments and statistics.

Methods

object = "xcmsSet"

group(object, mzVsRTbalance=10, mzCheck=0.2, rtCheck=15, kNN=10)

See Also

xcmsSet-class, group.density and group.mzClust

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
35
	## Not run: library(xcms)
		library(faahKO) ## These files do not have this problem to correct for but just for an example
		cdfpath <- system.file("cdf", package = "faahKO")
		cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE)

		xset<-xcmsSet(cdffiles)

		gxset<-group(xset, method="nearest")
		## this is the same as
		# gxset<-group.nearest(xset)
		nrow(gxset@groups) == 1096 ## the number of features before minFrac

		post.minFrac<-function(object, minFrac=0.5){
			ix.minFrac<-sapply(1:length(unique(sampclass(object))), function(x, object, mf){
				meta<-groups(object)
				minFrac.idx<-numeric(length=nrow(meta))
				idx<-which(meta[,levels(sampclass(object))[x]] >= mf*length(which(levels(sampclass(object))[x] == sampclass(object)) ))
				minFrac.idx[idx]<-1
				return(minFrac.idx)
			}, object, minFrac)
			ix.minFrac<-as.logical(apply(ix.minFrac, 1, sum))
			ix<-which(ix.minFrac == TRUE)
			return(ix)
		}

		## using the above function we can get a post processing minFrac
		idx<-post.minFrac(gxset)

		gxset.post<-gxset ## copy the xcmsSet object
		gxset.post@groupidx<-gxset@groupidx[idx]
		gxset.post@groups<-gxset@groups[idx,]

		nrow(gxset.post@groups) == 465 ## this is the number of features after minFrac
	
## End(Not run)

sneumann/xcms-presvnbridge documentation built on May 30, 2019, 6:02 a.m.