-
Notifications
You must be signed in to change notification settings - Fork 6
/
Camera_Function.R
46 lines (29 loc) · 1.29 KB
/
Camera_Function.R
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
36
37
38
39
40
41
42
43
44
45
46
#title: "Camera_Function"
#author: "Laura Hmelo"
#date: "December 19, 2016"
#This function processes an xcmsSet object using CAMERA to identify mass features which are related to one another as adducts or isotopomers.
#
#Input:
#1. a processed xset object from xcmsfunction. Should be called xset3.
#
#Output:
#1. A list (CAMERAlist) containing [[1]] a processed peak list containing information about adducts, isotopes and neutral masses (xset.annot) and [[2]], a CAMERA object (xsaFA).
#Mode is "positive" or "negative". Default is positive
#setwd(outputpath)
camera <- function(xset, Polarity ="positive", PPM = 5) {
library(CAMERA)
library(snow)
xsa <- xsAnnotate(xset)
xsaF <- groupFWHM(xsa, perfwhm = 0.6)
# peak group verification with peakshape correlation (groupCorr); slow step----
xsaC <- groupCorr(xsaF)
#annotation of possible isotopes (findIsotopes)----
xsaFI <- findIsotopes(xsaC, ppm = PPM)
#annotation of adducts and calculating hypothetical masses for the group; very slow step----
#use xsaFA object to visualize EICs
xsaFA <- findAdducts(xsaFI, ppm = PPM, polarity = Polarity)
# Make a table of the annotated peaks-------
xset.annot <- getPeaklist(xsaFA)
CAMERAlist <- list(xset.annot, xsaFA)
return(invisible(CAMERAlist))
}