diff chess_preprocessor.xml @ 0:4d2a2268a17a draft

"planemo upload"
author mzhuang
date Thu, 23 Sep 2021 21:00:48 +0000
parents
children 0545899061d3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chess_preprocessor.xml	Thu Sep 23 21:00:48 2021 +0000
@@ -0,0 +1,135 @@
+<tool id="chess_preprocessor" name="CHESS Pre-processing Tool" version="0.1.0">
+  <description>for pre-processing raw data</description>
+  <requirements>
+      <requirement type="package" version="0.8.4">hexrd</requirement>
+  </requirements>
+  <command><![CDATA[
+    #import os.path
+
+    ##source ~/.bashrc;conda activate pulsar;
+    ##source ~/.bashrc; conda activate __hexrd@0.8.0; 
+    mkdir -p output;
+    cd output;
+    #set $history_id=$__app__.security.encode_id($output.creating_job.history.id)
+    echo '$history_id' >> '$output';
+
+    #if $input_source_conditional.input_source == "input_source_history"
+        #set $input_type = $input_source_conditional.input_type_conditional.input_type
+        #if $input_type == "single"
+            #set $input_data = $input_source_conditional.input_type_conditional.fastq_input1
+        #elif $input_type == "list_collection"
+            #set $input_data = $input_source_conditional.input_type_conditional.fastq_input
+        #end if#
+
+        #set $var = ""
+        #for $f in $input_data# 
+           #set $var += "${f}\n" 
+        #end for#
+        #set files = '\\n'.join([str($file) for $file in $input_data])
+        ##for $f in $input_data# 
+            #if $output_as_list == "Yes"
+                ##printf "$files"   >> '$output_list_log' 2>&1;
+                printf "$files" | xargs -n 1 -P \${GALAXY_SLOTS} -I{} python  '$__tool_directory__/preprocess_dexela_h5_galaxy.py' {}  -o '$ome_start' -s '$start_frame' -n '$num_frames' -e '$ome_end' -t '$threshold'   >> '$output_list_log' 2>&1;
+            #elif $output_as_list == "No"
+                printf "$files" | xargs -n 1 -P \${GALAXY_SLOTS} -I{} python  '$__tool_directory__/preprocess_dexela_h5_galaxy.py' {}  -o '$ome_start' -s '$start_frame' -n '$num_frames' -e '$ome_end' -t '$threshold'   >> '$output' 2>&1;
+            #end if#
+        ##end for#
+    #elif $input_source_conditional.input_source == "input_source_linux"
+        #set $scans = [i for a in [(int(j[0]),int(j[-1])+1) for j in [x.split(':') for x in $input_source_conditional.scan_numbers.split(',')]] for i in range(a[0],a[1])]
+        ##set $scanlist = '\n'.join($scans)
+
+        #for $n in $scans#
+            #if $output_as_list == "Yes"
+                echo '$input_source_conditional.base_dir' >> '$output_list_log';
+		python  '$__tool_directory__/preprocess_dexela_h5_filesystem.py' '$input_source_conditional.base_dir' '$input_source_conditional.expt_name' '$input_source_conditional.samp_name' '$n' -o '$ome_start' -s '$start_frame' -n '$num_frames' -e '$ome_end' -t '$threshold'   >> '$output_list_log' 2>&1;
+            #elif $output_as_list == "No"
+                echo '$input_source_conditional.base_dir' >> '$output';
+		python  '__tool_directory__/preprocess_dexela_h5_filesystem.py' '$input_source_conditional.base_dir' '$input_source_conditional.expt_name' '$input_source_conditional.samp_name' '$n' -o '$ome_start' -s '$start_frame' -n '$num_frames' -e '$ome_end' -t '$threshold'   >> '$output' 2>&1;
+            #end if#
+        #end for#
+    #end if#
+    conda deactivate    
+  ]]></command>
+  <inputs>
+    <!--
+    <param name="infile_" type="data" multiple="true" label="Any file"/>
+    -->
+    <conditional name="input_source_conditional">
+        <param name="input_source" type="select" label="Location of raw data">
+            <option value="input_source_history" selected="true">Choose from History panel</option>
+            <option value="input_source_linux">Specify a directory in CHESS file system </option>
+        </param>
+        <when value="input_source_history">
+            <conditional name="input_type_conditional">
+            <param name="input_type" type="select" label="Input raw data as">
+                <option value="list_collection" selected="true">List of Datasets</option>
+                <option value="single">Dataset(s)</option>
+            </param>
+            <when value="single">
+                <param name="fastq_input1" type="data" multiple="true" label="Select (a) raw data file(s)" help="Specify (a) raw data file(s) for pre-processing"/>
+            </when>
+            <when value="list_collection">
+                <param name="fastq_input" type="data_collection" collection_type="list" label="Select a list of raw data files" help="Specify a list of raw data files for pre-processing one by one"/>
+            </when>
+            </conditional>
+        </when>
+        <when value="input_source_linux">
+             <param name="base_dir" type="text" label="Please specify the directory that contains raw data">
+                 <sanitizer>
+                     <valid initial="string.ascii_letters,string.digits">
+                         <add value="#,/,*,@,.,_,-" />
+                         <add value="_" />
+                     </valid>
+                 </sanitizer>
+             </param>
+             <param name="expt_name" type="text" label="Please specify the experiment name"/>
+             <param name="samp_name" type="text" label="Please specify the sample name"/>
+             <param name="scan_numbers" type="text" label="Please specify a scan number or scan numbers separated by comma (for example, 5,7,8,9,20,21,22,23,30 or 5,7:9,20:23,30)"/>
+        </when>
+    </conditional>
+      <!--
+    <param name="which_cluster" type="select" label="Send your job to below cluster">
+      <option value="SDSC" selected="true">SDSC</option>
+      <option value="Cornell" selected="true">Cornell CHESS</option>
+    </param>
+      -->
+    <!--
+    <param name="output_dir" type="text" hidden="true"/>
+    -->
+    <param name="num_frames" type="integer" value="999"  label="Number of frames to read"/>
+    <param name="start_frame" type="integer" value="0"  label="Index of first data frame"/>
+    <param name="threshold" type="integer" value="50"  label="Threshold for frame caches"/>
+    <param name="ome_start" type="float" value="-50.0"  label="Start omega"/>
+    <param name="ome_end" type="float" value="49.9"  label="End omega"/>
+    <param name="output_as_list" type="select" label="Would you like the tool to output result(s) as a list?">
+      <option value="Yes" selected="true">Yes. Let the results be contained in a list.</option>
+      <option value="No" >No. Show them individually.</option>
+    </param>
+  </inputs>
+  <outputs>
+    <data format="txt" name="output_list_log" label="${tool.name} on ${on_string}">
+        <!--filter>input_type_conditional['input_type'] == 'single'</filter-->
+        <filter>output_as_list == 'Yes'</filter>
+    </data>
+    <!--
+    <collection name="output_list" type="list" label="${tool.name} on ${on_string}: processed_data" structured_like="fastq_input" format="npz">
+    <collection name="output_list" type="list" label="${tool.name} on ${on_string}: processed_data" format="npz">
+    -->
+    <collection name="output_list" type="list" label="${tool.name} on ${on_string}: processed_data">
+        <!-- discover_datasets pattern="__name_and_ext__" directory="output" ext="npz" visible="false"/-->
+        <discover_datasets pattern="(?P&lt;designation&gt;.+)\.npz" ext="hexrd.npz" directory="output"/>
+        <!--discover_datasets pattern="(?P&lt;designation&gt;.+)\.npz" ext="npz" directory="output"/-->
+        <!--discover_datasets pattern="(?P&lt;designation&gt;.npz)" ext="hexrd.npz" directory="output"/-->
+        <!--filter>input_type_conditional['input_type'] == 'list_collection'</filter-->
+        <filter>output_as_list == 'Yes'</filter>
+    </collection>
+    <data  format="txt"  name="output" label="${tool.name} on ${on_string}">
+        <discover_datasets pattern="(?P&lt;designation&gt;.+)\.npz"  directory="output" ext="hexrd.npz" visible="true" />
+        <filter>output_as_list == 'No'</filter>
+    </data>
+    <!--data format="txt" name="output_list" label="${tool.name} on ${on_string}: listfiles">
+        <filter>input_type_conditional['input_type'] == 'list_collection'</filter>
+    </data -->
+  </outputs>
+</tool>
+