diff trj.xml @ 5:cdf93d057569 draft

"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tools/gromacs commit 98e34b799346c6bbe5d28d4659d93d92cc7827cc"
author chemteam
date Tue, 20 Oct 2020 10:38:49 +0000
parents 9363254ef848
children 6dcfdac2dcae
line wrap: on
line diff
--- a/trj.xml	Wed May 20 12:58:22 2020 -0400
+++ b/trj.xml	Tue Oct 20 10:38:49 2020 +0000
@@ -2,13 +2,19 @@
     <description>using trjconv and trjcat</description>
     <macros>
         <import>macros.xml</import>
-        <token name="@GALAXY_VERSION@">0</token>
+        <token name="@GALAXY_VERSION@">1</token>
+        <xml name="fit_when" token_option="none">
+            <when value="@OPTION@">
+                <param name="index_fit" type="text" label="Index of group to use for fitting" help="Index of group to use for fitting - i.e. the group's position in the ndx file (using zero-based numbering, so the first group has index 0).">
+                    <validator type="regex" message="Only numeric values allowed">^[0-9]*$</validator>
+                </param>
+            </when>
+        </xml>
     </macros>
 
     <expand macro="requirements" />
 
     <command detect_errors="exit_code"><![CDATA[
-
     #if $trj.trj_op == 'trjcat':
         mkdir trajs &&
         #for $value, $file in enumerate($trj_input):
@@ -24,30 +30,44 @@
         ln -s '$ndx_input' ./index.ndx &&
         ln -s '$str_input' ./str.${str_input.ext} &&
         ln -s '$trj_input' ./traj.${trj_input.ext} &&
-        #if $trj.center:
-            echo '$trj.index_center $trj.index_output' | gmx trjconv
-        #else
-            echo '$trj.index_output' | gmx trjconv
-        #end if
-            -f ./traj.${trj_input.ext}
-            -s ./str.${str_input.ext}
+
+    echo ## optionally pipe in the following
+	#if $trj.fit.fit != 'none':
+	    '$trj.fit.index_fit'
+    #end if
+    #if $trj.pbc.pbc == 'cluster':
+	    '$trj.pbc.index_cluster'
+    #end if
+    '$trj.index_center'	'$trj.index_output' | gmx trjconv
+      	-f ./traj.${trj_input.ext}
+        -s ./str.${str_input.ext}
+        #if $ndx_input:
             -n ./index.ndx
-            $trj.center
-            -pbc $trj.pbc
-            -ur $trj.ur
-            -boxcenter $trj.boxcenter
-            #if $time.e != -1:
-                -e '$time.e'
-            #end if
-
+        #end if
+        #if $trj.index_center:
+            -center
+        #end if
+        #if $trj.sep:
+            -sep
+            -nzero 9  ## hopefully the traj has < 1 bn frames, or collection order will be wrong
+        #end if
+        -pbc $trj.pbc.pbc
+        -ur $trj.ur
+        -boxcenter $trj.boxcenter
+        -fit $trj.fit.fit
+        #if $time.e != -1:
+            -e '$time.e'
+        #end if
     #end if
 
     -b '$time.b'
     -dt '$time.dt'
     -o ./output.${output_format} &&
-    &>> verbose.txt &&
-    mv ./output.${output_format} '$output'
-
+    &>> verbose.txt
+    #if not $trj.sep:
+        &&
+        mv ./output.${output_format} '$output'
+    #end if
     ]]></command>
 
     <inputs>
@@ -57,27 +77,43 @@
                 <option value="trjcat">Concatenate (trjcat)</option>
             </param>
             <when value="trjconv">
-                <param name="trj_input" type="data" format='xtc,trr' label="Input trajectory" help="In XTC or TRR format."/>
+                <param name="trj_input" type="data" format='xtc,trr,pdb,gro' label="Input trajectory" help="In XTC or TRR format; structure files with PDB or GRO format can also be used."/>
                 <param name="str_input" type="data" format='pdb,gro,tpr' label="Input structure" help="In PDB, GRO or TPR format."/>
-                <param name="ndx_input" type="data" format='ndx' label="Index (NDX) file" help="In NDX format."/>
-                <param name="index_output" type="text" label="Index of group to save in the output" help="Index of group to save in the output - i.e. the group's position in the ndx file (using zero-based numbering, so the first group has index 0).">
+                <param name="ndx_input" type="data" format='ndx' label="Index (NDX) file" optional="true" help="In NDX format. Optional."/>
+                <param name="index_output" value="0" type="text" label="Index of group to save in the output" help="Index of group to save in the output - i.e. the group's position in the ndx file (using zero-based numbering, so the first group has index 0).">
                     <validator type="regex" message="Only numeric values allowed">^[0-9]*$</validator>
                 </param>
-                <param name="center" type="boolean" label="Center system in box" truevalue="-center" falsevalue=""/>
                 <param name="index_center" type="text" label="Index of group for centering" optional="true" help="Index of group for centering - i.e. the group's position in the ndx file (using zero-based numbering, so the first group has index 0). Leave blank if centering is not required.">
                     <validator type="regex" message="Only numeric values allowed">^[0-9]*$</validator>
                 </param>
-                <param name="pbc" type="select" label="PBC treatment" >
-                    <option value="none">none</option>
-                    <option value="mol">mol</option>
-                    <option value="res">res</option>
-                    <option value="atom">atom</option>
-                    <option value="nojump">nojump</option>
-                    <option value="cluster">cluster</option>
-                    <option value="whole">whole</option>
+                <param name="sep" type="select" label="Write each trajectory frame to a separate GRO or PDB file?" help="Results will be stored as a Galaxy collection. Only has effect with PDB or GRO output, otherwise ignored">
+                    <option value="" selected="true">No</option>
+                    <option value="sep">Yes, write each frame separately</option>
                 </param>
-                <param name="ur" type="select" label="Unit cell representation" >
-                    <option value="rect">rect</option>
+                <conditional name="pbc">
+                    <param name="pbc" type="select" label="PBC treatment" >
+                        <option value="none">none</option>
+                        <option value="mol">mol</option>
+                        <option value="res">res</option>
+                        <option value="atom">atom</option>
+                        <option value="nojump">nojump</option>
+                        <option value="cluster">cluster</option>
+                        <option value="whole">whole</option>
+                    </param>
+                    <when value="cluster">
+                        <param name="index_cluster" type="text" label="Index of group to use for clustering" help="Index of group to use for clustering - i.e. the group's position in the ndx file (using zero-based numbering, so the first group has index 0).">
+                            <validator type="regex" message="Only numeric values allowed">^[0-9]*$</validator>
+                        </param>
+                    </when>
+                    <when value="none" />
+                    <when value="mol" />
+                    <when value="res" />
+                    <when value="atom" />
+                    <when value="nojump" />
+                    <when value="whole" />
+                </conditional>
+                <param name="ur" type="select" label="Unit cell representation" help="Only has effect in combination with PBC treatment of mol, res or atom">
+                    <option value="rect" selected="true">rect</option>
                     <option value="tric">tric</option>
                     <option value="compact">compact</option>
                 </param>
@@ -86,10 +122,27 @@
                     <option value="tric" selected="true">tric</option>
                     <option value="zero">zero</option>
                 </param>
+                <conditional name="fit">
+                    <param name="fit" type="select" label="Fit molecule to reference structure in the reference file?" >
+                        <option value="none" selected="true">No fitting</option>
+                        <option value="rot+trans">rot+trans</option>
+                        <option value="rotxy+transxy">rotxy+transxy</option>
+                        <option value="translation">translation</option>
+                        <option value="transxy">transxy</option>
+                        <option value="progressive">progressive</option>
+                    </param>
+                    <when value="none"/>
+                    <expand macro="fit_when" option="rot+trans"/>
+                    <expand macro="fit_when" option="rotxy+transxy"/>
+                    <expand macro="fit_when" option="translation"/>
+                    <expand macro="fit_when" option="transxy"/>
+                    <expand macro="fit_when" option="progressive"/>
+                </conditional>
             </when>
             <when value="trjcat">
                 <param name="trj_input" type="data" format='xtc,trr' label="Input trajectories" help="In XTC or TRR format, but please do not mix the two. Please note this tool does not currently take order into account when concatenating." multiple="true"/>
                 <param name="cat" type="boolean" label="Do not discard double time frames" truevalue="-cat" falsevalue="-nocat"/>
+                <param name="sep" type="hidden" value="" />
             </when>
         </conditional>
         <param name="output_format" type="select" label="Output format" >
@@ -107,6 +160,7 @@
     </inputs>
     <outputs>
         <data name="output" format="xtc">
+            <filter>not trj.get("sep") or output_format in ["xtc", "trr"]</filter>
             <change_format>
                 <when input="output_format" value="trr" format="trr"/>
                 <when input="output_format" value="xtc" format="xtc"/>
@@ -114,7 +168,16 @@
                 <when input="output_format" value="pdb" format="pdb"/>
             </change_format>
         </data>
-    </outputs> 
+        <collection type="list" name="gro_frames" label="Trajectory frames">
+            <filter>trj.get("sep") and output_format == "gro"</filter>
+            <discover_datasets pattern="(?P&lt;designation&gt;^output[0-9]{9}\.gro$)" ext="gro"/>
+        </collection>
+        <collection type="list" name="pdb_frames" label="Trajectory frames">
+            <filter>trj.get("sep") and output_format == 'pdb'</filter>
+            <discover_datasets pattern="(?P&lt;designation&gt;^output[0-9]{9}\.pdb$)" ext="pdb"/>
+        </collection>
+        <expand macro="log_outputs" />
+    </outputs>
     <tests>
         <test>
             <!-- gmx trjcat -f npt.xtc nvt.xtc -cat -o test.xtc -->
@@ -126,9 +189,9 @@
             <param name="cat" value="true" />
             <output name="output" file="trjcat.xtc" ftype="xtc"/>
         </test>
-        <!-- <test> -->
+        <test>
             <!-- echo '1 1' | gmx trjconv -f npt.xtc -s npt.tpr -n -center -pbc mol -ur compact -o npt_c.xtc -->
-            <!-- <param name="trj_op" value="trjconv" />
+            <!-- <param name="trj_op" value="trjconv" /> -->
             <param name="trj_input" value="npt.xtc" />
             <param name="str_input" value="npt.tpr" ftype="tpr"/>
             <param name="ndx_input" value="index.ndx" />
@@ -137,12 +200,25 @@
             <param name="dt" value="0" />
             <param name="index_output" value="1" />
             <param name="index_center" value="1" />
-            <param name="center" value="true" />
             <param name="pbc" value="mol" />
-            <param name="ur" value="compact" />
             <param name="ur" value="tric" />
             <output name="output" file="trjconv.xtc" ftype="xtc"/>
-        </test> -->
+        </test>
+        <test>
+            <!-- test sep flag -->
+            <param name="trj_input" value="npt.xtc" />
+            <param name="str_input" value="npt.tpr" ftype="tpr"/>
+            <param name="ndx_input" value="index.ndx" />
+            <param name="b" value="0" />
+            <param name="e" value="-1" />
+            <param name="dt" value="0" />
+            <param name="index_output" value="0" />
+            <param name="sep" value="sep" />
+            <param name="output_format" value="pdb" />
+            <output_collection name="pdb_frames" type="list">
+                <element name="output00000007" ftype="pdb" file="frame7.pdb"/>
+            </output_collection>
+        </test>
     </tests>
     <help><![CDATA[