-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre_process.R
79 lines (69 loc) · 2.78 KB
/
pre_process.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
install.packages ("remotes")
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true")
remotes::install_github("https://github.com/andzajan/mzmatch.R.git",
build_opts=c("--no-multiarch"), INSTALL_opts=c("--no-test-load"))
library(mzmatch.R)
mzmatch.init(version.1=FALSE)
dir_base = 'D:/LCMS data processing'
samples = c('m1146_25',
'm1152_10',
'm1152_21',
'm145_10',
'm145_15',
'm145_21',
'm145_25',
'tk24_10',
'tk24_15',
'tk24_21',
'tk24_25'
)
#sample = "m145_10"
for (sample in samples) {
setwd(paste(dir_base, '/', sample, sep = ''))
tsv_file = paste(sample,"_sample_setup.tsv", sep = '')
mzmatch.R.Setup(projectFolder= getwd(),
samplelist=tsv_file)
xseto <- xcmsSet(sampleList$filenames,
method='centWave',
ppm=50,
peakwidth=c(10,60),
snthresh=6,
mzdiff=0.01,
integrate=1,
prefilter=c(3,100),
#from xcms params
noise = 0,
verbose.columns=TRUE,
fitgauss=FALSE,
nSlaves=2)
PeakML.xcms.write.SingleMeasurement(xset=xseto,
filename=sampleList$outputfilenames,
ionisation="negative",
ppm=50,
addscans=0
)
mzmatch.R.Setup(projectFolder=getwd(),
samplelist=tsv_file,
outputfolder="peakml_RTcorr")
xset2<-retcor(xseto,
method="obiwarp",
profStep=0.01,
center=3)
PeakML.xcms.write.SingleMeasurement(xset=xset2,
filename=sampleList$outputfilenames,
ionisation="negative",
ppm=50,
addscans=0,
)
mzmatch.ipeak.Combine(sampleList=sampleList,
rtwindow=60,
combination="set",
ppm=50,
v=T,#
nSlaves=2,
outputfolder="combined_RTcorr")
inputfile = paste(getwd(), '/combined_RTcorr/', sample, '.peakml', sep='')
output_file = paste(getwd(), '/combined_RTcorr/', sample, '.txt', sep='')
mzmatch.ipeak.convert.ConvertToText (i = inputfile,
o = output_file)
}