changeset 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
files lib_metams.r
diffstat 1 files changed, 46 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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