diff blockclust.xml @ 12:aab6cf87b40a draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/blockclust commit 8a847f019b21abaf4de2612dead57163b2c92d81
author rnateam
date Mon, 19 Nov 2018 08:10:14 -0500
parents 6ecd674b5b62
children dbb6ee3179bc
line wrap: on
line diff
--- a/blockclust.xml	Tue Feb 03 08:08:49 2015 -0500
+++ b/blockclust.xml	Mon Nov 19 08:10:14 2018 -0500
@@ -1,74 +1,43 @@
-<tool id="blockclust" name="BlockClust" version="1.0.0">
+<tool id="blockclust" name="BlockClust" version="1.1.0">
     <description>efficient clustering and classification of non-coding RNAs from short read RNA-seq profiles</description>
     <requirements>
-        <requirement type="package" version="1.0">blockclust</requirement>
-        <requirement type="package" version="1.1">eden</requirement>
-        <requirement type="package" version="3.0.3">R</requirement>
-        <requirement type="package" version="0.1.19">samtools</requirement>
-        <requirement type="package" version="12.135">mcl</requirement>
-        <requirement type="package" version="1.0">blockclust_rlibs</requirement>
+        <requirement type="package" version="1.1.0">blockclust</requirement>
     </requirements>
-    <version_command>echo '1.0'</version_command>
-    <command>
-<![CDATA[
+    <version_command>blockclust.py -v</version_command>
+    <command detect_errors="aggressive"><![CDATA[
+        export BLOCKCLUST_DATA_PATH=\$(dirname \$(which blockclust.py))/../share/blockclust_data &&
+
         #if str($tool_mode.operation) == "pre":
-            BlockClustPipeLine.pl -m PRE -bam $tool_mode.reads_bam -tbed $tags_bed
-        #elif str($tool_mode.operation) == "clust":
+            ln -s '$tool_mode.reads_bam' reads.bam &&
+            ln -f -s '${$tool_mode.reads_bam.metadata.bam_index}' reads.bam.bai &&
+            blockclust.py 
+                -m PRE -bam reads.bam
+                -tbed '$tags_bed'
+        #elif str($tool_mode.operation) == "analysis":
             #set $outputdir = $clusters.files_path
-            #set $accept_bed=list()
-            #set $reject_bed=list()
-            ## prepare annotations
-            #if str($tool_mode.reference) == "hg19":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/hg19/hg19.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/hg19/hg19.reject.bed")
-            #elif str($tool_mode.reference) == "mm10":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/mm10/mm10.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/mm10/mm10.reject.bed")
-            #elif str($tool_mode.reference) == "dm3":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/dm3/dm3.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/dm3/dm3.reject.bed")
-                #elif str($tool_mode.reference) == "rheMac3":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/rheMac3/rheMac3.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/rheMac3/rheMac3.reject.bed")
-            #elif str($tool_mode.reference) == "panTro4":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/panTro3/panTro4.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/panTro3/panTro4.reject.bed")
-            #elif str($tool_mode.reference) == "xenTro3":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/xenTro3/xenTro3.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/xenTro3/xenTro3.reject.bed")
-            #elif str($tool_mode.reference) == "celWS235":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/celWS235/celWS235.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/celWS235/celWS235.reject.bed")
-            #elif str($tool_mode.reference) == "tair10":
-                $accept_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/tair10/tair10.accept.bed")
-                $reject_bed.append("\$BLOCKCLUST_DATA_PATH/annotations/tair10/tair10.reject.bed")
-            #end if
-            BlockClustPipeLine.pl -m TEST -c \$BLOCKCLUST_DATA_PATH/blockclust.config
+            blockclust.py 
+            -o ./
+            -m ANALYSIS
+            -f "\$BLOCKCLUST_DATA_PATH/blockclust.config"
             -t $tool_mode.input_bbo
-            -a #echo ''.join( $accept_bed )
-            -r #echo ''.join( $reject_bed )
-            -o $outputdir
+            -a "\$BLOCKCLUST_DATA_PATH/$tool_mode.reference/${tool_mode.reference}.accept.bed"
+            -r "\$BLOCKCLUST_DATA_PATH/$tool_mode.reference/${tool_mode.reference}.reject.bed"
             #if $tool_mode.nochr:
                 -nochr
             #end if
             #if str($tool_mode.pred.enable_pred) == "yes":
-                -p
-                -pm $tool_mode.pred.pred_mode
-                -md \$BLOCKCLUST_DATA_PATH/models;
-                #if str($tool_mode.pred.pred_mode) == "nearest_neighbour":
-                    cp #echo os.path.join($outputdir,'nearest_neighbour_predictions.txt')# $nearest_neighbour_pred_bed;
-                #elif str($tool_mode.pred.pred_mode) == "model_based":
-                    cp #echo os.path.join($outputdir,'model_based_predictions.txt')# $model_based_pred_bed;
-                #end if
-            #else:
-                ;
+                -c
+                -cm $tool_mode.pred.pred_mode
+                -md "\$BLOCKCLUST_DATA_PATH/models"
             #end if
-
-            cp #echo os.path.join($outputdir, 'mcl_clusters','all_clusters.bed')# $clusters;
-            cp #echo os.path.join($outputdir, 'hclust_tree.pdf')# $hclust_plot;
-            cp #echo os.path.join($outputdir, 'discretized.gspan.tab')# $sim_tab_out
         #elif str($tool_mode.operation) == "post":
-            BlockClustPipeLine.pl -m POST -cbed $tool_mode.clusters_bed -cm $tool_mode.cmsearch_out -tab $tool_mode.sim_tab_in -rfam \$BLOCKCLUST_DATA_PATH/rfam_map.txt -o ./;
+            blockclust.py
+                -m POST 
+                -cbed '$tool_mode.clusters_bed'
+                -cs '$tool_mode.cmsearch_out'
+                -tab '$tool_mode.sim_tab_in'
+                -rfam "\$BLOCKCLUST_DATA_PATH/rfam_map.txt"
+                -o ./
         #end if
 ]]>
     </command>
@@ -76,13 +45,13 @@
         <conditional name="tool_mode">
             <param name="operation" type="select" label="Select mode of operation">
                 <option value="pre">Pre-processing </option>
-                <option value="clust">Clustering and classification</option>
+                <option value="analysis">Clustering and classification</option>
                 <option value="post">Post-processing</option>
             </param>
             <when value="pre">
                 <param name="reads_bam" type="data" format="bam" label="BAM file containing alignments" />
             </when>
-            <when value="clust">
+            <when value="analysis">
                 <param name="input_bbo" type="data" format="tabular" label="Input blockgroups file" />
                 <param name="reference" type="select" label="Select reference genome">
                     <option value="hg19">Human (hg19)</option>
@@ -102,8 +71,8 @@
                     </param>
                     <when value="yes">
                         <param name="pred_mode" type="select" label="Mode of classification">
-                            <option value="model_based">Model based</option>
-                            <option value="nearest_neighbour">Nearest neighbour</option>
+                            <option value="MODEL">Model based</option>
+                            <option value="NEAREST">Nearest neighbour</option>
                         </param>
                     </when>
                 </conditional>
@@ -118,42 +87,101 @@
 
     <outputs>
         <data format="bed" name="tags_bed" label="BlockClust: BAM to BED on ${on_string}">
-            <filter> tool_mode["operation"]=="pre"</filter>
+            <filter>tool_mode["operation"]=="pre"</filter>
         </data>
-        <data format="pdf" name="hclust_plot" label="BlockClust: Hierarchical clustering plot on ${on_string}" >
-            <filter> tool_mode["operation"]=="clust"</filter>
+        <data format="pdf" name="hclust_plot" from_work_dir="hclust_tree.pdf" label="BlockClust: Hierarchical clustering plot on ${on_string}" >
+            <filter>tool_mode["operation"]=="analysis"</filter>
         </data>
-        <data format="bed" name="clusters" label="BlockClust: BED of predicted clusters on ${on_string}">
-            <filter> tool_mode["operation"]=="clust"</filter>
+        <data format="bed" name="clusters" from_work_dir="mcl_clusters/all_clusters.bed" label="BlockClust: BED of predicted clusters on ${on_string}">
+            <filter>tool_mode["operation"]=="analysis"</filter>
         </data>
-        <data format="bed" name="model_based_pred_bed" label="BlockClust: Model based predictions BED on ${on_string}">
+        <data format="bed" name="model_based_pred_bed" from_work_dir="model_based_predictions.txt" label="BlockClust: Model based predictions BED on ${on_string}">
             <filter>
             ((
-                tool_mode["operation"] == 'clust' and
+                tool_mode["operation"] == 'analysis' and
                 tool_mode["pred"]["enable_pred"] == "yes" and
-                tool_mode["pred"]["pred_mode"] == "model_based"
+                tool_mode["pred"]["pred_mode"] == "MODEL"
+             ))
+             </filter>
+        </data>
+        <data format="bed" name="nearest_neighbour_pred_bed" from_work_dir="nearest_neighbour_predictions.txt" label="BlockClust: Nearest neighbor predictions BED on ${on_string}">
+            <filter>
+            ((
+                tool_mode["operation"] == 'analysis' and
+                tool_mode["pred"]["enable_pred"] == "yes" and
+                tool_mode["pred"]["pred_mode"] == "NEAREST"
              ))
              </filter>
         </data>
-        <data format="bed" name="nearest_neighbour_pred_bed" label="BlockClust: Nearest neighbor predictions BED on ${on_string}">
-            <filter>
-            ((
-                tool_mode["operation"] == 'clust' and
-                tool_mode["pred"]["enable_pred"] == "yes" and
-                tool_mode["pred"]["pred_mode"] == "nearest_neighbour"
-             ))
-             </filter>
-        </data>
-        <data format="tabular" name="sim_tab_out" label="BlockClust: Pairwise similarities on ${on_string}">
-            <filter> tool_mode["operation"]=="clust"</filter>
+        <data format="tabular" name="sim_tab_out" from_work_dir="discretized.gspan.tab" label="BlockClust: Pairwise similarities on ${on_string}">
+            <filter>tool_mode["operation"]=="analysis"</filter>
         </data>
         <data format="pdf" name="cluster_dist" from_work_dir="cluster_distribution.pdf" label="BlockClust: Cluster distribution on ${on_string}" >
-            <filter> tool_mode["operation"]=="post"</filter>
+            <filter>tool_mode["operation"]=="post"</filter>
         </data>
         <data format="pdf" name="cluster_hclust" from_work_dir="hclust_tree_clusters.pdf" label="BlockClust: Hierarchical clustering plot of cluster centroids on ${on_string}" >
-            <filter> tool_mode["operation"]=="post"</filter>
+            <filter>tool_mode["operation"]=="post"</filter>
         </data>
     </outputs>
+    <tests>
+        <!-- Test: PRE mode -->
+
+        <test expect_num_outputs="1">
+            <param name="operation" value="pre"/>
+            <param name="reads_bam" value="test.bam"/>
+            <output name="tags_bed">
+                <assert_contents>
+                    <has_text_matching expression="chr6\t26555497\t26555527\ttag_10|1|19\t0.052632\t+" />
+                    <has_text_matching expression="chr11\t122017275\t122017297\ttag_30|1|3\t0.333333\t-" />
+                </assert_contents>
+            </output>
+        </test>
+
+        <!-- Test: Clustering only -->
+        <test expect_num_outputs="3">
+            <param name="operation" value="analysis"/>
+            <param name="input_bbo" value="test.tabular"/>
+            <param name="reference" value="hg19"/>
+            <param name="enable_pred" value="no"/>
+            <output name="clusters">
+                <assert_contents>
+                    <has_text_matching expression="chr1\t173833959\t173834043\t10:snoRNA_CD-box:blockgroup_939:cluster_1\t451.50\t-" />
+                    <has_text_matching expression="chr13\t92003008\t92003075\t8:miRNA:blockgroup_256:cluster_3\t2950.50\t\+" />
+                </assert_contents>
+            </output>
+        </test>
+
+        <!-- Test: Model based prediction -->
+
+        <test expect_num_outputs="4">
+            <param name="operation" value="analysis"/>
+            <param name="input_bbo" value="test.tabular"/>
+            <param name="reference" value="hg19"/>
+            <param name="enable_pred" value="yes"/>
+            <param name="pred_mode" value="MODEL"/>
+            <output name="model_based_pred_bed">
+                <assert_contents>
+                    <has_text_matching expression="chr2\t203211000\t203211097\tpredicted_tRNA\t284.07\t-" />
+                </assert_contents>
+            </output>
+        </test>
+    
+        <!-- Test: Nearest neighbour based prediction -->
+
+        <test expect_num_outputs="4">
+            <param name="operation" value="analysis"/>
+            <param name="input_bbo" value="test.tabular"/>
+            <param name="reference" value="hg19"/>
+            <param name="enable_pred" value="yes"/>
+            <param name="pred_mode" value="NEAREST"/>
+            <output name="nearest_neighbour_pred_bed">
+                <assert_contents>
+                    <has_text_matching expression="chr2\t203211000\t203211097\tpredicted_tRNA\t284.07\t-" />
+                </assert_contents>
+            </output>
+        </test>
+
+    </tests>
     <help>
 <![CDATA[