Mercurial > repos > lecorguille > xcms_merge
changeset 0:9063eaae5112 draft
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 481448087f0e09c131b24f7d552db69f3552d371-dirty
author | lecorguille |
---|---|
date | Wed, 08 Feb 2017 06:27:18 -0500 |
parents | |
children | f15c64ecf378 |
files | macros.xml test-data/MM14-xset.RData test-data/MM8-xset.RData test-data/ko15-xset.RData test-data/ko16-xset.RData test-data/sampleMetadata.tab test-data/wt15-xset.RData test-data/wt16-xset.RData xcms_merge.xml |
diffstat | 9 files changed, 362 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Wed Feb 08 06:27:18 2017 -0500 @@ -0,0 +1,132 @@ +<?xml version="1.0"?> +<macros> + <xml name="requirements"> + <requirements> + <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> + </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" /> + </stdio> + </xml> + + <token name="@COMMAND_XCMS_SCRIPT@"> + LANG=C Rscript $__tool_directory__/xcms.r + </token> + + <token name="@COMMAND_LOG_EXIT@"> + ; + return=\$?; + mv log.txt $log; + cat $log; + sh -c "exit \$return" + </token> + + <!-- zipfile load for planemo test --> + + <token name="@COMMAND_FILE_LOAD@"> + #if $file_load_conditional.file_load_select == "yes": + #if $file_load_conditional.inputs.input == "zip_file": + zipfile $file_load_conditional.inputs.zip_file + #else + #set singlefile_galaxyPath = ','.join( [ str( $single_file ) for $single_file in $file_load_conditional.inputs.single_file ] ) + #set singlefile_sampleName = ','.join( [ str( $single_file.name ) for $single_file in $file_load_conditional.inputs.single_file ] ) + + singlefile_galaxyPath $singlefile_galaxyPath singlefile_sampleName $singlefile_sampleName + #end if + #end if + </token> + + <xml name="file_load"> + <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"> + <conditional name="inputs"> + <param name="input" type="select" label="Choose your inputs method" > + <option value="zip_file" selected="true">Zip file from your history containing your chromatograms</option> + <option value="single_file">A mzXML or netCDF file from your history</option> + </param> + <when value="zip_file"> + <param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" /> + </when> + <when value="single_file"> + <param name="single_file" type="data" format="mzxml,netcdf" label="Single file" multiple="true"/> + </when> + </conditional> + </when> + </conditional> + </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="false" /> + </conditional> + </xml> + + <xml name="output_peaklist"> + <data name="variableMetadata" format="tabular" label="${image.name[:-6]}.fillPeaks.variableMetadata.tsv"> + <filter>(peaklist['peaklistBool'])</filter> + </data> + <data name="dataMatrix" format="tabular" label="${image.name[:-6]}.fillPeaks.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 + +.. class:: infomark + +**Galaxy integration** ABiMS TEAM - UPMC/CNRS - Station biologique de Roscoff and Yann Guitton yann.guitton@oniris-nantes.fr - part of Workflow4Metabolomics.org [W4M] + + | Contact support@workflow4metabolomics.org for any questions or concerns about the Galaxy implementation of this tool. + +--------------------------------------------------- + + </token> + + + <xml name="citation"> + <citations> + <citation type="doi">10.1021/ac051437y</citation> + <citation type="doi">10.1093/bioinformatics/btu813</citation> + </citations> + </xml> +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/sampleMetadata.tab Wed Feb 08 06:27:18 2017 -0500 @@ -0,0 +1,6 @@ +wt16 WT +ko16 KO +wt15 WT +ko15 KO +ko10 KO +foobar01 FOOBAR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xcms_merge.xml Wed Feb 08 06:27:18 2017 -0500 @@ -0,0 +1,224 @@ +<tool id="xcms_merge" name="xcms.xcmsSet Merger" version="1.0.0"> + <description>Merge xcms.xcmsSet xset in one to be used by group</description> + + <macros> + <import>macros.xml</import> + </macros> + + <expand macro="requirements_light"/> + <expand macro="stdio"/> + + <command><![CDATA[ + Rscript $script_file + ]]></command> + + <configfiles> + <configfile name="script_file"><![CDATA[ +suppressPackageStartupMessages(library(xcms, quietly=TRUE)) + +images=c( +"${"\",\"".join(map(str, $images))}" +) + + +cat("\tXSET MERGING...\n") + +for(image in images) { + load(image) + cat(sampleNamesList\$sampleNamesOrigin,"\n") + if (!exists("xset_merged")) { + xset_merged=xset + singlefile_merged=singlefile + listOFlistArguments_merged=listOFlistArguments + md5sumList_merged=md5sumList + sampleNamesList_merged=sampleNamesList + } else { + xset_merged=c(xset_merged,xset) + singlefile_merged=c(singlefile_merged,singlefile) + listOFlistArguments_merged=c(listOFlistArguments_merged,listOFlistArguments) + md5sumList_merged\$origin=rbind(md5sumList_merged\$origin,md5sumList\$origin) + sampleNamesList_merged\$sampleNamesOrigin=c(sampleNamesList_merged\$sampleNamesOrigin,sampleNamesList\$sampleNamesOrigin) + sampleNamesList_merged\$sampleNamesMakeNames=c(sampleNamesList_merged\$sampleNamesMakeNames,sampleNamesList\$sampleNamesMakeNames) + } +} +rm(image) +xset=xset_merged; rm(xset_merged) +singlefile=singlefile_merged; rm(singlefile_merged) +listOFlistArguments=listOFlistArguments_merged; rm(listOFlistArguments_merged) +md5sumList=md5sumList_merged; rm(md5sumList_merged) +sampleNamesList=sampleNamesList_merged; rm(sampleNamesList_merged) + +#if str($sampleMetadata) != 'None': + cat("\tXSET PHENODATA SETTING...\n") + sampleMetadata=read.table("$sampleMetadata", h=F, sep=";", stringsAsFactors=F) + if (ncol(sampleMetadata) < 2) sampleMetadata=read.table("$sampleMetadata", h=F, sep="\t", stringsAsFactors=F) + if (ncol(sampleMetadata) < 2) sampleMetadata=read.table("$sampleMetadata", h=F, sep=",", stringsAsFactors=F) + if (ncol(sampleMetadata) < 2) { + error_message="Your sampleMetadata file seems not well formatted. The column separators accepted are ; , and tabulation" + print(error_message) + stop(error_message) + } + + sampclass(xset)=sampleMetadata\$V2[match(rownames(xset@phenoData),sampleMetadata\$V1)] +#end if + + + +cat("\tXSET OBJECT INFO\n") + +print(xset@phenoData) +print(xset) + +cat("\tSAVE RData\n") +save.image("$xsetRData") + + ]]></configfile> + </configfiles> + + <inputs> + <param name="images" type="data" format="rdata.xcms.raw,rdata" label="xset RData / xcms.xcmsSet file" help="output file from another xcms.xcmsSet" multiple="true" /> + <param name="sampleMetadata" label="Sample metadata file " format="tabular" type="data" optional="true" help="must contain at least one column with the sample id and one column with the sample class"/> + </inputs> + + <outputs> + <data name="xsetRData" format="rdata.xcms.raw" label="xset.merged.RData" /> + </outputs> + + <tests> + <test> + <param name="images" value="ko15-xset.RData,ko16-xset.RData,wt15-xset.RData,wt16-xset.RData" /> + <assert_stdout> + <has_text text="object with 4 samples" /> + <has_text text="Time range: 2506.1-4477.9 seconds (41.8-74.6 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: ." /> + </assert_stdout> + </test> + <test> + <param name="images" value="ko15-xset.RData,ko16-xset.RData,wt15-xset.RData,wt16-xset.RData" /> + <param name="sampleMetadata" value="sampleMetadata.tab" /> + <assert_stdout> + <has_text text="ko15 KO" /> + <has_text text="ko16 KO" /> + <has_text text="wt15 WT" /> + <has_text text="wt16 WT" /> + <has_text text="object with 4 samples" /> + <has_text text="Time range: 2506.1-4477.9 seconds (41.8-74.6 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_stdout> + </test> + <test> + <param name="images" value="MM8-xset.RData,MM14-xset.RData" /> + <assert_stdout> + <has_text text="object with 2 samples" /> + <has_text text="Time range: 19.7-307.3 seconds (0.3-5.1 minutes)" /> + <has_text text="Mass range: 117.0357-936.7059 m/z" /> + <has_text text="Peaks: 236 (about 118 per sample)" /> + <has_text text="Peak Groups: 0" /> + <has_text text="Sample classes: ." /> + </assert_stdout> + </test> + </tests> + + <help><![CDATA[ + +@HELP_AUTHORS@ + +=================== +Xcms.xcmsSet Merger +=================== + +----------- +Description +----------- + +This tool will allow you to run one xcms.xcmsSet process per sample in parallel and then to merge all RData images in one. +The result is then suitable for xcms.group. + +You can provide a sampleMetadata table to attribute phenotypic value to your samples. + + +----------------- +Workflow position +----------------- + +**Upstream tools** + +========================= ================= =================== ========== +Name output file format parameter +========================= ================= =================== ========== +xcms.xcmsSet xset.RData rdata.xcms.raw RData file +------------------------- ----------------- ------------------- ---------- +xcms.xcmsSet xset.RData rdata.xcms.raw RData file +------------------------- ----------------- ------------------- ---------- +xcms.xcmsSet xset.RData rdata.xcms.raw RData file +------------------------- ----------------- ------------------- ---------- +... ... ... ... +========================= ================= =================== ========== + + +**Downstream tools** + ++---------------------------+--------------------+-----------------+ +| Name | Output file | Format | ++===========================+====================+=================+ +|xcms.group | xset.RData | rdata.xcms.raw | ++---------------------------+--------------------+-----------------+ + + +----------- +Input files +----------- + ++---------------------------+-----------------------+ +| Parameter : num + label | Format | ++===========================+=======================+ +| 1 : RData file | rdata.xcms.raw | ++---------------------------+-----------------------+ +| 2 : RData file | rdata.xcms.raw | ++---------------------------+-----------------------+ +| N : RData file | rdata.xcms.raw | ++---------------------------+-----------------------+ +| Optional : sampleMetadata | tsv or csv | ++---------------------------+-----------------------+ + +Example of a sampleMetadata: + ++---------------------------+------------+ +|HU_neg_028 | bio | ++---------------------------+------------+ +|HU_neg_034 | bio | ++---------------------------+------------+ +|Blanc04 | blank | ++---------------------------+------------+ +|Blanc06 | blank | ++---------------------------+------------+ +|Blanc09 | blank | ++---------------------------+------------+ + +------------ +Output files +------------ + +xset.merged.RData: rdata.xcms.raw format + + | Rdata file that is necessary in the next step of the workflow "xcms.group". + +--------------------------------------------------- + +Changelog/News +-------------- + +**Version 1.0.0 - 03/02/2017** + +- NEW: a new tool to merge individual xcmsSet outputs to be used by xcms.group + + ]]></help> + + <expand macro="citation" /> +</tool>