1
XCMS / Re: export XCMS2 fragments
Thanks for the suggestion, i will look into your xcms3 in github,
Regards,
Goh.
This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.
#Load all libraries
library(xcms)
#Create and spacify filepath
path <- "G:/msms"
files <- list.files(path, full.names=TRUE, pattern="cp.mzXML", recursive = TRUE)
xrawctrl <- xcmsRaw(files[1], includeMSn = TRUE)
peaks <- findPeaks(xrawctrl, method="MS1")
xs <- xcmsSet(files, method="MS1")
xfrag <- xcmsFragments(xs)
> xfrag
An "xcmsFragments" object with 5819 peaks in 912 Spectra
From Level 1 to 2 Number of Samples: 1 .
Sample 1 :
646 Peaks in Level 1
5173 Peaks in Level 2
Memory usage: 0.402 MB
xfragdata <- groupval(xfrag, value = "into")
write.csv(xfrag, file="xfrag.csv")
> xset2 <- retcor(
+ xset,
+ method = "obiwarp",
+ profStep = 1,
+ plottype = "deviation",
+ center = NULL,
+ col = NULL,
+ ty = NULL,
+ response = 1,
+ distFun = "cor_opt",
+ gapInit = NULL,
+ factorDiag = 2,
+ factorGap = 1,
+ localAlignment = 0,
+ initPenalty = 0)
center sample:
Processing: Error in if (!file.exists(object)) stop("xcmsSource: file not found: ", :
argument is of length zero
> traceback()
11: .local(object, ...)
10: xcmsSource(filename)
9: xcmsSource(filename)
8: xcmsRaw(object@filepaths[center], profmethod = "bin", profstep = 0)
7: .local(object, ...)
6: retcor.obiwarp(object, ...)
5: retcor.obiwarp(object, ...)
4: do.call(method, alist(object, ...))
3: .local(object, ...)
2: retcor(xset, method = "obiwarp", profStep = 1, plottype = "deviation",
center = NULL, col = NULL, ty = NULL, response = 1, distFun = "cor_opt",
gapInit = NULL, factorDiag = 2, factorGap = 1, localAlignment = 0,
initPenalty = 0)
1: retcor(xset, method = "obiwarp", profStep = 1, plottype = "deviation",
center = NULL, col = NULL, ty = NULL, response = 1, distFun = "cor_opt",
gapInit = NULL, factorDiag = 2, factorGap = 1, localAlignment = 0,
initPenalty = 0)
> str(xset, max.level = 2)
Formal class 'xcmsSet' [package "xcms"] with 15 slots
..@ peaks : num [1:6117, 1:11] 379 421 397 471 235 ...
.. ..- attr(*, "dimnames")=List of 2
..@ groups : num [1:116, 1:9] 181 236 249 255 279 ...
.. ..- attr(*, "dimnames")=List of 2
..@ groupidx :List of 116
..@ filled : int(0)
..@ phenoData :'data.frame': 46 obs. of 1 variable:
..@ rt :List of 2
..@ filepaths : chr [1:46] "G:/tissue/mzxml/np/neg/CASE/D N 1.mzXML" "G:/tissue/mzxml/np/neg/CASE/D N 2.mzXML" "G:/tissue/mzxml/np/neg/CASE/D N 3.mzXML" "G:/tissue/mzxml/np/neg/CASE/DN 4.mzXML" ...
..@ profinfo :List of 2
..@ dataCorrection : int(0)
..@ polarity : chr(0)
..@ progressInfo :List of 15
..@ progressCallback:function (progress)
..@ mslevel : num(0)
..@ scanrange : num(0)
..@ .processHistory :List of 46
> head(xset@peaks)
mz mzmin mzmax rt rtmin rtmax
[1,] 379.1944 379.1942 379.1948 97.324 79.794 112.823
[2,] 421.2051 421.2044 421.2053 108.454 87.215 119.562
[3,] 397.1605 397.1600 397.1609 112.486 92.272 124.966
[4,] 471.1973 471.1968 471.1977 112.823 92.609 121.588
[5,] 235.1809 235.1807 235.1810 120.573 105.423 128.338
[6,] 463.2157 463.2154 463.2162 121.249 108.454 129.683
into intb maxo sn sample
[1,] 63585.88 63243.50 18469 281 1
[2,] 126455.21 125712.75 20504 184 1
[3,] 112149.18 112028.20 16132 697 1
[4,] 111377.42 111166.17 19105 354 1
[5,] 128713.22 128676.36 31172 1242 1
[6,] 62646.78 62619.22 10310 509 1
>
> #RUN RETENTION TIME CORRECTION
> xset2 <- retcor(
+ xset,
+ method = "obiwarp",
+ profStep = 1,
+ plottype = c("none","deviation"),
+ centerSample = NULL,
+ col = NULL,
+ ty = NULL,
+ response = 1,
+ distFun = "cor_opt",
+ gapInit = NULL,
+ factorDiag = 2,
+ factorGap = 1,
+ localAlignment = 0,
+ initPenalty = 0)
Error in .local(object, ...) : unused argument (centerSample = NULL)
> #RUN RETENTION TIME CORRECTION
> xset2 <- retcor(
+ xset,
+ method = "obiwarp",
+ profStep = 1,
+ plottype = c("none","deviation"),
+ center = NULL,
+ col = NULL,
+ ty = NULL,
+ response = 1,
+ distFun = "cor_opt",
+ gapInit = NULL,
+ factorDiag = 2,
+ factorGap = 1,
+ localAlignment = 0,
+ initPenalty = 0)
center sample:
Processing: Error in if (!file.exists(object)) stop("xcmsSource: file not found: ", :
argument is of length zero
> xset
An "xcmsSet" object with 46 samples
Time range: 97.3-756.4 seconds (1.6-12.6 minutes)
Mass range: 105.0697-975.5754 m/z
Peaks: 6117 (about 133 per sample)
Peak Groups: 116
Sample classes: CASE, CONTROL
Feature detection:
o Peak picking performed on MS1.
Profile settings: method = bin
step = 0.1
Memory usage: 2.29 MB
> xset2 <- retcor(
+ xset,
+ method = "obiwarp",
+ profStep = 1,
+ family = "symmetric",
+ plottype = "mdevden",
+ )
Error in .local(object, ...) : unused argument (family = "symmetric")
>
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_Malaysia.1252
[2] LC_CTYPE=English_Malaysia.1252
[3] LC_MONETARY=English_Malaysia.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_Malaysia.1252
attached base packages:
[1] parallel stats graphics grDevices utils
[6] datasets methods base
other attached packages:
[1] magrittr_1.5 pander_0.6.1
[3] RColorBrewer_1.1-2 faahKO_1.20.0
[5] xcms_3.2.0 MSnbase_2.6.1
[7] ProtGenerics_1.12.0 mzR_2.14.0
[9] Rcpp_0.12.17 BiocParallel_1.14.1
[11] Biobase_2.40.0 BiocGenerics_0.26.0
loaded via a namespace (and not attached):
[1] BiocInstaller_1.30.0 compiler_3.5.1
[3] pillar_1.2.3 plyr_1.8.4
[5] iterators_1.0.9 zlibbioc_1.26.0
[7] tools_3.5.1 MALDIquant_1.17
[9] digest_0.6.15 evaluate_0.10.1
[11] tibble_1.4.2 preprocessCore_1.42.0
[13] gtable_0.2.0 lattice_0.20-35
[15] rlang_0.2.1 Matrix_1.2-14
[17] foreach_1.4.4 yaml_2.1.19
[19] stringr_1.3.1 knitr_1.20
[21] IRanges_2.14.10 S4Vectors_0.18.3
[23] multtest_2.36.0 stats4_3.5.1
[25] rprojroot_1.3-2 grid_3.5.1
[27] impute_1.54.0 snow_0.4-2
[29] survival_2.42-3 XML_3.98-1.11
[31] RANN_2.5.1 rmarkdown_1.10
[33] limma_3.36.2 ggplot2_3.0.0
[35] splines_3.5.1 backports_1.1.2
[37] scales_0.5.0 pcaMethods_1.72.0
[39] codetools_0.2-15 htmltools_0.3.6
[41] MASS_7.3-50 MassSpecWavelet_1.46.0
[43] mzID_1.18.0 BiocStyle_2.8.2
[45] colorspace_1.3-2 affy_1.58.0
[47] stringi_1.1.7 doParallel_1.0.11
[49] lazyeval_0.2.1 munsell_0.5.0
[51] vsn_3.48.1 affyio_1.50.0
> xset2 <- retcor(
+ xset,
+ method = "obiwarp",
+ profStep = 1,
+ plottype = "mdevden"
+ )
Error in match.arg(plottype) : 'arg' should be one of “none”, “deviation”
>
library(BiocStyle)
library(multtest)
library(xcms)
path <- "G://mzxml/np/neg"
files <- system.file(path, full.names=TRUE, pattern="mzxml", recursive = TRUE)
xset <- xcmsSet(files,
method="centWave",
ppm = 10,
peakwidth = c(20, 50),
snthresh = 6,
prefilter = c(3, 100),
integrate = 1,
mzdiff = 0.01
)
Error in if (any(info$isdir)) { : missing value where TRUE/FALSE needed