diff lcmsmatching.xml @ 1:253d531a0193 draft

planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 36c9d8099c20a1ae848f1337c16564335dd8fb2b
author prog
date Sat, 03 Sep 2016 17:02:01 -0400
parents e66bb061af06
children 20d69a062da3
line wrap: on
line diff
--- a/lcmsmatching.xml	Tue Jul 12 12:02:37 2016 -0400
+++ b/lcmsmatching.xml	Sat Sep 03 17:02:01 2016 -0400
@@ -1,6 +1,6 @@
-<tool id="lcmsmatching" name="LC/MS matching" version="2.1.3">
+<tool id="lcmsmatching" name="LC/MS matching" version="3.0">
 
-	<description>Matching of mz/rt values onto local reference compound database.</description>
+	<description>Annotation of MS peaks using matching on a spectra database.</description>
 
 	<requirements>
 		<requirement type="package" version="3.2.2">R</requirement>
@@ -8,17 +8,33 @@
 		<requirement type="package" version="1.0.0">r-stringr</requirement>
 		<requirement type="package" version="1.8.3">r-plyr</requirement>
 		<requirement type="package" version="3.98">r-xml</requirement>
+		<requirement type="package" version="1.0_6">r-bitops</requirement>
+		<requirement type="package" version="1.95">r-rcurl</requirement>
+		<requirement type="package" version="1.3">r-rjsonio</requirement>
 	</requirements>
 
+	<code file="list-chrom-cols.py"/>
+
 	<!--~~~~~~~
 	~ COMMAND ~
 	~~~~~~~~-->
 
-	<command><![CDATA[
+	<command>
+		<![CDATA[
+		## @@@BEGIN_CHEETAH@@@
 		$__tool_directory__/search-mz -i "$mzrtinput"
 
 		## Database
-		-d file --url "$dbfile"
+		#if $db.dbtype == "inhouse"
+			-d file
+			--db-fields "$db.dbfields"
+			--db-ms-modes "$db.dbmsmodes"
+		#end if
+		#if $db.dbtype == "peakforest"
+			-d peakforest
+			--db-token "$db.dbtoken"
+		#end if
+			--url "$db.dburl"
 
 		## M/Z matching
 		-m $mzmode -p $mzprec -s $mzshift
@@ -27,16 +43,13 @@
 		#if $prec.match == "true"
 			--precursor-match --pos-prec "$prec.pos" --neg-prec "$prec.neg"
 		#end if
-		#if $prec.match == "true" and $rt.match == "true"
-			--precursor-rt-tol $rt.tolz
+		#if $prec.match == "true" and $chromcols:
+			--precursor-rt-tol $tolz
 		#end if
 
 		## Chromatographic columns options and retention matching 
-		#if $rt.match == "true" and $rt.cols.all == "true"
-			--all-cols --rttolx $rt.tolx --rttoly $rt.toly
-		#end if
-		#if $rt.match == "true" and $rt.cols.all == "false" and $rt.cols.list != ""
-			-c "$rt.cols.list" --check-cols	--rttolx $rt.tolx --rttoly $rt.toly
+		#if $chromcols:
+			-c "$chromcols" --check-cols --rttolx $tolx --rttoly $toly
 		#end if
 
 		## Table outputs 
@@ -45,10 +58,8 @@
 		## HTML output 
 		--html-output-file "$htmloutput" --no-main-table-in-html-output
 
-		## Fields 
+		## Fields of input file
 		--input-col-names "$inputfields"
-		--db-fields "$dbfields"
-		--db-ms-modes "$dbmsmodes"
 
 		## Ouput setting
 		#if $out.enabled == "true"
@@ -57,7 +68,7 @@
 		#else
 			--molids-sep "|"
 		#end if
-
+		## @@@END_CHEETAH@@@
 	]]></command>
 
 	<!--~~~~~~
@@ -68,73 +79,64 @@
 
 		<!-- DATABASE -->
 
-			<!-- Database file -->
-			<param name="dbfile" label="Database file" type="data" format="tabular" help="Decimal: '.', missing: NA, mode: character and numerical, sep: tabular. Retention time values must be in seconds."/>
+		<conditional name="db">
+
+			<param name="dbtype" label="Database" type="select" refresh_on_change="true">
+				<option value="inhouse">In-house</option>
+				<option value="peakforest">Peakforest</option>
+			</param>
+
+			<when value="inhouse">
+				<!-- Database file -->
+				<param name="dburl" label="Database file" type="data" format="tabular,tsv" refresh_on_change="true" help="Decimal: '.', missing: NA, mode: character and numerical, sep: tabular. Retention time values must be in seconds."/>
+
+				<!-- File database field names -->
+				<param name="dbfields" label="File database column names" type="text" size="256" value="mztheo=mztheo,colrt=colrt,molid=molid,col=col,mode=mode,attr=attr,comp=comp,molnames=molnames,molcomp=molcomp,molmass=molmass,inchi=inchi,inchikey=inchikey,pubchem=pubchem,chebi=chebi,hmdb=hmdb,kegg=kegg" refresh_on_change="true" help=""/>
 
-			<!-- File database field names -->
-			<param name="dbfields" label="File database column names" type="text" size="256" value="mztheo=mztheo,colrt=colrt,molid=molid,col=col,mode=mode,attr=attr,comp=comp,molnames=molnames,molcomp=molcomp,molmass=molmass,inchi=inchi,inchikey=inchikey,pubchem=pubchem,chebi=chebi,hmdb=hmdb,kegg=kegg" help=""/>
+				<!-- File database MS modes -->
+				<param name="dbmsmodes" label="File database MS modes" type="text" size="32" value="pos=POS,neg=NEG" help=""/>
+
+				<param name="dbtoken" type="text" size="32" value="" hidden="true"/>
+			</when>
 
-			<!-- File database MS modes -->
-			<param name="dbmsmodes" label="File database MS modes" type="text" size="32" value="pos=POS,neg=NEG" help=""/>
+			<when value="peakforest">
+				<param name="dburl" type="text" size="128" value="https://peakforest-alpha.inra.fr/rest" refresh_on_change="true"/>
+
+				<param name="dbtoken" label="Peakforest security token" type="text" size="32" value="" refresh_on_change="true" help="If you do not have yet a Peakforest token, go to Peakforest website and request one from your account."/>
+
+				<param name="dbfields" type="text" size="32" value="" hidden="true"/>
+			</when>
+		</conditional>
 
 		<!-- INPUT -->
 
 			<!-- Input file -->
-			<param name="mzrtinput" label="Input file - MZ(/RT) values" type="data" format="tabular" help="Decimal: '.', missing: NA, mode: character and numerical, sep: tabular. RT values must be in seconds."/>
+			<param name="mzrtinput" label="Input file - MZ(/RT) values" type="data" format="tabular,tsv" help="Decimal: '.', missing: NA, mode: character and numerical, sep: tabular. RT values must be in seconds."/>
 
 			<!-- Input field names -->
 			<param name="inputfields" label="Input file column names" type="text" size="32" value="mz=mzmed,rt=rtmed" help=""/>
 
 		<!-- M/Z MATCHING -->
-<!--		<conditional name="mz">
 
-			<param name="enabled" label="M/Z matching" type="select">
-				<option value="true">Show</option>
-				<option value="false">Hide</option>
+			<!-- Mode -->
+			<param name="mzmode" label="MS mode" type="select" display="radio" multiple="false" help="">
+				<option value="pos">Positive</option>
+				<option value="neg">Negative</option>
 			</param>
 
-			<when value="true">-->
-				<!-- Mode -->
-				<param name="mzmode" label="MS mode" type="select" display="radio" multiple="false" help="">
-					<option value="pos">Positive</option>
-					<option value="neg">Negative</option>
-				</param>
-
-				<!-- MZ matching parameters -->
-				<param name="mzprec" label="M/Z precision (in ppm)" type="float" help="" value="5"/>
-				<param name="mzshift" label="M/Z shift (in ppm)" type="float" help="" value="0"/>
-			<!--</when>
-			<when value="false"></when>
-		</conditional>-->
+			<!-- MZ matching parameters -->
+			<param name="mzprec" label="M/Z precision (in ppm)" type="float" help="" value="5"/>
+			<param name="mzshift" label="M/Z shift (in ppm)" type="float" help="" value="0"/>
 
 		<!-- RETENTION TIME PARAMETERS -->
-		<conditional name="rt">
 
-			<param name="match" label="Retention time match" type="select">
-				<option value="false">Off</option>
-				<option value="true">On</option>
-			</param>
+			<!-- List of chromatographic columns -->
+			<param name="chromcols" type="select" label="Chromatographic columns" multiple="true" dynamic_options="get_chrom_cols(dbtype = db['dbtype'], dburl = db['dburl'], dbtoken = db['dbtoken'], dbfields = db['dbfields'])" help="Select here the set of chromatographic columns against which the retention time matching will be run."/>
 
-			<when value="false"></when>
-			<when value="true">
-				<!-- Columns -->
-		<conditional name="cols">
-			<param name="all" label="All chromatographic columns" type="select">
-				<option value="true">Yes</option>
-				<option value="false">No</option>
-			</param>
-			<when value="true"></when>
-			<when value="false">
-				<param name="list" label="Chromatographic columns" type="text" size="64" value="" help="Set here the list of chromatographic columns against which the retention time matching will be run. This is a comma separated list of the column names as used instead the database file."/>
-			</when>
-		</conditional>
-
-				<!-- Tolerances -->
-				<param name="tolx" label="RTX retention time tolerance, parameter x (in seconds)" type="float" help="" value="5"/>
-				<param name="toly" label="RTY retention time tolerance, parameter y" type="float" help="" value="0.8"/>
-				<param name="tolz" label="RTZ retention time tolerance, used when precursor matching is enabled." type="float" help="" value="5"/>
-			</when>
-		</conditional>
+			<!-- Tolerances -->
+			<param name="tolx" label="RTX retention time tolerance, parameter x (in seconds)" type="float" help="" value="5"/>
+			<param name="toly" label="RTY retention time tolerance, parameter y" type="float" help="" value="0.8"/>
+			<param name="tolz" label="RTZ retention time tolerance, used when precursor matching is enabled." type="float" help="" value="5"/>
 
 		<!-- PRECURSOR MATCH -->
 		<conditional name="prec">
@@ -221,18 +223,35 @@
 
 	<tests>
 
-		<!-- Simple quick test -->
+		<!-- File database test -->
 		<test>
-			<param name="dbfile" value="filedb.tsv"/>
+			<param name="dbtype" value="inhouse"/>
+			<param name="dburl" value="filedb.tsv"/>
+			<param name="dbfields" value=""/>
+			<param name="dbmsmodes" value=""/>
 			<param name="mzrtinput" value="mz-input-small.tsv"/>
 			<param name="inputfields" value=""/>
-			<param name="dbfields" value=""/>
-			<param name="dbmsmodes" value=""/>
 			<param name="mzmode" value="pos"/>
 			<output name="mainoutput" file="filedb-small-mz-match-output.tsv"/>
 			<output name="peaksoutput" file="filedb-small-mz-match-peaks-output.tsv"/>
 			<output name="htmloutput" file="filedb-small-mz-match-html-output.html"/>
 		</test>
+
+		<!-- File database test -->
+<!--
+		<test>
+			<param name="dbtype" value="peakforest"/>
+			<param name="dbtoken" value="@PEAKFOREST_TOKEN@"/>
+			<param name="mzrtinput" value="mz-input-small.tsv"/>
+			<param name="inputfields" value=""/>
+			<param name="mzmode" value="pos"/>
+			<output name="mainoutput">
+				<assert_contents>
+					<has_text text="mz"/>
+				</assert_contents>
+			</output>
+		</test>
+-->
 	</tests>
 
 	<!--~~~~
@@ -246,7 +265,17 @@
 LC/MS matching
 ==============
 
-This tool performs LC/MS matching on an input list of MZ/RT values, using a provided single file database.
+This tool performs LC/MS matching on an input list of MZ/RT values, using either a provided in-house single file database or a connection to Peakforest database.
+
+--------
+Database
+--------
+
+When selecting the database, you have the choice between a Peakforest database or an in-house file.
+
+For the Peakforest database, a default REST web base address is already provided. But you can change it of you want to use a custom database. A field is also available for setting a token key in case the access to the Peakforest database you want to use is restricted. This is the case of the default database.
+
+For the in-house file, please refer to the paragraph "Single file database" below.
 
 -----------
 Input files