changeset 27:bed23aa27b4b draft

"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 50478425b4773ebcb393c0e31f1e622b7406dcbb"
author workflow4metabolomics
date Thu, 24 Sep 2020 08:09:02 +0000
parents db6549f27ad1
children 018a9771de28
files abims_xcms_summary.xml lib.r repository_dependencies.xml xcms_summary.r
diffstat 4 files changed, 27 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/abims_xcms_summary.xml	Tue May 12 16:39:28 2020 -0400
+++ b/abims_xcms_summary.xml	Thu Sep 24 08:09:02 2020 +0000
@@ -1,4 +1,4 @@
-<tool id="abims_xcms_summary" name="xcms process history" version="@TOOL_VERSION@+galaxy1">
+<tool id="abims_xcms_summary" name="xcms process history" version="@TOOL_VERSION@+galaxy2">
 
     <description>Create a summary of XCMS analysis</description>
 
@@ -87,6 +87,10 @@
 Changelog/News
 --------------
 
+**Version 3.6.1+galaxy2 - 23/09/2020**
+
+- BUGFIX: "Error: object 'sampleNamesList' not found" in case of .RData input from CAMERA
+
 .. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
 
 **Version 3.6.1+galaxy1 - 05/04/2020**
--- a/lib.r	Tue May 12 16:39:28 2020 -0400
+++ b/lib.r	Thu Sep 24 08:09:02 2020 +0000
@@ -149,7 +149,11 @@
 
     par(mfrow = c(3, 1), mar = c(4, 4, 1, 0.5))
 
-    group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
+    if(length(unique(xdata$sample_group))<10){
+        group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
+    }else{
+        group_colors <- hcl.colors(length(unique(xdata$sample_group)), palette="Dark 3")
+    }
     names(group_colors) <- unique(xdata$sample_group)
     col_per_samp <- as.character(xdata$sample_group)
     for(i in 1:length(group_colors)){col_per_samp[col_per_samp==(names(group_colors)[i])]<-group_colors[i]}
@@ -172,7 +176,11 @@
     pdf(file="raw_vs_adjusted_rt.pdf", width=16, height=12)
 
     # Color by group
-    group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
+    if(length(unique(xdata$sample_group))<10){
+        group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
+    }else{
+        group_colors <- hcl.colors(length(unique(xdata$sample_group)), palette="Dark 3")
+    }
     if (length(group_colors) > 1) {
         names(group_colors) <- unique(xdata$sample_group)
         plotAdjustedRtime(xdata, col = group_colors[xdata$sample_group])
@@ -241,10 +249,14 @@
     pdf(pdfname, width=16, height=10)
 
     # Color by group
-    group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
+    if(length(unique(xdata$sample_group))<10){
+        group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
+    }else{
+        group_colors <- hcl.colors(length(unique(xdata$sample_group)), palette="Dark 3")
+    }
     if (length(group_colors) > 1) {
         names(group_colors) <- unique(xdata$sample_group)
-        plot(chrom, col = group_colors[as.factor(chrom$sample_group)], main=main, peakType = "none")
+        plot(chrom, col = group_colors[chrom$sample_group], main=main, peakType = "none")
         legend("topright", legend=names(group_colors), col=group_colors, cex=0.8, lty=1)
     }
 
--- a/repository_dependencies.xml	Tue May 12 16:39:28 2020 -0400
+++ b/repository_dependencies.xml	Thu Sep 24 08:09:02 2020 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
 <repositories>
-    <repository changeset_revision="544f6d2329ac" name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu"/>
-    <repository changeset_revision="4a51ab3d8ecf" name="rdata_camera_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu"/>
+    <repository name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="544f6d2329ac"/>
+    <repository name="rdata_camera_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="4a51ab3d8ecf"/>
 </repositories>
\ No newline at end of file
--- a/xcms_summary.r	Tue May 12 16:39:28 2020 -0400
+++ b/xcms_summary.r	Thu Sep 24 08:09:02 2020 +0000
@@ -73,7 +73,10 @@
     if (!exists("sampleNamesList")) sampleNamesList <- list("sampleNamesMakeNames"=make.names(sampnames(xobject)))
 }
 # if the RData come from CAMERA
-if (exists("xa")) xobject <- xa@xcmsSet
+if (exists("xa")) {
+    xobject <- xa@xcmsSet
+    if (!exists("sampleNamesList")) sampleNamesList <- list("sampleNamesMakeNames"=make.names(xa@xcmsSet@phenoData$sample_name))
+}
 # if the RData come from XCMS 3.x
 if (exists("xdata")) {
     xobject <- xdata