comparison xcms_xcmsSet.r @ 33:c363b9f1caef draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
author lecorguille
date Mon, 05 Mar 2018 04:15:34 -0500
parents 2bf1cb023c94
children efd23113d5f4
comparison
equal deleted inserted replaced
32:2bf1cb023c94 33:c363b9f1caef
35 BPPARAM <- MulticoreParam(args$BPPARAM); args$BPPARAM <- NULL 35 BPPARAM <- MulticoreParam(args$BPPARAM); args$BPPARAM <- NULL
36 } 36 }
37 register(BPPARAM) 37 register(BPPARAM)
38 38
39 #saving the specific parameters 39 #saving the specific parameters
40 if (!is.null(args$filterAcquisitionNum)){
41 filterAcquisitionNumParam <- args$filterAcquisitionNum; args$filterAcquisitionNum <- NULL
42 }
43 if (!is.null(args$filterRt)){
44 filterRtParam <- args$filterRt; args$filterRt <- NULL
45 }
46 if (!is.null(args$filterMz)){
47 filterMzParam <- args$filterMz; args$filterMz <- NULL
48 }
49
40 method <- args$method; args$method <- NULL 50 method <- args$method; args$method <- NULL
41 51
42 cat("\n\n") 52 cat("\n\n")
43 53
44 # ----- INFILE PROCESSING ----- 54 # ----- INFILE PROCESSING -----
78 print(pd) 88 print(pd)
79 89
80 cat("\t\t\tLoad Raw Data\n") 90 cat("\t\t\tLoad Raw Data\n")
81 raw_data <- readMSData(files=files, pdata = new("NAnnotatedDataFrame", pd), mode="onDisk") 91 raw_data <- readMSData(files=files, pdata = new("NAnnotatedDataFrame", pd), mode="onDisk")
82 92
93 cat("\t\t\tApply filter[s] (if asked)\n")
94 if (exists("filterAcquisitionNumParam")) {
95 raw_data <- filterAcquisitionNum(raw_data, filterAcquisitionNumParam[1]:filterAcquisitionNumParam[2])
96 }
97 if (exists("filterRtParam")) {
98 raw_data <- filterRt(raw_data, filterRtParam)
99 }
100 if (exists("filterMzParam")) {
101 raw_data <- filterMz(raw_data, filterMzParam)
102 }
103
83 cat("\t\t\tChromatographic peak detection\n") 104 cat("\t\t\tChromatographic peak detection\n")
84 findChromPeaksParam <- do.call(paste0(method,"Param"), args) 105 findChromPeaksParam <- do.call(paste0(method,"Param"), args)
85 print(findChromPeaksParam) 106 print(findChromPeaksParam)
86 xdata <- findChromPeaks(raw_data, param=findChromPeaksParam) 107 xdata <- findChromPeaks(raw_data, param=findChromPeaksParam)
87 108
88 # Check if there are no peaks 109 # Check if there are no peaks
89 if (nrow(chromPeaks(xdata)) == 0) stop("No peaks were detected. You should review your settings") 110 if (nrow(chromPeaks(xdata)) == 0) stop("No peaks were detected. You should review your settings")
90 111
91 # Transform the files absolute pathways into relative pathways 112 # Transform the files absolute pathways into relative pathways
92 xdata@processingData@files <- sub(paste(getwd(), "/", sep="") , "", xdata@processingData@files) 113 xdata@processingData@files <- sub(paste(getwd(), "/", sep="") , "", xdata@processingData@files)
93 save.image() 114
94 # Create a sampleMetada file 115 # Create a sampleMetada file
95 sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv") 116 sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv")
96 117
97 # Get the legacy xcmsSet object 118 # Get the legacy xcmsSet object
98 xset <- getxcmsSetObject(xdata) 119 xset <- getxcmsSetObject(xdata)