# HG changeset patch # User workflow4metabolomics # Date 1563285430 14400 # Node ID 708ab9928a70c0ac44368f2f84633b6377413ce8 # Parent b60dc620bd14d7944a465b52fa6a2f35a6f36ea6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 11bb57ea2b95649ae60bd451cb21432d117a93e2 diff -r b60dc620bd14 -r 708ab9928a70 lib_metams.r --- a/lib_metams.r Wed Jul 03 05:08:14 2019 -0400 +++ b/lib_metams.r Tue Jul 16 09:57:10 2019 -0400 @@ -168,7 +168,22 @@ getBPC2s <- function (files, xset = NULL, pdfname="BPCs.pdf", rt = c("raw","corrected"), scanrange=NULL) { require(xcms) - + + #Verification for cdf files + stop=FALSE + for(i in 1:length(files)){ + extension <- unlist(strsplit(basename(files[i]),"\\."))[length(unlist(strsplit(basename(files[i]),"\\.")))] + if(extension == "CDF" || extension == "cdf"){ + stop = TRUE + break + } + } + if(stop){ + error_message <- "You have a CDF file and there is an issue to resolve on them for chromatograms.... !" + print(error_message) + stop(error_message) + } + #create sampleMetadata, get sampleMetadata and class if(!is.null(xset)) { #When files come from XCMS3 directly before metaMS @@ -279,6 +294,21 @@ getTIC2s <- function(files, xset=NULL, pdfname="TICs.pdf", rt=c("raw","corrected")) { require(xcms) + #Verification for cdf files + stop=FALSE + for(i in 1:length(files)){ + extension <- unlist(strsplit(basename(files[i]),"\\."))[length(unlist(strsplit(basename(files[i]),"\\.")))] + if(extension == "CDF" || extension == "cdf"){ + stop = TRUE + break + } + } + if(stop){ + error_message <- "You have a CDF file and there is an issue to resolve on them for chromatograms.... !" + print(error_message) + stop(error_message) + } + #create sampleMetadata, get sampleMetadata and class if(!is.null(xset)){ #When files come from XCMS3 before metaMS treatment @@ -382,6 +412,21 @@ #only for Galaxy plotUnknowns<-function(resGC, unkn="", DB=NULL, fileFrom=NULL){ + #Verification for cdf files + stop=FALSE + for(i in 1:length(names(resGC$annotation))){ + extension <- unlist(strsplit(basename(names(resGC$annotation)[i]),"\\."))[length(unlist(strsplit(basename(names(resGC$annotation)[i]),"\\.")))] + if(extension == "CDF" || extension == "cdf"){ + stop = TRUE + break + } + } + if(stop){ + error_message <- "You have a CDF file and there is an issue to resolve on them for chromatograms.... !" + print(error_message) + stop(error_message) + } + ##Annotation table each value is a pcgrp associated to the unknown ##NOTE pcgrp index are different between xcmsSet and resGC due to filtering steps in metaMS ##R. Wehrens give me some clues on that and we found a correction