diff purityX.R @ 9:3d92b95cf6c0 draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
author computational-metabolomics
date Thu, 13 Jun 2024 11:38:36 +0000
parents b91b9492a4bf
children b80cc0382e70
line wrap: on
line diff
--- a/purityX.R	Wed Jun 12 16:04:05 2024 +0000
+++ b/purityX.R	Thu Jun 13 11:38:36 2024 +0000
@@ -74,14 +74,18 @@
 
 getxcmsSetObject <- function(xobject) {
   # XCMS 1.x
-  if (class(xobject) == "xcmsSet") {
+  if (class(xobject) == "xcmsSet"){
     return(xobject)
   }
   # XCMS 3.x
   if (class(xobject) == "XCMSnExp") {
     # Get the legacy xcmsSet object
     suppressWarnings(xset <- as(xobject, "xcmsSet"))
-    sampclass(xset) <- xset@phenoData$sample_group
+    if (!is.null(xset@phenoData$sample_group)){
+      xcms::sampclass(xset) <- xset@phenoData$sample_group
+    }else{
+      xcms::sampclass(xset) <- "."
+    }
     return(xset)
   }
 }