changeset 3:5ded3318cf8a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/concoct commit 58c54ba18f478ce75fdfd6093921ba0b50af02ac
author iuc
date Wed, 03 Aug 2022 13:56:39 +0000
parents 6302656ed45d
children 0442e7102125
files concoct_coverage_table.xml macros.xml test-data/ten_reads_two_contigs-s_2.bam
diffstat 3 files changed, 48 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/concoct_coverage_table.xml	Thu Jul 07 08:32:46 2022 +0000
+++ b/concoct_coverage_table.xml	Wed Aug 03 13:56:39 2022 +0000
@@ -3,24 +3,42 @@
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro="requirements">
-        <requirement type="package" version="1.15.1">samtools</requirement>
-    </expand>
+    <expand macro="requirements"/>
     <command detect_errors="exit_code"><![CDATA[
+#import re
 mkdir 'mapping' &&
-#for $e in $bamfiles
-    ln -s '$e' 'mapping/${e.element_identifier}.sorted.bam' &&
-    samtools index 'mapping/${e.element_identifier}.sorted.bam' 'mapping/${e.element_identifier}.bam.bai' &&
-    mv 'mapping/${e.element_identifier}.sorted.bam' 'mapping/${e.element_identifier}.bam' &&
-#end for
+#if $mode.type == 'individual'
+    #set $identifier = re.sub('[^\s\w\-\\.]', '_', str($mode.bamfile))
+ln -s '$mode.bamfile' 'mapping/${identifier}.sorted.bam' &&
+samtools index 'mapping/${identifier}.sorted.bam' 'mapping/${identifier}.bam.bai' &&
+mv 'mapping/${identifier}.sorted.bam' 'mapping/${identifier}.bam' &&
+#else
+    #for $e in $mode.bamfiles
+        #set $identifier = re.sub('[^\s\w\-\\.]', '_', str($e.element_identifier))
+ln -s '$e' 'mapping/${identifier}.sorted.bam' &&
+samtools index 'mapping/${identifier}.sorted.bam' 'mapping/${identifier}.bam.bai' &&
+mv 'mapping/${identifier}.sorted.bam' 'mapping/${identifier}.bam' &&
+    #end for
+#end if
 concoct_coverage_table.py
     '$bedfile'
     mapping/*.bam
     > '$output'
     ]]></command>
     <inputs>
-        <param name="bedfile" type="data" format="bed" label="Contigs BEDFile" help="The file should have four columns representing: 'Contig ID, Start Position, End Position and SubContig ID' respectively. The Subcontig ID must contain the pattern 'concoct_part_[0-9]*' while the contigs which are not cutup cannot contain this pattern. This file can be generated by the cut_up_fasta tool."/>
-        <param name="bamfiles" type="data" format="bam" label="Sorted BAM files" multiple="true" help="BAM files with mappings to the original contigs, after sorting"/>
+        <param name="bedfile" type="data" format="bed" label="Contigs BEDFile" help="The file should have four columns representing: 'Contig ID, Start Position, End Position and SubContig ID' respectively. The Subcontig ID must contain the pattern 'concoct_part_[0-9]*' while the contigs which are not cutup cannot contain this pattern. This file can be generated by the CONCOCT: Cut up contigs tool."/>
+        <conditional name="mode">
+            <param name="type" type="select" label="Type of assembly used to generate the contigs" help="Information used to process the BAM files">
+                <option value="individual">Individual assembly: 1 run per BAM file</option>
+                <option value="co">Co-assembly: all BAM files processed together</option>
+            </param>
+            <when value="individual">
+                <param name="bamfile" type="data" format="bam" label="Sorted BAM file" help="BAM file with mappings to the original contigs, after sorting"/>
+            </when>
+            <when value="co">
+                <param name="bamfiles" type="data" format="bam" label="Sorted BAM files" multiple="true" help="BAM files with mappings to the original contigs, after sorting"/>
+            </when>
+        </conditional>
     </inputs>
     <outputs>
         <data name="output" format="tabular"/>
@@ -28,7 +46,10 @@
     <tests>
         <test expect_num_outputs="1">
             <param name="bedfile" value="two_contigs-cut2.bed" ftype="bed"/>
-            <param name="bamfiles" value="ten_reads_two_contigs-s.bam" ftype="bam"/>
+            <conditional name="mode">
+                <param name="type" value="individual"/>
+                <param name="bamfile" value="ten_reads_two_contigs-s.bam" ftype="bam"/>
+            </conditional>
             <output name="output" ftype="tabular">
                 <assert_contents>
                     <has_text text="contig-21000001.concoct_part_0"/>
@@ -36,6 +57,21 @@
                 </assert_contents>
             </output>
         </test>
+        <test expect_num_outputs="1">
+            <param name="bedfile" value="two_contigs-cut2.bed" ftype="bed"/>
+            <conditional name="mode">
+                <param name="type" value="co"/>
+                <param name="bamfiles" value="ten_reads_two_contigs-s.bam,ten_reads_two_contigs-s_2.bam" ftype="bam"/>
+            </conditional>
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_text text="cov_mean_sample_ten_reads_two_contigs-s.bam"/>
+                    <has_text text="cov_mean_sample_ten_reads_two_contigs-s_2.bam"/>
+                    <has_text text="contig-21000001.concoct_part_0"/>
+                    <has_n_lines n="11"/>
+                </assert_contents>
+            </output>
+        </test>
     </tests>
     <help><![CDATA[
 **What it does**
--- a/macros.xml	Thu Jul 07 08:32:46 2022 +0000
+++ b/macros.xml	Wed Aug 03 13:56:39 2022 +0000
@@ -1,6 +1,6 @@
 <macros>
     <token name="@TOOL_VERSION@">1.1.0</token>
-    <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@VERSION_SUFFIX@">1</token>
     <token name="@PROFILE@">21.01</token>
     <xml name="requirements">
         <requirements>
Binary file test-data/ten_reads_two_contigs-s_2.bam has changed