comparison lib_metams.r @ 1:708ab9928a70 draft

planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 11bb57ea2b95649ae60bd451cb21432d117a93e2
author workflow4metabolomics
date Tue, 16 Jul 2019 09:57:10 -0400
parents b60dc620bd14
children 96debae917e4
comparison
equal deleted inserted replaced
0:b60dc620bd14 1:708ab9928a70
166 cbind(if (is.null(rtcor)) object@scantime[sel$scanidx] else rtcor ,xcms:::colMax(object@env$profile[sel$massidx,sel$scanidx,drop=FALSE])) 166 cbind(if (is.null(rtcor)) object@scantime[sel$scanidx] else rtcor ,xcms:::colMax(object@env$profile[sel$massidx,sel$scanidx,drop=FALSE]))
167 } 167 }
168 168
169 getBPC2s <- function (files, xset = NULL, pdfname="BPCs.pdf", rt = c("raw","corrected"), scanrange=NULL) { 169 getBPC2s <- function (files, xset = NULL, pdfname="BPCs.pdf", rt = c("raw","corrected"), scanrange=NULL) {
170 require(xcms) 170 require(xcms)
171 171
172 #Verification for cdf files
173 stop=FALSE
174 for(i in 1:length(files)){
175 extension <- unlist(strsplit(basename(files[i]),"\\."))[length(unlist(strsplit(basename(files[i]),"\\.")))]
176 if(extension == "CDF" || extension == "cdf"){
177 stop = TRUE
178 break
179 }
180 }
181 if(stop){
182 error_message <- "You have a CDF file and there is an issue to resolve on them for chromatograms.... !"
183 print(error_message)
184 stop(error_message)
185 }
186
172 #create sampleMetadata, get sampleMetadata and class 187 #create sampleMetadata, get sampleMetadata and class
173 if(!is.null(xset)) { 188 if(!is.null(xset)) {
174 #When files come from XCMS3 directly before metaMS 189 #When files come from XCMS3 directly before metaMS
175 sampleMetadata <- xset@phenoData 190 sampleMetadata <- xset@phenoData
176 } else { 191 } else {
276 } 291 }
277 292
278 ## overlay TIC from all files in current folder or from xcmsSet, create pdf 293 ## overlay TIC from all files in current folder or from xcmsSet, create pdf
279 getTIC2s <- function(files, xset=NULL, pdfname="TICs.pdf", rt=c("raw","corrected")) { 294 getTIC2s <- function(files, xset=NULL, pdfname="TICs.pdf", rt=c("raw","corrected")) {
280 require(xcms) 295 require(xcms)
296
297 #Verification for cdf files
298 stop=FALSE
299 for(i in 1:length(files)){
300 extension <- unlist(strsplit(basename(files[i]),"\\."))[length(unlist(strsplit(basename(files[i]),"\\.")))]
301 if(extension == "CDF" || extension == "cdf"){
302 stop = TRUE
303 break
304 }
305 }
306 if(stop){
307 error_message <- "You have a CDF file and there is an issue to resolve on them for chromatograms.... !"
308 print(error_message)
309 stop(error_message)
310 }
281 311
282 #create sampleMetadata, get sampleMetadata and class 312 #create sampleMetadata, get sampleMetadata and class
283 if(!is.null(xset)){ 313 if(!is.null(xset)){
284 #When files come from XCMS3 before metaMS treatment 314 #When files come from XCMS3 before metaMS treatment
285 sampleMetadata<-xset@phenoData 315 sampleMetadata<-xset@phenoData
379 ##addition for quality control of peak picking 409 ##addition for quality control of peak picking
380 #metaMS EIC and pspectra plotting option 410 #metaMS EIC and pspectra plotting option
381 #version 20190520 411 #version 20190520
382 #only for Galaxy 412 #only for Galaxy
383 plotUnknowns<-function(resGC, unkn="", DB=NULL, fileFrom=NULL){ 413 plotUnknowns<-function(resGC, unkn="", DB=NULL, fileFrom=NULL){
414
415 #Verification for cdf files
416 stop=FALSE
417 for(i in 1:length(names(resGC$annotation))){
418 extension <- unlist(strsplit(basename(names(resGC$annotation)[i]),"\\."))[length(unlist(strsplit(basename(names(resGC$annotation)[i]),"\\.")))]
419 if(extension == "CDF" || extension == "cdf"){
420 stop = TRUE
421 break
422 }
423 }
424 if(stop){
425 error_message <- "You have a CDF file and there is an issue to resolve on them for chromatograms.... !"
426 print(error_message)
427 stop(error_message)
428 }
384 429
385 ##Annotation table each value is a pcgrp associated to the unknown 430 ##Annotation table each value is a pcgrp associated to the unknown
386 ##NOTE pcgrp index are different between xcmsSet and resGC due to filtering steps in metaMS 431 ##NOTE pcgrp index are different between xcmsSet and resGC due to filtering steps in metaMS
387 ##R. Wehrens give me some clues on that and we found a correction 432 ##R. Wehrens give me some clues on that and we found a correction
388 433