changeset 14:55923d170538 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 92dd69e5b063aad05a9b2b75e21c78bfa46c4b94
author lecorguille
date Thu, 22 Dec 2016 05:59:54 -0500
parents 9e9d90547e5b
children c04568596f40
files README.rst abims_xcms_retcor.xml lib.r macros.xml
diffstat 4 files changed, 71 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/README.rst	Mon Nov 14 16:19:49 2016 -0500
+++ b/README.rst	Thu Dec 22 05:59:54 2016 -0500
@@ -2,6 +2,10 @@
 Changelog/News
 --------------
 
+**Version 2.0.8 - 22/12/2016**
+
+- BUGFIX: when having only one group (i.e. one folder of raw data) the BPC and TIC pdf files do not contain any graph
+
 **Version 2.0.7 - 06/07/2016**
 
 - UPGRADE: upgrate the xcms version from 1.44.0 to 1.46.0
@@ -10,7 +14,6 @@
 
 - TEST: refactoring to pass planemo test using conda dependencies
 
-
 **Version 2.0.5 - 10/02/2016**
 
 - BUGFIX: better management of errors. Datasets remained green although the process failed
@@ -37,5 +40,3 @@
 Planemo test using source env.sh: passed
 
 Planemo shed_test : passed
-
-
--- a/abims_xcms_retcor.xml	Mon Nov 14 16:19:49 2016 -0500
+++ b/abims_xcms_retcor.xml	Thu Dec 22 05:59:54 2016 -0500
@@ -1,4 +1,4 @@
-<tool id="abims_xcms_retcor" name="xcms.retcor" version="2.0.7">
+<tool id="abims_xcms_retcor" name="xcms.retcor" version="2.0.8">
 
     <description>Retention Time Correction using retcor function from xcms R package </description>
 
@@ -10,9 +10,9 @@
     <expand macro="stdio"/>
 
     <command><![CDATA[
-        @COMMAND_XCMS_SCRIPT@ 
-        image $image 
-        xfunction retcor 
+        @COMMAND_XCMS_SCRIPT@
+        image $image
+        xfunction retcor
 
         xsetRdataOutput $xsetRData
         ticspdf $ticsCorPdf
@@ -35,7 +35,7 @@
 
         @COMMAND_ZIPFILE_LOAD@
 
-        @COMMAND_LOG_EXIT@        
+        @COMMAND_LOG_EXIT@
     ]]></command>
 
     <inputs>
@@ -47,8 +47,8 @@
             </param>
             <when value="obiwarp">
                 <param name="profStep" type="float" value="1" label="Step size (in m/z)" help="[profStep] to use for profile generation from the raw data files" />
-            </when> 
-            <when value="peakgroups">   
+            </when>
+            <when value="peakgroups">
                 <param name="smooth" type="select" label="Smooth method" help="[smooth] either 'loess’ for non-linear alignment or ‘linear’ for linear alignment" >
                     <option value="loess">loess</option>
                     <option value="linear">linear</option>
@@ -63,7 +63,7 @@
                     </param>
                     <when value="show">
                         <param name="span" type="float" value="0.2" label="Degree of smoothing for local polynomial regression fitting" help="[span]"/>
-                        
+
                         <param name="family" type="select" label="Family" help="[family] if gaussian fitting is by least-squares with no outlier removal, and if symmetric a re descending M estimator is used with Tukey's biweight function, allowing outlier removal">
                             <option value="gaussian" selected="true">gaussian</option>
                             <option value="symmetric">symmetric</option>
@@ -98,7 +98,7 @@
         <data name="bpcsCorPdf"   format="pdf" label="${image.name[:-6]}.retcor.BPCs_corrected.pdf" />
         <data name="log" format="txt" label="xset.log.txt"  hidden="true" />
     </outputs>
-    
+
     <tests>
         <!--<test>
             <param name="image" value="xset.group.RData"/>
@@ -149,7 +149,7 @@
     </tests>
 
     <help><![CDATA[
-        
+
 @HELP_AUTHORS@
 
 ===========
@@ -160,12 +160,12 @@
 Description
 -----------
 
-After matching peaks into groups, xcms can use those groups to identify and correct 
-correlated drifts in retention time from run to run. The aligned peaks can then be 
-used for a second pass of peak grouping which will be more accurate than the first. 
-The whole process can be repeated in an iterative fashion. Not all peak groups will be helpful 
-for identifying retention time drifts. Some groups may be missing peaks from a large 
-fraction of samples and thus provide an incomplete picture of the drift at that time point. 
+After matching peaks into groups, xcms can use those groups to identify and correct
+correlated drifts in retention time from run to run. The aligned peaks can then be
+used for a second pass of peak grouping which will be more accurate than the first.
+The whole process can be repeated in an iterative fashion. Not all peak groups will be helpful
+for identifying retention time drifts. Some groups may be missing peaks from a large
+fraction of samples and thus provide an incomplete picture of the drift at that time point.
 Still others may contain multiple peaks from the same sample, which is a sign of impropper grouping.
 
 .. class:: warningmark
@@ -250,15 +250,15 @@
 xset.group.retcor.RData: rdata.xcms.retcor format
 
     | Rdata file that will be necessary in the **xcms.group** step of the workflow.
-    
-    
+
+
 ------
 
-.. class:: infomark 
+.. class:: infomark
 
 The output file is an xset.retcor.RData file. You can continue your analysis using it in **xcms.fillPeaks** tool.
 
-    
+
 ---------------------------------------------------
 
 ---------------
@@ -281,7 +281,7 @@
     | span -> **0.2**
     | family -> **gaussian**
     | plottype -> **deviation**
-    
+
 
 Output files
 ------------
@@ -298,6 +298,10 @@
 Changelog/News
 --------------
 
+**Version 2.0.8 - 22/12/2016**
+
+- BUGFIX: when having only one group (i.e. one folder of raw data) the BPC and TIC pdf files do not contain any graph
+
 **Version 2.0.7 - 06/07/2016**
 
 - UPGRADE: upgrate the xcms version from 1.44.0 to 1.46.0
--- a/lib.r	Mon Nov 14 16:19:49 2016 -0500
+++ b/lib.r	Thu Dec 22 05:59:54 2016 -0500
@@ -1,9 +1,12 @@
-# lib.r version="2.0.1"
+# lib.r version="2.3"
 #Authors ABiMS TEAM
 #Lib.r for Galaxy Workflow4Metabo
-#version 2.2
+#version 2.3
 #Based on lib.r 2.1
 #Modifications made by Guitton Yann 
+#2.3 Note
+#correction for empty PDF when only 1 class
+#2.2 Note
 #correct bug in Base Peak Chromatogram (BPC) option, not only TIC when scanrange used in xcmsSet
 #Note if scanrange is used a warning is prompted in R console but do not stop PDF generation
 
@@ -114,7 +117,25 @@
     legend("topright",paste(basename(files[c(classnames[[k]],classnames[[l]])])), col = colvect, lty = lty, pch = pch)
 
   }#end length ==2
+  
+  #case where only one class
+  if (length(class)==1){
+    k=1
+		ylim = range(sapply(TIC, function(x) range(x[,2])))
+    colvect<-NULL
+    plot(0, 0, type="n", xlim = xlim/60, ylim = ylim, main = paste("Base Peak Chromatograms \n","BPCs_",class[k], sep=""), xlab = "Retention Time (min)", ylab = "BPC")
 
+    for (j in 1:length(classnames[[k]])) {
+      tic <- TIC[[classnames[[k]][j]]]
+      # points(tic[,1]/60, tic[,2], col = cols[i], pch = pch[i], type="l")
+      points(tic[,1]/60, tic[,2], col = cols[classnames[[k]][j]], pch = pch[classnames[[k]][j]], type="l")
+      colvect<-append(colvect,cols[classnames[[k]][j]])
+    }
+      
+    legend("topright",paste(basename(files[c(classnames[[k]])])), col = colvect, lty = lty, pch = pch)
+
+  }#end length ==1
+                        
   dev.off() #pdf(pdfname,w=16,h=10)
 
   invisible(TIC)
@@ -219,6 +240,25 @@
     legend("topright",paste(basename(files[c(classnames[[k]],classnames[[l]])])), col = colvect, lty = lty, pch = pch)
 
   }#end length ==2
+    
+  #case where only one class
+  if (length(class)==1){
+	  k=1
+	  ylim = range(sapply(TIC, function(x) range(x[,2])))
+				
+	  plot(0, 0, type="n", xlim = xlim/60, ylim = ylim, main = paste("Total Ion Chromatograms \n","TICs_",class[k], sep=""), xlab = "Retention Time (min)", ylab = "TIC")
+    colvect<-NULL
+		for (j in 1:length(classnames[[k]])) {
+      tic <- TIC[[classnames[[k]][j]]]
+			# points(tic[,1]/60, tic[,2], col = cols[i], pch = pch[i], type="l")
+			points(tic[,1]/60, tic[,2], col = cols[classnames[[k]][j]], pch = pch[classnames[[k]][j]], type="l")
+      colvect<-append(colvect,cols[classnames[[k]][j]])
+	  }
+		
+		legend("topright",paste(basename(files[c(classnames[[k]])])), col = colvect, lty = lty, pch = pch)
+	  
+	}#end length ==1
+                        
   dev.off() #pdf(pdfname,w=16,h=10)
 
   invisible(TIC)
--- a/macros.xml	Mon Nov 14 16:19:49 2016 -0500
+++ b/macros.xml	Thu Dec 22 05:59:54 2016 -0500
@@ -2,7 +2,6 @@
 <macros>
     <xml name="requirements">
         <requirements>
-            <requirement type="package" version="3.1.2">R</requirement>
             <requirement type="package" version="0.4_1">r-snow</requirement>
             <requirement type="package" version="1.46.0">bioconductor-xcms</requirement>
             <requirement type="package" version="1.1_4">r-batch</requirement>