Repository 'xcms_retcor'
hg clone https://toolshed.g2.bx.psu.edu/repos/lecorguille/xcms_retcor

Changeset 8:4bfef820569b (2017-04-07)
Previous changeset 7:bb602a5b8819 (2017-01-30) Next changeset 9:e4e0254a3c0a (2017-11-29)
Commit message:
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
modified:
README.rst
abims_xcms_retcor.xml
lib.r
macros.xml
static/images/xcms_retcor_workflow.png
xcms.r
added:
test-data/faahKO-single-class.xset.group.RData
test-data/ko15.CDF
test-data/ko16.CDF
test-data/wt15.CDF
test-data/wt16.CDF
removed:
Makefile
planemo_test.sh
tool_dependencies.xml
b
diff -r bb602a5b8819 -r 4bfef820569b Makefile
--- a/Makefile Mon Jan 30 08:53:30 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
@@ -1,23 +0,0 @@
-# USAGE: make [install|clean]
-
-# -------- VARIABLE --------
-
-OBJ=xcms_retcor.tgz
-DEP=abims_xcms_retcor.xml tool_dependencies.xml repository_dependencies.xml static test-data
-
-
-# ------------------------
-
-all: $(OBJ)
-
-$(OBJ): $(DEP)
- tar --exclude=".svn" -zchf $@ $^
-
-# ------------------------
-
-install: $(OBJ)
- mv *.tgz ~
-
-clean:
- rm *.tgz
-
b
diff -r bb602a5b8819 -r 4bfef820569b README.rst
--- a/README.rst Mon Jan 30 08:53:30 2017 -0500
+++ b/README.rst Fri Apr 07 07:36:24 2017 -0400
b
@@ -2,6 +2,10 @@
 Changelog/News
 --------------
 
+**Version 2.1.0 - 03/02/2017**
+
+- IMPROVEMENT: xcms.retcor can deal with merged individual data
+
 **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
@@ -31,12 +35,3 @@
 
 - IMPROVEMENT: parameter labels have changed to facilitate their reading.
 
-
-Test Status
------------
-
-Planemo test using conda: passed
-
-Planemo test using source env.sh: passed
-
-Planemo shed_test : passed
b
diff -r bb602a5b8819 -r 4bfef820569b abims_xcms_retcor.xml
--- a/abims_xcms_retcor.xml Mon Jan 30 08:53:30 2017 -0500
+++ b/abims_xcms_retcor.xml Fri Apr 07 07:36:24 2017 -0400
[
@@ -1,4 +1,4 @@
-<tool id="abims_xcms_retcor" name="xcms.retcor" version="2.0.8">
+<tool id="abims_xcms_retcor" name="xcms.retcor" version="2.1.0">
 
     <description>Retention Time Correction using retcor function from xcms R package </description>
 
@@ -11,13 +11,13 @@
 
     <command><![CDATA[
         @COMMAND_XCMS_SCRIPT@
-        image $image
+        image '$image'
         xfunction retcor
 
-        xsetRdataOutput $xsetRData
-        ticspdf $ticsCorPdf
-        bicspdf $bpcsCorPdf
-        rplotspdf $rplotsPdf
+        xsetRdataOutput '$xsetRData'
+        ticspdf '$ticsCorPdf'
+        bicspdf '$bpcsCorPdf'
+        rplotspdf '$rplotsPdf'
 
         method $methods.method
         #if $methods.method == "obiwarp":
@@ -33,7 +33,7 @@
             #end if
         #end if
 
-        @COMMAND_ZIPFILE_LOAD@
+        @COMMAND_FILE_LOAD@
 
         @COMMAND_LOG_EXIT@
     ]]></command>
@@ -43,7 +43,7 @@
         <conditional name="methods">
             <param name="method" type="select" label="Method to use for retention time correction" help="[method] See the help section below" >
                 <option value="obiwarp" >obiwarp</option>
-                <option value="peakgroups" selected="peakgroups">peakgroups</option>
+                <option value="peakgroups" selected="true">peakgroups</option>
             </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" />
@@ -82,7 +82,7 @@
             </when>
         </conditional>
 
-        <expand macro="zipfile_load"/>
+        <expand macro="input_file_load"/>
 
     </inputs>
 
@@ -133,8 +133,29 @@
             <param name="methods|options|span" value="0.2"/>
             <param name="methods|options|family" value="gaussian"/>
             <param name="methods|options|plottype" value="deviation"/>
-            <param name="zipfile_load_conditional|zipfile_load_select" value="yes" />
-            <param name="zipfile_load_conditional|zip_file" value="faahKO_reduce.zip"  ftype="zip" />
+            <expand macro="test_file_load_zip"/>
+            <output name="log">
+                <assert_contents>
+                    <has_text text="object with 4 samples" />
+                    <has_text text="Time range: 2507.7-4481.7 seconds (41.8-74.7 minutes)" />
+                    <has_text text="Mass range: 200.1-600 m/z" />
+                    <has_text text="Peaks: 9251 (about 2313 per sample)" />
+                    <has_text text="Peak Groups: 0" />
+                    <has_text text="Sample classes: KO, WT" />
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="image" value="faahKO-single-class.xset.group.RData"/>
+            <param name="methods|method" value="peakgroups"/>
+            <param name="methods|smooth" value="loess"/>
+            <param name="methods|extra" value="1"/>
+            <param name="methods|missing" value="1"/>
+            <param name="methods|options|option" value="show"/>
+            <param name="methods|options|span" value="0.2"/>
+            <param name="methods|options|family" value="gaussian"/>
+            <param name="methods|options|plottype" value="deviation"/>
+            <expand macro="test_file_load_single"/>
             <output name="log">
                 <assert_contents>
                     <has_text text="object with 4 samples" />
@@ -298,6 +319,10 @@
 Changelog/News
 --------------
 
+**Version 2.1.0 - 03/02/2017**
+
+- IMPROVEMENT: xcms.retcor can deal with merged individual data
+
 **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
b
diff -r bb602a5b8819 -r 4bfef820569b lib.r
--- a/lib.r Mon Jan 30 08:53:30 2017 -0500
+++ b/lib.r Fri Apr 07 07:36:24 2017 -0400
[
b'@@ -27,168 +27,165 @@\n \n #@author G. Le Corguille\n #This function format ions identifiers\n-formatIonIdentifiers <- function(dataData, numDigitsRT=0, numDigitsMZ=0) {\n-    return(make.unique(paste0("M",round(dataData[,"mz"],numDigitsMZ),"T",round(dataData[,"rt"],numDigitsRT))))\n+formatIonIdentifiers <- function(variableMetadata, numDigitsRT=0, numDigitsMZ=0) {\n+    splitDeco = strsplit(as.character(variableMetadata$name),"_")\n+    idsDeco = sapply(splitDeco, function(x) { deco=unlist(x)[2]; if (is.na(deco)) return ("") else return(paste0("_",deco)) })\n+    namecustom = make.unique(paste0("M",round(variableMetadata[,"mz"],numDigitsMZ),"T",round(variableMetadata[,"rt"],numDigitsRT),idsDeco))\n+    variableMetadata=cbind(name=variableMetadata$name, namecustom=namecustom, variableMetadata[,!(colnames(variableMetadata) %in% c("name"))])\n+    return(variableMetadata)\n }\n \n #@author G. Le Corguille\n # value: intensity values to be used into, maxo or intb\n getPeaklistW4M <- function(xset, intval="into",convertRTMinute=F,numDigitsMZ=4,numDigitsRT=0,variableMetadataOutput,dataMatrixOutput) {\n-    groups <- xset@groups\n-    values <- groupval(xset, "medret", value=intval)\n-    \n-    # renamming of the column rtmed to rt to fit with camera peaklist function output\n-    colnames(groups)[colnames(groups)=="rtmed"] <- "rt"\n-    colnames(groups)[colnames(groups)=="mzmed"] <- "mz"\n-    \n-    ids <- formatIonIdentifiers(groups, numDigitsRT=numDigitsRT, numDigitsMZ=numDigitsMZ)\n-    groups = RTSecondToMinute(groups, convertRTMinute)\n+    variableMetadata_dataMatrix = peakTable(xset, method="medret", value=intval)\n+    variableMetadata_dataMatrix = cbind(name=groupnames(xset),variableMetadata_dataMatrix)\n+\n+    dataMatrix = variableMetadata_dataMatrix[,(make.names(colnames(variableMetadata_dataMatrix)) %in% c("name", make.names(sampnames(xset))))]\n \n-    rownames(groups) = ids\n-    rownames(values) = ids\n+    variableMetadata = variableMetadata_dataMatrix[,!(make.names(colnames(variableMetadata_dataMatrix)) %in% c(make.names(sampnames(xset))))]\n+    variableMetadata = RTSecondToMinute(variableMetadata, convertRTMinute)\n+    variableMetadata = formatIonIdentifiers(variableMetadata, numDigitsRT=numDigitsRT, numDigitsMZ=numDigitsMZ)\n \n-    #@TODO: add "name" as the first column name\n-    #colnames(groups)[1] = "name"\n-    #colnames(values)[1] = "name"\n-\n-    write.table(groups, file=variableMetadataOutput,sep="\\t",quote=F,row.names = T,col.names = NA)\n-    write.table(values, file=dataMatrixOutput,sep="\\t",quote=F,row.names = T,col.names = NA)\n+    write.table(variableMetadata, file=variableMetadataOutput,sep="\\t",quote=F,row.names=F)\n+    write.table(dataMatrix, file=dataMatrixOutput,sep="\\t",quote=F,row.names=F)\n }\n \n #@author Y. Guitton\n getBPC <- function(file,rtcor=NULL, ...) {\n-  object <- xcmsRaw(file)\n-  sel <- profRange(object, ...)\n-  cbind(if (is.null(rtcor)) object@scantime[sel$scanidx] else rtcor ,xcms:::colMax(object@env$profile[sel$massidx,sel$scanidx,drop=FALSE]))\n-  #plotChrom(xcmsRaw(file), base=T)\n+    object <- xcmsRaw(file)\n+    sel <- profRange(object, ...)\n+    cbind(if (is.null(rtcor)) object@scantime[sel$scanidx] else rtcor ,xcms:::colMax(object@env$profile[sel$massidx,sel$scanidx,drop=FALSE]))\n+    #plotChrom(xcmsRaw(file), base=T)\n }\n \n #@author Y. Guitton\n getBPCs <- function (xcmsSet=NULL, pdfname="BPCs.pdf",rt=c("raw","corrected"), scanrange=NULL) {\n-  cat("Creating BIC pdf...\\n")\n+    cat("Creating BIC pdf...\\n")\n \n-  if (is.null(xcmsSet)) {\n-    cat("Enter an xcmsSet \\n")\n-    stop()\n-  } else {\n-    files <- filepaths(xcmsSet)\n-  }\n+    if (is.null(xcmsSet)) {\n+        cat("Enter an xcmsSet \\n")\n+        stop()\n+    } else {\n+        files <- filepaths(xcmsSet)\n+    }\n \n-  class<-as.vector(levels(xcmsSet@phenoData[,1])) #sometime phenoData have more than 1 column use first as class\n+    phenoDataClass<-as.vector(levels(xcmsSet@phenoData[,1])) #sometime phenoData have more than 1 column use first as class\n \n-  classnam'..b'as.matrix(md5sum(files)))\n+}\n+\n+\n+# This function get the raw file path from the arguments\n+getRawfilePathFromArguments <- function(singlefile, zipfile, listArguments) {    \n+    if (!is.null(listArguments[["zipfile"]]))           zipfile = listArguments[["zipfile"]]\n+    if (!is.null(listArguments[["zipfilePositive"]]))   zipfile = listArguments[["zipfilePositive"]]\n+    if (!is.null(listArguments[["zipfileNegative"]]))   zipfile = listArguments[["zipfileNegative"]]\n+\n+    if (!is.null(listArguments[["singlefile_galaxyPath"]])) {\n+        singlefile_galaxyPaths = listArguments[["singlefile_galaxyPath"]];\n+        singlefile_sampleNames = listArguments[["singlefile_sampleName"]]\n+    }\n+    if (!is.null(listArguments[["singlefile_galaxyPathPositive"]])) {\n+        singlefile_galaxyPaths = listArguments[["singlefile_galaxyPathPositive"]];\n+        singlefile_sampleNames = listArguments[["singlefile_sampleNamePositive"]]\n+    }\n+    if (!is.null(listArguments[["singlefile_galaxyPathNegative"]])) {\n+        singlefile_galaxyPaths = listArguments[["singlefile_galaxyPathNegative"]];\n+        singlefile_sampleNames = listArguments[["singlefile_sampleNameNegative"]]\n+    }\n+    if (exists("singlefile_galaxyPaths")){\n+        singlefile_galaxyPaths = unlist(strsplit(singlefile_galaxyPaths,","))\n+        singlefile_sampleNames = unlist(strsplit(singlefile_sampleNames,","))\n \n-  library(tools)\n+        singlefile=NULL\n+        for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {\n+            singlefile_galaxyPath=singlefile_galaxyPaths[singlefile_galaxyPath_i]\n+            singlefile_sampleName=singlefile_sampleNames[singlefile_galaxyPath_i]\n+            singlefile[[singlefile_sampleName]] = singlefile_galaxyPath\n+        }\n+    }\n+    for (argument in c("zipfile","zipfilePositive","zipfileNegative","singlefile_galaxyPath","singlefile_sampleName","singlefile_galaxyPathPositive","singlefile_sampleNamePositive","singlefile_galaxyPathNegative","singlefile_sampleNameNegative")) {\n+        listArguments[[argument]]=NULL\n+    }\n+    return(list(zipfile=zipfile, singlefile=singlefile, listArguments=listArguments))\n+}\n+\n+\n+# This function retrieve the raw file in the working directory\n+#   - if zipfile: unzip the file with its directory tree\n+#   - if singlefiles: set symlink with the good filename\n+retrieveRawfileInTheWorkingDirectory <- function(singlefile, zipfile) {\n+    if(!is.null(singlefile) && (length("singlefile")>0)) {\n+        for (singlefile_sampleName in names(singlefile)) {\n+            singlefile_galaxyPath = singlefile[[singlefile_sampleName]]\n+            if(!file.exists(singlefile_galaxyPath)){\n+                error_message=paste("Cannot access the sample:",singlefile_sampleName,"located:",singlefile_galaxyPath,". Please, contact your administrator ... if you have one!")\n+                print(error_message); stop(error_message)\n+            }\n \n-  #cat("\\n\\n")\n+            file.symlink(singlefile_galaxyPath,singlefile_sampleName)\n+        }\n+        directory = "."\n+\n+    }\n+    if(!is.null(zipfile) && (zipfile!="")) {\n+        if(!file.exists(zipfile)){\n+            error_message=paste("Cannot access the Zip file:",zipfile,". Please, contact your administrator ... if you have one!")\n+            print(error_message)\n+            stop(error_message)\n+        }\n+\n+        #list all file in the zip file\n+        #zip_files=unzip(zipfile,list=T)[,"Name"]\n \n-  return(as.matrix(md5sum(files)))\n+        #unzip\n+        suppressWarnings(unzip(zipfile, unzip="unzip"))\n+\n+        #get the directory name\n+        filesInZip=unzip(zipfile, list=T);\n+        directories=unique(unlist(lapply(strsplit(filesInZip$Name,"/"), function(x) x[1])));\n+        directories=directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir]\n+        directory = "."\n+        if (length(directories) == 1) directory = directories\n+\n+        cat("files_root_directory\\t",directory,"\\n")\n+\n+    }\n+    return (directory)\n }\n'
b
diff -r bb602a5b8819 -r 4bfef820569b macros.xml
--- a/macros.xml Mon Jan 30 08:53:30 2017 -0500
+++ b/macros.xml Fri Apr 07 07:36:24 2017 -0400
[
@@ -7,6 +7,11 @@
             <requirement type="package" version="1.1_4">r-batch</requirement>
         </requirements>
     </xml>
+    <xml name="requirements_light">
+        <requirements>
+            <requirement type="package" version="1.46.0">bioconductor-xcms</requirement>
+        </requirements>
+    </xml>
     <xml name="stdio">
         <stdio>
             <exit_code range="1" level="fatal" />
@@ -20,41 +25,101 @@
     <token name="@COMMAND_LOG_EXIT@">
         ;
         return=\$?;
-        mv log.txt $log;
-        cat $log;
+        mv log.txt '$log';
+        cat '$log';
         sh -c "exit \$return"
     </token>
 
     <!-- zipfile load for planemo test -->
 
-    <token name="@COMMAND_ZIPFILE_LOAD@">
-        #if $zipfile_load_conditional.zipfile_load_select == "yes":
-            #if $zipfile_load_conditional.zip_file:
-                zipfile $zipfile_load_conditional.zip_file
+    <token name="@COMMAND_FILE_LOAD@">
+        #if $file_load_section.file_load_conditional.file_load_select == "yes":
+            #if $file_load_section.file_load_conditional.input[0].is_of_type("mzxml") or $file_load_section.file_load_conditional.input[0].is_of_type("mzml") or $file_load_section.file_load_conditional.input[0].is_of_type("mzdata") or $file_load_section.file_load_conditional.input[0].is_of_type("netcdf"):
+                #set singlefile_galaxyPath = ','.join( [ str( $single_file ) for $single_file in $file_load_section.file_load_conditional.input ] )
+                #set singlefile_sampleName = ','.join( [ str( $single_file.name ) for $single_file in $file_load_section.file_load_conditional.input ] )
+
+                singlefile_galaxyPath '$singlefile_galaxyPath' singlefile_sampleName '$singlefile_sampleName'
+            #else
+                zipfile '$file_load_section.file_load_conditional.input'
             #end if
         #end if
     </token>
 
-    <xml name="zipfile_load">
-        <conditional name="zipfile_load_conditional">
-            <param name="zipfile_load_select" type="select" label="Resubmit your zip file" help="Use only if you get a message which say that your original zip file have been deleted on the server." >
-                <option value="no" >no need</option>
-                <option value="yes">yes</option>
-            </param>
-            <when value="no">
+    <xml name="input_file_load">
+        <section name="file_load_section" title="Resubmit your raw dataset or your zip file">
+            <conditional name="file_load_conditional">
+                <param name="file_load_select" type="select" label="Resubmit your dataset or your zip file" help="Use only if you get a message which say that your original dataset or zip file have been deleted on the server." >
+                    <option value="no" >no need</option>
+                    <option value="yes" >yes</option>
+                </param>
+                <when value="no">
+                </when>
+                <when value="yes">
+                    <param name="input" type="data" format="mzxml,mzml,mzdata,netcdf,no_unzip.zip,zip" multiple="true" label="File(s) from your history containing your chromatograms" help="Single file mode for the format: mzxml, mzml, mzdata and netcdf. Zip file mode for the format: no_unzip.zip, zip. See the help section below." />
+                </when>
+            </conditional>
+        </section>
+    </xml>
+
+    <xml name="test_file_load_zip">
+        <section name="file_load_section">
+            <conditional name="file_load_conditional">
+                <param name="file_load_select" value="yes" />
+                <param name="input" value="faahKO_reduce.zip" ftype="zip" />
+            </conditional>
+        </section>
+    </xml>
+
+    <xml name="test_file_load_single">
+        <section name="file_load_section">
+            <conditional name="file_load_conditional">
+                <param name="file_load_select" value="yes" />
+                <param name="input" value="wt15.CDF,ko16.CDF,ko15.CDF,wt16.CDF" ftype="netcdf" />
+            </conditional>
+        </section>
+    </xml>
+
+    <token name="@COMMAND_PEAKLIST@">
+        #if $peaklist.peaklistBool
+            variableMetadataOutput '$variableMetadata'
+            dataMatrixOutput '$dataMatrix'
+            convertRTMinute $peaklist.convertRTMinute
+            numDigitsMZ $peaklist.numDigitsMZ
+            numDigitsRT $peaklist.numDigitsRT
+            intval $peaklist.intval
+        #end if
+    </token>
+
+    <xml name="input_peaklist">
+        <conditional name="peaklist">
+            <param name="peaklistBool" type="boolean" label="Get a Peak List" />
+            <when value="true">
+              <param name="convertRTMinute" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Convert retention time (seconds) into minutes" help="Convert the columns rtmed, rtmin and rtmax into minutes"/>
+              <param name="numDigitsMZ" type="integer" value="4" label="Number of decimal places for mass values reported in ions' identifiers." help="A minimum of 4 decimal places is recommended. Useful to avoid duplicates within identifiers" />
+              <param name="numDigitsRT" type="integer" value="0" label="Number of decimal places for retention time values reported in ions' identifiers." help="Useful to avoid duplicates within identifiers" />
+              <param name="intval" type="select" label="Reported intensity values" help="[intval] See the help section below">
+                  <option value="into" selected="true">into</option>
+                  <option value="maxo">maxo</option>
+                  <option value="intb">intb</option>
+              </param>
             </when>
-            <when value="yes">
-                <param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" />
-            </when>
+            <when value="false" />
         </conditional>
     </xml>
 
-
+    <xml name="output_peaklist"  token_function="">
+        <data name="variableMetadata" format="tabular" label="${image.name[:-6]}.@FUNCTION@.variableMetadata.tsv">
+            <filter>(peaklist['peaklistBool'])</filter>
+        </data>
+        <data name="dataMatrix" format="tabular" label="${image.name[:-6]}.@FUNCTION@.dataMatrix.tsv" >
+            <filter>(peaklist['peaklistBool'])</filter>
+        </data>
+    </xml>
 
     <token name="@HELP_AUTHORS@">
 .. class:: infomark
 
-**Authors**  Colin A. Smith csmith@scripps.edu, Ralf Tautenhahn rtautenh@gmail.com, Steffen Neumann sneumann@ipb-halle.de, Paul Benton hpaul.benton08@imperial.ac.uk and Christopher Conley cjconley@ucdavis.edu 
+**Authors**  Colin A. Smith csmith@scripps.edu, Ralf Tautenhahn rtautenh@gmail.com, Steffen Neumann sneumann@ipb-halle.de, Paul Benton hpaul.benton08@imperial.ac.uk and Christopher Conley cjconley@ucdavis.edu
 
 .. class:: infomark
 
b
diff -r bb602a5b8819 -r 4bfef820569b planemo_test.sh
--- a/planemo_test.sh Mon Jan 30 08:53:30 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
@@ -1,25 +0,0 @@
-# Example of planemo command to launch test
-
-# -- Use of installed package environments
-# after having installing package on a local galaxy instance
-source /w/galaxy/dev/shed_tools_tool_dependency_dir/R/3.1.2/iuc/package_r_3_1_2/1ca39eb16186/env.sh
-source /w/galaxy/dev/shed_tools_tool_dependency_dir/bioconductor-xcms/1.44.0/lecorguille/package_bioconductor_xcms_1_44_0/0c38f7d43e08/env.sh
-planemo test --install_galaxy
-
-#All 1 test(s) executed passed.
-#abims_xcms_retcor[0]: passed
-
-
-# -- Use of conda dependencies
-planemo conda_init --conda_prefix /tmp/mc
-planemo conda_install --conda_prefix /tmp/mc . 
-planemo test --install_galaxy --conda_prefix /tmp/mc --conda_dependency_resolution
-
-#All 1 test(s) executed passed.
-#abims_xcms_retcor[0]: passed
-
-
-# -- Use of shed_test
-planemo shed_test --install_galaxy --galaxy_branch "dev" -t testtoolshed
-#All 1 test(s) executed passed.
-#testtoolshed.g2.bx.psu.edu/repos/lecorguille/xcms_retcor/abims_xcms_retcor/2.0.6[0]: passed
b
diff -r bb602a5b8819 -r 4bfef820569b static/images/xcms_retcor_workflow.png
b
Binary file static/images/xcms_retcor_workflow.png has changed
b
diff -r bb602a5b8819 -r 4bfef820569b test-data/faahKO-single-class.xset.group.RData
b
Binary file test-data/faahKO-single-class.xset.group.RData has changed
b
diff -r bb602a5b8819 -r 4bfef820569b test-data/ko15.CDF
b
Binary file test-data/ko15.CDF has changed
b
diff -r bb602a5b8819 -r 4bfef820569b test-data/ko16.CDF
b
Binary file test-data/ko16.CDF has changed
b
diff -r bb602a5b8819 -r 4bfef820569b test-data/wt15.CDF
b
Binary file test-data/wt15.CDF has changed
b
diff -r bb602a5b8819 -r 4bfef820569b test-data/wt16.CDF
b
Binary file test-data/wt16.CDF has changed
b
diff -r bb602a5b8819 -r 4bfef820569b tool_dependencies.xml
--- a/tool_dependencies.xml Mon Jan 30 08:53:30 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<tool_dependency>
-    <package name="R" version="3.1.2">
-        <repository changeset_revision="4d2fd1413b56" name="package_r_3_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="bioconductor-xcms" version="1.46.0">
-        <repository changeset_revision="779207ed5674" name="package_bioconductor_xcms_1_46_0" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" />
-    </package>
-</tool_dependency>
b
diff -r bb602a5b8819 -r 4bfef820569b xcms.r
--- a/xcms.r Mon Jan 30 08:53:30 2017 -0500
+++ b/xcms.r Fri Apr 07 07:36:24 2017 -0400
[
b'@@ -15,8 +15,8 @@\n #pkgs=c("xcms","batch")\n pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch")\n for(pkg in pkgs) {\n-  suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))\n-  cat(pkg,"\\t",as.character(packageVersion(pkg)),"\\n",sep="")\n+    suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))\n+    cat(pkg,"\\t",as.character(packageVersion(pkg)),"\\n",sep="")\n }\n source_local <- function(fname){ argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }\n cat("\\n\\n");\n@@ -38,7 +38,7 @@\n \n #image is an .RData file necessary to use xset variable given by previous tools\n if (!is.null(listArguments[["image"]])){\n-  load(listArguments[["image"]]); listArguments[["image"]]=NULL\n+    load(listArguments[["image"]]); listArguments[["image"]]=NULL\n }\n \n #Import the different functions\n@@ -61,110 +61,67 @@\n \n xsetRdataOutput = paste(thefunction,"RData",sep=".")\n if (!is.null(listArguments[["xsetRdataOutput"]])){\n-  xsetRdataOutput = listArguments[["xsetRdataOutput"]]; listArguments[["xsetRdataOutput"]]=NULL\n+    xsetRdataOutput = listArguments[["xsetRdataOutput"]]; listArguments[["xsetRdataOutput"]]=NULL\n }\n \n #saving the specific parameters\n rplotspdf = "Rplots.pdf"\n if (!is.null(listArguments[["rplotspdf"]])){\n-  rplotspdf = listArguments[["rplotspdf"]]; listArguments[["rplotspdf"]]=NULL\n+    rplotspdf = listArguments[["rplotspdf"]]; listArguments[["rplotspdf"]]=NULL\n }\n sampleMetadataOutput = "sampleMetadata.tsv"\n if (!is.null(listArguments[["sampleMetadataOutput"]])){\n-  sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL\n+    sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL\n }\n variableMetadataOutput = "variableMetadata.tsv"\n if (!is.null(listArguments[["variableMetadataOutput"]])){\n-  variableMetadataOutput = listArguments[["variableMetadataOutput"]]; listArguments[["variableMetadataOutput"]]=NULL\n+    variableMetadataOutput = listArguments[["variableMetadataOutput"]]; listArguments[["variableMetadataOutput"]]=NULL\n }\n dataMatrixOutput = "dataMatrix.tsv"\n if (!is.null(listArguments[["dataMatrixOutput"]])){\n-  dataMatrixOutput = listArguments[["dataMatrixOutput"]]; listArguments[["dataMatrixOutput"]]=NULL\n+    dataMatrixOutput = listArguments[["dataMatrixOutput"]]; listArguments[["dataMatrixOutput"]]=NULL\n }\n if (!is.null(listArguments[["convertRTMinute"]])){\n-  convertRTMinute = listArguments[["convertRTMinute"]]; listArguments[["convertRTMinute"]]=NULL\n+    convertRTMinute = listArguments[["convertRTMinute"]]; listArguments[["convertRTMinute"]]=NULL\n }\n if (!is.null(listArguments[["numDigitsMZ"]])){\n-  numDigitsMZ = listArguments[["numDigitsMZ"]]; listArguments[["numDigitsMZ"]]=NULL\n+    numDigitsMZ = listArguments[["numDigitsMZ"]]; listArguments[["numDigitsMZ"]]=NULL\n }\n if (!is.null(listArguments[["numDigitsRT"]])){\n   numDigitsRT = listArguments[["numDigitsRT"]]; listArguments[["numDigitsRT"]]=NULL\n }\n if (!is.null(listArguments[["intval"]])){\n-  intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL\n+    intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL\n }\n \n if (thefunction %in% c("xcmsSet","retcor")) {\n-  ticspdf = listArguments[["ticspdf"]]; listArguments[["ticspdf"]]=NULL\n-  bicspdf = listArguments[["bicspdf"]]; listArguments[["bicspdf"]]=NULL\n-}\n-\n-#necessary to unzip .zip file uploaded to Galaxy\n-#thanks to .zip file it\'s possible to upload many file as the same time conserving the tree hierarchy of directories\n-\n-\n-if (!is.null(listArguments[["zipfile"]])){\n-  zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL\n-}\n-\n-if (!is.null(listArguments[["library"]])){\n-  directory=listArguments[["library"]]; listArguments[["library"]]'..b'set), listArguments)\n }\n \n cat("\\n\\n")\n@@ -172,8 +129,6 @@\n \n \n \n-\n-\n # ----- MAIN PROCESSING INFO -----\n cat("\\tMAIN PROCESSING INFO\\n")\n \n@@ -181,12 +136,12 @@\n #Verification of a group step before doing the fillpeaks job.\n \n if (thefunction == "fillPeaks") {\n-  res=try(is.null(groupnames(xset)))\n-  if (class(res) == "try-error"){\n-    error<-geterrmessage()\n-    write(error, stderr())\n-    stop("You must always do a group step after a retcor. Otherwise it won\'t work for the fillpeaks step")\n-  }\n+    res=try(is.null(groupnames(xset)))\n+    if (class(res) == "try-error"){\n+        error<-geterrmessage()\n+        write(error, stderr())\n+        stop("You must always do a group step after a retcor. Otherwise it won\'t work for the fillpeaks step")\n+    }\n \n }\n \n@@ -194,7 +149,7 @@\n #dev.new(file="Rplots.pdf", width=16, height=12)\n pdf(file=rplotspdf, width=16, height=12)\n if (thefunction == "group") {\n-  par(mfrow=c(2,2))\n+    par(mfrow=c(2,2))\n }\n #else if (thefunction == "retcor") {\n #try to change the legend display\n@@ -208,6 +163,11 @@\n cat("\\t\\tCOMPUTE\\n")\n xset = do.call(thefunction, listArguments)\n \n+# check if there are no peaks\n+if (nrow(peaks(xset)) == 0) {\n+    stop("No peaks were detected. You should review your settings")\n+}\n+\n \n cat("\\n\\n")\n \n@@ -215,40 +175,38 @@\n \n if (thefunction  == "xcmsSet") {\n \n-  #transform the files absolute pathways into relative pathways\n-  xset@filepaths<-sub(paste(getwd(),"/",sep="") ,"", xset@filepaths)\n+    #transform the files absolute pathways into relative pathways\n+    xset@filepaths<-sub(paste(getwd(),"/",sep="") ,"", xset@filepaths)\n+    if(exists("zipfile") && !is.null(zipfile) && (zipfile!="")) {\n \n-  if(exists("zipfile") && (zipfile!="")) {\n+        #Modify the samples names (erase the path)\n+        for(i in 1:length(sampnames(xset))){\n \n-    #Modify the samples names (erase the path)\n-    for(i in 1:length(sampnames(xset))){\n+            sample_name=unlist(strsplit(sampnames(xset)[i], "/"))\n+            sample_name=sample_name[length(sample_name)]\n+            sample_name= unlist(strsplit(sample_name,"[.]"))[1]\n+            sampnames(xset)[i]=sample_name\n \n-      sample_name=unlist(strsplit(sampnames(xset)[i], "/"))\n-      sample_name=sample_name[length(sample_name)]\n-      sample_name= unlist(strsplit(sample_name,"[.]"))[1]\n-      sampnames(xset)[i]=sample_name\n+        }\n \n     }\n \n-  }\n-\n }\n \n # -- TIC --\n if (thefunction == "xcmsSet") {\n-  cat("\\t\\tGET TIC GRAPH\\n")\n-  sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput)\n-  getTICs(xcmsSet=xset, pdfname=ticspdf,rt="raw")\n-  getBPCs(xcmsSet=xset,rt="raw",pdfname=bicspdf)\n+    cat("\\t\\tGET TIC GRAPH\\n")\n+    sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput)\n+    getTICs(xcmsSet=xset, pdfname=ticspdf,rt="raw")\n+    getBPCs(xcmsSet=xset,rt="raw",pdfname=bicspdf)\n } else if (thefunction == "retcor") {\n-  cat("\\t\\tGET TIC GRAPH\\n")\n-  getTICs(xcmsSet=xset, pdfname=ticspdf,rt="corrected")\n-  getBPCs(xcmsSet=xset,rt="corrected",pdfname=bicspdf)\n+    cat("\\t\\tGET TIC GRAPH\\n")\n+    getTICs(xcmsSet=xset, pdfname=ticspdf,rt="corrected")\n+    getBPCs(xcmsSet=xset,rt="corrected",pdfname=bicspdf)\n }\n \n-if (thefunction == "fillPeaks") {\n-  cat("\\t\\tGET THE PEAK LIST\\n")\n-  getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput)\n+if ((thefunction == "group" || thefunction == "fillPeaks") && exists("intval")) {\n+    getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput)\n }\n \n \n@@ -262,7 +220,7 @@\n \n \n #saving R data in .Rdata file to save the variables used in the present tool\n-objects2save = c("xset","zipfile","listOFlistArguments","md5sumList","sampleNamesList")\n+objects2save = c("xset","zipfile","singlefile","listOFlistArguments","md5sumList","sampleNamesList")\n save(list=objects2save[objects2save %in% ls()], file=xsetRdataOutput)\n \n cat("\\n\\n")\n'