Repository 'probmetab'
hg clone https://toolshed.g2.bx.psu.edu/repos/mmonsoor/probmetab

Changeset 3:abcfa1648b66 (2017-04-07)
Previous changeset 2:3a9914b37f2f (2016-07-04) Next changeset 4:52b222a626b0 (2017-04-07)
Commit message:
planemo upload commit c897279aa8cae0a4ad889bb05b143f32d2b6d712
modified:
ProbMetab.xml
README.txt
lib.r
macros.xml
probmetab.r
static/images/probmetab_workflow.png
added:
test-data/faahOK-single.xset.merged.group.retcor.group.fillPeaks.annotate.negative.Rdata
test-data/ko15.CDF
test-data/ko16.CDF
test-data/wt15.CDF
test-data/wt16.CDF
b
diff -r 3a9914b37f2f -r abcfa1648b66 ProbMetab.xml
--- a/ProbMetab.xml Mon Jul 04 11:58:10 2016 -0400
+++ b/ProbMetab.xml Fri Apr 07 07:14:12 2017 -0400
[
b'@@ -1,4 +1,4 @@\n-<tool id="Probmetab" name="ProbMetab Tool" version="1.0.1">\n+<tool id="Probmetab" name="ProbMetab Tool" version="1.1.0">\n \n     <description>Wrapper function for ProbMetab R package.</description>\n \n@@ -12,201 +12,243 @@\n     <command>\n         @COMMAND_CAMERA_SCRIPT@\n         #if $acquisition_options.mode == "one":\n-            mode_acquisition $acquisition_options.mode xa $acquisition_options.xa\n+            mode_acquisition $acquisition_options.mode\n+            image \'$acquisition_options.image\'\n             ##if $acquisition_options.xsetnofill_options.option == "show":\n-\t            ##xsetnofill $acquisition_options.xsetnofill_options.xsetnofill\n-     \t    ##end if\t\n+                ##xsetnofill $acquisition_options.xsetnofill_options.xsetnofill\n+            ##end if\n+\n+            @COMMAND_FILE_LOAD_ONE@\n+\n         #else\n-            mode_acquisition $acquisition_options.mode inputs_mode $acquisition_options.input_mode.option\n+            mode_acquisition $acquisition_options.mode\n+            inputs_mode $acquisition_options.input_mode.option\n             #if $acquisition_options.input_mode.option== "two":\n \n-\t            image_pos $acquisition_options.input_mode.image_pos image_neg $acquisition_options.input_mode.image_neg\n-\t            ##if $acquisition_options.input_mode.xsetnofill_options.option == "show":\n-\t\t            ##xsetPnofill $acquisition_options.input_mode.xsetnofill_options.xsetPnofill xsetNnofill $acquisition_options.input_mode.xsetnofill_options.xsetNnofill\n-         \t\t##end if\t\t\n+                image_pos \'$acquisition_options.input_mode.image_pos\'\n+                image_neg \'$acquisition_options.input_mode.image_neg\'\n+                ##if $acquisition_options.input_mode.xsetnofill_options.option == "show":\n+                    ##xsetPnofill $acquisition_options.input_mode.xsetnofill_options.xsetPnofill\n+                    ##xsetNnofill $acquisition_options.input_mode.xsetnofill_options.xsetNnofill\n+                ##end if\n+\n+                @COMMAND_FILE_LOAD_POSITIVE@\n+                @COMMAND_FILE_LOAD_NEGATIVE@\n             ##else\n-\t            ##image_combinexsannos $acquisition_options.input_mode.image_combinexsannos image_pos $acquisition_options.input_mode.image_pos\n+                ##image_combinexsannos $acquisition_options.input_mode.image_combinexsannos\n+                ##image_pos $acquisition_options.input_mode.image_pos\n             #end if\n \n         #end if\n \n-        #if $option_toexclude.option == "show":\n-        \ttoexclude $option_toexclude.toexclude\n+        ## Extraction of CAMERA annotation [get.annot]\n+        allowMiss $getannot.allowMiss\n+        #if $getannot.option_toexclude.option == "show":\n+            toexclude $getannot.option_toexclude.toexclude\n         #end if\n-        allowMiss $allowMiss html $html kegg_db $kegg_db ppm_tol $ppm_tol\n-        opt $opt corths $corths corprob $corprob pcorprob $pcorprob prob $prob\n-        \n-        @COMMAND_ZIPFILE_LOAD@\n+\n+        ## Database matching [create.reactionM]\n+        kegg_db $db.kegg_db\n+        ppm_tol $db.ppm_tol\n+\n+        ## Probability calculations matrix export [export.class.table]\n+        prob $export.prob\n+        html $export.html\n+\n+        ## Calculate the correlations and partial correlations and cross reference then with reactions [reac2cor]\n+        opt $reac2cor.opt\n+        corprob $reac2cor.corprob\n+        pcorprob $reac2cor.pcorprob\n+        corths $reac2cor.corths\n+\n+        @COMMAND_LOG_EXIT@\n \n     </command>\n \n     <inputs>\n \n         <conditional name="acquisition_options">\n-\t        <param name="mode" type="select" label="Choose your acquisition mode" >\n-\t\t        <option value="one" selected="true"  >One acquisition charge mode</option>\n-            \t<option value="two"  >Two acquisition charge mode (positif and negatif)</option>\n-\t        </param>\n-\n-\t        <!-- One acquisition mode-->\n-\t        <when value="one">\n-\t\t        <param name="xa" type="data" label="Annotate RD'..b'>\n+            <expand macro="test_commun"/>\n+            <expand macro="test_file_load_zip"/>\n+            <assert_stdout>\n+                <has_text text="Step 1... determine cutoff point" />\n+                <has_text text="Step 2... estimate parameters of null distribution and eta0" />\n+                <has_text text="Step 3... compute p-values and estimate empirical PDF/CDF" />\n+                <has_text text="Step 4... compute q-values and local fdr" />\n+            </assert_stdout>\n+        </test>\n+        <test>\n+            <conditional name="acquisition_options">\n+                <param name="mode" value="one" />\n+                <param name="image" value="faahOK-single.xset.merged.group.retcor.group.fillPeaks.annotate.negative.Rdata" />\n+            </conditional>\n+            <expand macro="test_commun"/>\n+            <expand macro="test_file_load_single"/>\n+            <assert_stdout>\n+                <has_text text="Step 1... determine cutoff point" />\n+                <has_text text="Step 2... estimate parameters of null distribution and eta0" />\n+                <has_text text="Step 3... compute p-values and estimate empirical PDF/CDF" />\n+                <has_text text="Step 4... compute q-values and local fdr" />\n+            </assert_stdout>\n         </test>\n     </tests>\n \n \n     <help>\n-\t\n+\n @HELP_AUTHORS@\n \n =========\n@@ -225,7 +267,7 @@\n **Details**\n \n ProbMetab assumes peak detection, retention time correction and peak grouping [4, 5] in order to\n-perform mass peak to compound assignment. \n+perform mass peak to compound assignment.\n \n Once the initial annotation for different forms of the same ion (adducts and isotopes), is defined,\n one can seek for a non-redundant set of putative molecules (after charge and possible adduct\n@@ -235,7 +277,7 @@\n experimental condition. In order to address this issue, a flexible workflow, which allows users to\n integrate different methods, would improve true molecular ions recovery.\n \n-The ion annotation table has the following core information: exact mass of putative molecule with experimental error; isotopic pattern associated; adduct form associated, and the original reference to raw data. \n+The ion annotation table has the following core information: exact mass of putative molecule with experimental error; isotopic pattern associated; adduct form associated, and the original reference to raw data.\n \n \n \n@@ -250,9 +292,9 @@\n ========================= ========================================== ======= ==========\n Name                      Output file                                Format  Parameter\n ========================= ========================================== ======= ==========\n-xcms.annotate             xset.annotate_POS (or NEG).RData RData     RData   file            \t\t\t\n+xcms.annotate             xset.annotate_POS (or NEG).RData RData     RData   file\n ========================= ========================================== ======= ==========\n-  \n+\n \n **General schema of the metabolomic workflow**\n \n@@ -295,7 +337,7 @@\n \n **Calculate**\n \n-**intervals** \n+**intervals**\n A vector of SNR numerical intervals, to which different carbon offset should be added to predicted C-number.\n \n **offset**\n@@ -309,7 +351,7 @@\n \n Which noise model to use, "erfc" to complementary error function, or "gaussian" to standard gaussian with two sd corresponding to the given p.p.m precision.\n \n-**precision** \n+**precision**\n \n Equipment mass accuracy, usually the same used in exact mass search.\n \n@@ -384,6 +426,12 @@\n Changelog/News\n --------------\n \n+**Version 1.1.0 - 06/04/2017**\n+\n+- IMPROVEMENT: add some sections within to separate the different parts of the process\n+\n+- IMPROVEMENT: Probmetab is now compatible with merged individual data from xcms.xcmsSet\n+\n **Version 1.0.1 - 16/05/2016**\n \n - TEST: refactoring to pass planemo test using conda dependencies\n@@ -393,10 +441,8 @@\n \n - NEW: ProbMetab first version\n \n- \n+\n     </help>\n \n     <expand macro="citation" />\n </tool>\n- \n- \n'
b
diff -r 3a9914b37f2f -r abcfa1648b66 README.txt
--- a/README.txt Mon Jul 04 11:58:10 2016 -0400
+++ b/README.txt Fri Apr 07 07:14:12 2017 -0400
b
@@ -1,19 +1,17 @@
 Changelog/News
 --------------
 
+**Version 1.1.0 - 06/04/2017**
+
+- IMPROVEMENT: add some sections within to separate the different parts of the process
+
+- IMPROVEMENT: Probmetab is now compatible with merged individual data from xcms.xcmsSet
+
 **Version 1.0.1 - 16/05/2016**
 
 - TEST: refactoring to pass planemo test using conda dependencies
 
-
 **Version 1.0.0 - 10/06/2015**
 
 - NEW: ProbMetab first version
 
-
-Test Status
------------
-
-Planemo test using conda: passed
-
-Planemo shed_test : passed
b
diff -r 3a9914b37f2f -r abcfa1648b66 lib.r
--- a/lib.r Mon Jul 04 11:58:10 2016 -0400
+++ b/lib.r Fri Apr 07 07:14:12 2017 -0400
[
b'@@ -1,323 +1,400 @@\n-# lib.r ProbMetab version="1.0.0"\r\n-# Author: Misharl Monsoor ABIMS TEAM mmonsoor@sb-roscoff.fr\r\n-# Contributors: Yann Guitton and Jean-francois Martin\r\n-\r\n-\r\n-##Main probmetab function launch by the Galaxy ProbMetab wrapper\r\n-probmetab = function(xa, xaP, xaN, variableMetadata, variableMetadataP, variableMetadataN, listArguments){\r\n-\t##ONE MODE ACQUISITION##\r\n-\tif(listArguments[["mode_acquisition"]]=="one") {\r\n-\t\tcomb=NULL\n-\r\n-\t\t#Get the polarity from xa object\r\n-\t\tpolarity=xa@polarity\r\n-\t\t#SNR option\r\n-\t\tif ("xsetnofill" %in% names(listArguments)) {\r\n-\t\t\tload(listArguments[["xsetnofill"]])\r\n-\t\t\txsetnofill=xset\r\n-\t\t}\r\n-\t\telse{\r\n-\t\t\txsetnofill=NULL\r\n-\t\t}\r\n-\t\t#Exclude samples\r\n-\t\tif ("toexclude" %in% names(listArguments)) {\r\n-\t\t\ttoexclude=listArguments[["toexclude"]]\r\n-\t\t}\r\n-\t\telse {\r\n-\t\t\ttoexclude=NULL\r\n-\t\t}\r\n-\t\tionAnnot=get.annot(xa, polarity=polarity, allowMiss=listArguments[["allowMiss"]],xset=xsetnofill,toexclude=toexclude)\r\n-\t\tcomb=NULL\r\n-\t}\r\n-\r\n-\t##TWO MODES ACQUISITION##\r\n-\t#Mode annotatediffreport\r\n-\telse if(listArguments[["inputs_mode"]]=="two"){\r\n-\t\t##Prepare the objects that will be used for the get.annot function\r\n-\t\tcomb=1\r\n-\t\t\r\n-\r\n-\t\txsetPnofill=NULL\r\n-\t\txsetNnofill=NULL\r\n-\t\t# TODO: a reactiver\t\t\n-\t\t#if ("xsetPnofill" %in% names(listArguments)) {\r\n-\t\t#\tload(listArguments[["xsetPnofill"]])\r\n-\t\t#\txsetPnofill=xset\r\n-\t\t#}\r\n-\t\t#if ("xsetNnofill" %in% names(listArguments)) {\r\n-\t\t#\tload(listArguments[["xsetNnofill"]])\r\n-\t\t#\txsetNnofill=xset\r\n-\t\t#}\r\n-\t\t# include CAMERA non-annotated compounds, and snr retrieval \r\n-\t\t# comb 2+ - used on Table 1\t\r\n-\t\tionAnnotP2plus = get.annot(axP, allowMiss=listArguments[["allowMiss"]], xset=xsetPnofill,toexclude=listArguments[["toexclude"]]) \r\n-\t\tionAnnotN2plus = get.annot(axN, polarity="negative", allowMiss=listArguments[["allowMiss"]], xset=xsetNnofill,toexclude=listArguments[["toexclude"]])\r\n-\t\tionAnnot = combineMolIon(ionAnnotP2plus, ionAnnotN2plus)\r\n-\t\tprint(sum(ionAnnot$molIon[,3]==1))\r\n-\t\tprint(sum(ionAnnot$molIon[,3]==0))\r\n-\t\twrite.table(ionAnnot[1], sep="\\t", quote=FALSE, row.names=FALSE, file="CombineMolIon.tsv")\r\n-\t\t#Merge variableMetadata Negative and positive acquisitions mode\r\n-\t\t\r\n-\r\n-\t\t#Mode combinexsannos TODO bug avec tableau issus de combinexsannos\r\n-\t\t#else {\r\n-\t\t\t#load(listArguments[["image_combinexsannos"]])\r\n-\t\t\t#image_combinexsannos=cAnnot\r\n-\t\t\t##Prepare the objects that will be used for the combineMolIon function\r\n-\t\t\t#load(listArguments[["image_pos"]])\r\n-\t\t\t#image_pos=xa\r\n-\t\t\t#ionAnnot=combineMolIon(peaklist=cAnnot, cameraobj=image_pos, polarity="pos")\r\n-\t\t#}\r\n-\t\t\r\n-\t}\r\n-\r\n-\t##DATABASE MATCHING##\r\n-\tif (listArguments[["kegg_db"]]=="KEGG"){\t\t\r\n-\t\tDB=build.database.kegg(orgID = NULL)\r\n-\t}\r\n-\telse{\t\r\n-\t\ttable_list <<- NULL\r\n-\t\tids=strsplit(listArguments[["kegg_db"]],",")\r\n-\t\tids=ids[[1]]\r\n-\t\tif(length(ids)>1){\r\n-\t\t\tfor(i in 1:length(ids)){\r\n-\t\t\t\t table_list[[i]] <- build.database.kegg(ids[i])\r\n-\t\t\t}\r\n-\t\t\tdb_table=do.call("rbind",table_list)\r\n-\t\t\tDB=unique(db_table)\r\n-\t\t}\r\n-\t\telse{\r\n-\t\t\tDB=build.database.kegg(listArguments[["kegg_db"]])\r\n-\t\t}\r\n-\t}\t\r\n-\t#Matching des mass exactes mesurees avec les masses des compounds KEGG (pas M+H ou M-H)\r\n-\treactionM = create.reactionM(DB, ionAnnot, ppm.tol=listArguments[["ppm_tol"]])\r\n-\t##PROBABILITY RANKING##\r\n-\t# number of masses with candidates inside the fixed mass window\r\n-\t# and masses with more than one candidate\r\n-\tlength(unique(reactionM[reactionM[,"id"]!="unknown",1])) \r\n-\tsum(table(reactionM[reactionM[,"id"]!="unknown",1])>1)\r\n-\t#if (listArguments[["useIso"]]){\r\n-\t\t#BUG TODO\r\n-\t\t# Calculate the ratio between observed and theoretical isotopic patterns.\r\n-\t\t# If you don\'t have an assessment of carbon offset to carbon number prediction \r\n-\t\t# skip this step and use the reactionM as input to weigthM function. \r\n-\t\t#isoPatt < incorporate.isotopes(comb2plus, reactionM, , samp=12:23, DB=DB)  \r\n-\t\t#  calculate   the   likelihood   of   each   mass   to   compound   assignment   using   mass   accuracy,and i'..b'ariableMetadata$name= paste("M",round(variableMetadata$mz),"T",round(variableMetadata$rt),sep="")\n-\treturn (variableMetadata)\n-}\r\n+    # --- variableMetadata ---\n+    peakList=getPeaklist(xa)\n+    peakList=cbind(groupnames(xa@xcmsSet),peakList); colnames(peakList)[1] = c("name");\n+    variableMetadata=peakList[,!(colnames(peakList) %in% c(sampnames(xa@xcmsSet)))]\n+    variableMetadata$name= groupnames(xa@xcmsSet)\n+    return (variableMetadata)\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+        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+    return(list(zipfile=zipfile, singlefile=singlefile))\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+\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+            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+        #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+}\n'
b
diff -r 3a9914b37f2f -r abcfa1648b66 macros.xml
--- a/macros.xml Mon Jul 04 11:58:10 2016 -0400
+++ b/macros.xml Fri Apr 07 07:14:12 2017 -0400
[
@@ -16,29 +16,102 @@
     <token name="@COMMAND_CAMERA_SCRIPT@">
         LANG=C Rscript $__tool_directory__/probmetab.r
     </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_LOG_EXIT@">
+        ;
+        return=\$?;
+        cat 'log.txt';
+        sh -c "exit \$return"
+    </token>
+
+    <!-- raw file load for planemo test -->
+    <token name="@COMMAND_FILE_LOAD_NEUTRAL@">
+        #if $file_load_section_selected.file_load_conditional.file_load_select == "yes":
+            #if $file_load_section_selected.file_load_conditional.input[0].is_of_type("mzxml") or $file_load_section_selected.file_load_conditional.input[0].is_of_type("mzml") or $file_load_section_selected.file_load_conditional.input[0].is_of_type("mzdata") or $file_load_section_selected.file_load_conditional.input[0].is_of_type("netcdf"):
+                #set singlefile_galaxyPath = ','.join( [ str( $single_file ) for $single_file in $file_load_section_selected.file_load_conditional.input ] )
+                #set singlefile_sampleName = ','.join( [ str( $single_file.name ) for $single_file in $file_load_section_selected.file_load_conditional.input ] )
+                singlefile_galaxyPath$polarity '$singlefile_galaxyPath' singlefile_sampleName$polarity '$singlefile_sampleName'
+            #else
+                zipfile$polarity '$file_load_section_selected.file_load_conditional.input'
             #end if
-        #end if    
+        #end if
+    </token>
+
+    <token name="@COMMAND_FILE_LOAD_ONE@">
+        #set file_load_section_selected = $acquisition_options.file_load_section
+        #set polarity=""
+        @COMMAND_FILE_LOAD_NEUTRAL@
+    </token>
+
+    <token name="@COMMAND_FILE_LOAD_POSITIVE@">
+        #set file_load_section_selected = $acquisition_options.file_load_sectionPositive
+        #set polarity="Positive"
+        @COMMAND_FILE_LOAD_NEUTRAL@
+    </token>
+
+    <token name="@COMMAND_FILE_LOAD_NEGATIVE@">
+        #set file_load_section_selected = $acquisition_options.file_load_sectionNegative
+        #set polarity="Negative"
+        @COMMAND_FILE_LOAD_NEUTRAL@
     </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" selected="peakgroups">yes</option>
-            </param>
-            <when value="no">
-            </when>
-            <when value="yes">
-                <param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" />
-            </when>
-        </conditional>
+
+    <xml name="input_file_load" token_polarity="">
+        <section name="file_load_section@POLARITY@" title="@POLARITY@ Resubmit your raw dataset or your zip file">
+            <conditional name="file_load_conditional">
+                <param name="file_load_select" type="select" label="@POLARITY@ 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_commun">
+        <section name="getannot">
+            <param name="allowMiss" value="TRUE" />
+            <conditional name="option_toexclude">
+                <param name="option" value="hide" />
+            </conditional>
+        </section>
+        <section name="db">
+            <param name="kegg_db" value="KEGG" />
+            <param name="ppm_tol" value="8" />
+        </section>
+        <section name="export">
+            <param name="prob" value="count" />
+            <param name="html" value="FALSE" />
+        </section>
+        <section name="reac2cor">
+            <param name="opt" value="cor" />
+            <param name="corprob" value="0.8" />
+            <param name="pcorprob" value="0.8" />
+            <param name="corths" value="0.75" />
+        </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" token_polarity="">>
+        <section name="file_load_section@POLARITY@">
+            <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="@HELP_AUTHORS@">
 .. class:: infomark
 
@@ -49,7 +122,7 @@
 
 .. class:: infomark
 
-**Galaxy integration** Misharl Monsoor misharl.monsoor@sb-roscoff.fr ABIMS TEAM, Station biologique de Roscoff.
+**Galaxy integration** Misharl Monsoor misharl.monsoor@sb-roscoff.fr (and Gildas Le CorguillĂ©) from ABIMS TEAM, Station biologique de Roscoff.
 
  | Contact support@workflow4metabolomics.org for any questions or concerns about the Galaxy implementation of this tool.
 
b
diff -r 3a9914b37f2f -r abcfa1648b66 probmetab.r
--- a/probmetab.r Mon Jul 04 11:58:10 2016 -0400
+++ b/probmetab.r Fri Apr 07 07:14:12 2017 -0400
[
@@ -4,7 +4,7 @@
 
 
 # ----- LOG -----
-log_file=file("probmetab.log", open = "wt")
+log_file=file("log.txt", open = "wt")
 sink(log_file)
 sink(log_file, type = "out")
 
@@ -12,8 +12,8 @@
 cat("\tPACKAGE INFO\n")
 pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "igraph", "xcms","snow","CAMERA","batch","ProbMetab")
 for(p in pkgs) {
- suppressWarnings( suppressPackageStartupMessages( stopifnot( library(p, quietly=TRUE, logical.return=TRUE, character.only=TRUE))))
- cat(p,"\t",as.character(packageVersion(p)),"\n",sep="")
+    suppressWarnings( suppressPackageStartupMessages( stopifnot( library(p, quietly=TRUE, logical.return=TRUE, character.only=TRUE))))
+    cat(p,"\t",as.character(packageVersion(p)),"\n",sep="")
 }
 
 source_local <- function(fname){
@@ -21,9 +21,14 @@
     base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
     source(paste(base_dir, fname, sep="/"))
 }
+
+options(bitmapType='cairo')
+
 cat("\n\n")
+
+
 # ----- ARGUMENTS -----
-cat("\tARGUMENTS INFO\n") 
+cat("\tARGUMENTS INFO\n")
 listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
 write.table(as.matrix(listArguments), col.names=F, quote=F, sep='\t')
 
@@ -35,68 +40,59 @@
 # ----- INFILE PROCESSING -----
 
 if(listArguments[["mode_acquisition"]]=="one") {
- load(listArguments[["xa"]])
-    
-    if (!is.null(listArguments[["zipfile"]])){
-        zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
-    }
-
-    #Unzip the chromatograms file for plotting EIC pour the HTML file
- if(exists("zipfile"))
- {
- if (zipfile!=""){
- directory=unzip(zipfile)
- }
- }
- if (!exists("xa")) {
- xa=xsAnnotate_object
- }
- source_local("lib.r")
- if (!exists("variableMetadata")) variableMetadata= getVariableMetadata(xa);
-
+    load(listArguments[["image"]])
+    cat("\t\tXA OBJECT INFO\n")
+    print(xa)
+
+    source_local("lib.r")
+    if (!exists("zipfile")) zipfile=NULL
+    if (!exists("singlefile")) singlefile=NULL
+    rawFilePath = getRawfilePathFromArguments(singlefile, zipfile, listArguments)
+    zipfile = rawFilePath$zipfile
+    singlefile = rawFilePath$singlefile
+    retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)
+
+    if (!exists("variableMetadata")) variableMetadata= getVariableMetadata(xa);
+
 } else if(listArguments[["inputs_mode"]]=="two"){
- load(listArguments[["image_pos"]])
-    
-    if (!is.null(listArguments[["zipfile"]])){
-        zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
-    }
-    
- #Unzip the chromatograms file for plotting EIC pour the HTML file
- if(exists("zipfile")) {
- if (zipfile!=""){
- directory=unzip(zipfile)
- }
- }
- if (!exists("xa")) {
- xa=xsAnnotate_object
- }
- xaP=xa
- source_local("lib.r")
- if (!exists("variableMetadata")) variableMetadataP= getVariableMetadata(xa)
- else variableMetadataP=variableMetadata
+
+    # POSITIVE
+    load(listArguments[["image_pos"]])
 
+    if (!exists("xa")) xaP=xsAnnotate_object
+    else xaP=xa
+    cat("\t\tXA-POSITIVE OBJECT INFO\n")
+    print(xaP)
+
+    if (!exists("variableMetadata")) variableMetadataP = getVariableMetadata(xa)
+    else variableMetadataP = variableMetadata
 
- load(listArguments[["image_neg"]])
-    
-    if (!is.null(listArguments[["zipfile"]])){
-        zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
-    }
-    
- #Unzip the chromatograms file for plotting EIC pour the HTML file
- if(exists("zipfile")) {
-
-   if (zipfile!=""){
- directory=unzip(zipfile)
- }
- }
- if (!exists("xa")) {
- xa=xsAnnotate_object
- }
- xaN=xa
- source_local("lib.r")
-
- if (!exists("variableMetadata")) variableMetadataN= getVariableMetadata(xa)
- else variableMetadataN=variableMetadata
+    source_local("lib.r")
+    if (!exists("zipfile")) zipfile=NULL
+    if (!exists("singlefile")) singlefile=NULL
+    rawFilePath = getRawfilePathFromArguments(singlefile, zipfile, listArguments)
+    zipfilePos = rawFilePath$zipfile
+    singlefilePos = rawFilePath$singlefile
+    retrieveRawfileInTheWorkingDirectory(singlefilePos, zipfilePos)
+
+    # NEGATIVE
+    load(listArguments[["image_neg"]])
+
+    if (!exists("xa"))  xaN=xsAnnotate_object
+    else xaN=xa
+    cat("\t\tXA-NEGATIVE OBJECT INFO\n")
+    print(xaP)
+
+    if (!exists("variableMetadata")) variableMetadataN = getVariableMetadata(xa)
+    else variableMetadataN = variableMetadata
+
+    source_local("lib.r")
+    if (!exists("zipfile")) zipfile=NULL
+    if (!exists("singlefile")) singlefile=NULL
+    rawFilePath = getRawfilePathFromArguments(singlefile, zipfile, listArguments)
+    zipfileNeg = rawFilePath$zipfile
+    singlefileNeg = rawFilePath$singlefile
+    retrieveRawfileInTheWorkingDirectory(singlefileNeg, zipfileNeg)
 }
 
 #Import the different functions
@@ -107,13 +103,12 @@
 cat("\tMAIN PROCESSING INFO\n")
 
 if(listArguments[["mode_acquisition"]]=="one") {
- results=probmetab(xa=xa, variableMetadata=variableMetadata,listArguments=listArguments)
+    results=probmetab(xa=xa, variableMetadata=variableMetadata,listArguments=listArguments)
 } else if(listArguments[["inputs_mode"]]=="two"){
- results=probmetab(xaP=xaP, xaN=xaN,variableMetadataP=variableMetadataP, variableMetadataN=variableMetadataN, listArguments=listArguments)
+    results=probmetab(xaP=xaP, xaN=xaN,variableMetadataP=variableMetadataP, variableMetadataN=variableMetadataN, listArguments=listArguments)
 }
 #delete the parameters to avoid the passage to the next tool in .RData image
 #rm(listArguments)
 cat("\tDONE\n")
 #saving R data in .Rdata file to save the variables used in the present tool
 #save.image(paste("probmetab","RData",sep="."))
-
b
diff -r 3a9914b37f2f -r abcfa1648b66 static/images/probmetab_workflow.png
b
Binary file static/images/probmetab_workflow.png has changed
b
diff -r 3a9914b37f2f -r abcfa1648b66 test-data/faahOK-single.xset.merged.group.retcor.group.fillPeaks.annotate.negative.Rdata
b
Binary file test-data/faahOK-single.xset.merged.group.retcor.group.fillPeaks.annotate.negative.Rdata has changed
b
diff -r 3a9914b37f2f -r abcfa1648b66 test-data/ko15.CDF
b
Binary file test-data/ko15.CDF has changed
b
diff -r 3a9914b37f2f -r abcfa1648b66 test-data/ko16.CDF
b
Binary file test-data/ko16.CDF has changed
b
diff -r 3a9914b37f2f -r abcfa1648b66 test-data/wt15.CDF
b
Binary file test-data/wt15.CDF has changed
b
diff -r 3a9914b37f2f -r abcfa1648b66 test-data/wt16.CDF
b
Binary file test-data/wt16.CDF has changed