changeset 5:5a0ddb4dc3a4 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc commit 77e22c56f8da58853100ef1be59ba8d077ab1bf4
author iuc
date Thu, 04 May 2023 16:33:09 +0000
parents 5e0825476fb7
children 015283de3004
files macros.xml smudgeplot.xml test-data/histogram.tabular test-data/kmerdb.meryldb test-data/my_genome_smudgeplot.png test-data/my_genome_smudgeplot_02.png test-data/my_genome_smudgeplot_03.png test-data/my_genome_smudgeplot_04.png
diffstat 8 files changed, 194 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Thu May 04 16:33:09 2023 +0000
@@ -0,0 +1,48 @@
+<macros>
+    <token name="@TOOL_VERSION@">0.2.5</token>
+    <token name="@VERSION_SUFFIX@">3</token>        
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@TOOL_VERSION@">smudgeplot</requirement>
+            <requirement type="package" version="1.3">meryl</requirement>
+            <requirement type="package" version="2.3.0">kmer-jellyfish</requirement>
+            <requirement type="package" version="1.34">tar</requirement>
+        </requirements>
+    </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1038/s41467-020-14998-3</citation>
+        </citations>
+    </xml>
+    <xml name="xrefs">
+        <xrefs>
+            <xref type="bio.tools">smudgeplots</xref>
+        </xrefs>
+    </xml>
+
+    <xml name="cutoff_macro">
+        <param
+            name="lower_cutoff"
+            min="1"
+            label="Lower kmer cutoff"
+            type="integer"
+            optional="true"
+            help="Optionally set a manual lower limit for filtering kmers with
+            smudgeplot hetkmers. If no value is set, a cutoff will be
+            estimated with smudgeplot cutoff. Use the GenomeScope tool to
+            visualize your kmer histogram when choosing cutoff values."
+        />
+
+        <param
+            name="upper_cutoff"
+            min="1"
+            label="Upper kmer cutoff"
+            type="integer"
+            optional="true"
+            help="Optionally set a manual upper limit for filtering kmers with
+            smudgeplot hetkmers. If no value is set, a cutoff will be
+            estimated with smudgeplot cutoff. Use the GenomeScope tool to
+            visualize your kmer histogram when choosing cutoff values."
+        />
+    </xml>
+</macros>
--- a/smudgeplot.xml	Tue Apr 04 17:23:19 2023 +0000
+++ b/smudgeplot.xml	Thu May 04 16:33:09 2023 +0000
@@ -1,19 +1,10 @@
-<tool id="smudgeplot" name="Smudgeplot" version="@TOOL_VERSION@+galaxy+@VERSION_SUFFIX@" profile="21.05">
+<tool id="smudgeplot" name="Smudgeplot" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
     <description>inference of ploidy and heterozygosity structure using whole genome sequencing</description>
-
     <macros>
-        <token name="@TOOL_VERSION@">0.2.5</token>
-        <token name="@VERSION_SUFFIX@">2</token>
+        <import>macros.xml</import>
     </macros>
-
-    <xrefs>
-        <xref type="bio.tools">smudgeplots</xref>
-    </xrefs>
-
-    <requirements>
-        <requirement type="package" version="@TOOL_VERSION@">smudgeplot</requirement>
-        <requirement type="package" version="2.3.0">kmer-jellyfish</requirement>
-    </requirements>
+    <expand macro="xrefs"/>
+    <expand macro="requirements"/>
 
     <command detect_errors="exit_code"><![CDATA[
       set -o pipefail;
@@ -63,11 +54,29 @@
         && jellyfish dump -c -L \$L -U \$U 1_counts.jf > 2_dump.jf
         && smudgeplot.py hetkmers -o 2_kmer_pairs 2_dump.jf
 
+
       #else
+        #if $file.input.input_mode.selector == 'meryl'
+          tar -zxf '${file.input.input_mode.meryl_database}' -C ./ &&
+          #if $file.input.input_mode.lower_cutoff:
+            L=$file.input.input_mode.lower_cutoff &&
+          #else
+            L=\$(smudgeplot.py cutoff '${file.input.input_mode.meryl_histogram}' L) &&
+          #end if
 
-        ## ~~~~~~~~~~~~~~~~~~~ Use provided kmer dump ~~~~~~~~~~~~~~~~~~~~~~~~~~
+          #if $file.input.input_mode.upper_cutoff:
+            U=$file.input.input_mode.upper_cutoff &&
+          #else
+            U=\$(smudgeplot.py cutoff '${file.input.input_mode.meryl_histogram}' U) &&
+          #end if
 
-        smudgeplot.py hetkmers -o 2_kmer_pairs '$file.input.dump'
+          meryl print less-than \$U greater-than \$L threads=\${GALAXY_SLOTS:-8} memory=\$((\${GALAXY_MEMORY_MB:-8192}/1024)) read-db.meryl | sort > meryl.dump &&
+          smudgeplot.py hetkmers -o 2_kmer_pairs < meryl.dump
+
+        #else
+
+          smudgeplot.py hetkmers -o 2_kmer_pairs '$file.input.input_mode.dump'
+        #end if
 
       #end if
 
@@ -106,39 +115,31 @@
                   label="K-mer size" 
                   help="The size of k-mers should be large enough allowing the k-mer to map uniquely to the genome" />
 
+            <expand macro="cutoff_macro"/>
 
-            <param
-              name="lower_cutoff"
-              min="1"
-              label="Lower kmer cutoff"
-              type="integer"
-              optional="true"
-              help="Optionally set a manual lower limit for filtering kmers with
-              smudgeplot hetkmers. If no value is set, a cutoff will be
-              estimated with smudgeplot cutoff. Use the GenomeScope tool to
-              visualize your kmer histogram when choosing cutoff values."
-            />
-
-            <param
-              name="upper_cutoff"
-              min="1"
-              label="Upper kmer cutoff"
-              type="integer"
-              optional="true"
-              help="Optionally set a manual upper limit for filtering kmers with
-              smudgeplot hetkmers. If no value is set, a cutoff will be
-              estimated with smudgeplot cutoff. Use the GenomeScope tool to
-              visualize your kmer histogram when choosing cutoff values."
-            />
           </when>
 
           <when value="dump">
-            <param
-              name="dump" type="data" format="txt"
-              label="Kmer dump"
-              help="Upload your own Kmer dump file created with the Jellyfish or KMC tool.
-              This enables control over kmer-counting parameters."
-            />
+            <conditional name="input_mode">
+                <param name="selector" type="select" label="Input mode">
+                    <option value="default">Default k-mer dump dataset</option>
+                    <option value="meryl">Meryl database</option>
+                </param>
+                <when value="default">
+                  <param
+                  name="dump" type="data" format="txt"
+                  label="Kmer dump"
+                  help="Upload your own Kmer dump file created with the Jellyfish or KMC tool.
+                  This enables control over kmer-counting parameters."
+                />
+                </when>
+                <when value="meryl">
+                  <param argument="meryl_histogram" type="data" format="tabular" label="Meryl histogram"/>
+                  <param argument="meryl_database" type="data" format="meryldb" label="Meryl database"/>
+                  <expand macro="cutoff_macro"/>
+                </when>
+            </conditional>
+
           </when>
         </conditional>
       </section>
@@ -229,7 +230,10 @@
       <!-- K-mer dump input -->
       <test expect_num_outputs="2">
         <param name="input_select" value="dump"/>
-        <param name="dump" value="dump.jf" ftype="txt"/>
+        <conditional name="input_mode">
+          <param name="selector" value="default"/>
+          <param name="dump" value="dump.jf" ftype="txt"/>
+        </conditional>
         <output name="smudgeplot" ftype="png" file="my_genome_smudgeplot.png" compare="sim_size"/>
       </test>
       <!-- Standard run without specifying cutoffs and compressed file -->
@@ -241,6 +245,28 @@
           <has_text text="Dump with cutoffs L=10, U=70" />
         </assert_stdout>
       </test>
+      <!-- K-mer dump meryl input -->
+      <test expect_num_outputs="2">
+        <param name="input_select" value="dump"/>
+        <conditional name="input_mode">
+          <param name="selector" value="meryl"/>
+          <param name="meryl_histogram" value="histogram.tabular" ftype="tabular"/>
+          <param name="meryl_database" value="kmerdb.meryldb" ftype="meryldb"/>
+        </conditional>
+        <output name="smudgeplot" ftype="png" file="my_genome_smudgeplot_03.png" compare="sim_size"/>
+      </test>
+      <!-- K-mer dump meryl input with specific cutoff-->
+      <test expect_num_outputs="2">
+        <param name="input_select" value="dump"/>
+        <conditional name="input_mode">
+          <param name="selector" value="meryl"/>
+          <param name="meryl_histogram" value="histogram.tabular" ftype="tabular"/>
+          <param name="meryl_database" value="kmerdb.meryldb" ftype="meryldb"/>
+          <param name="lower_cutoff" value="2"/>
+          <param name="upper_cutoff" value="2500000"/>
+        </conditional>
+        <output name="smudgeplot" ftype="png" file="my_genome_smudgeplot_04.png" compare="sim_size"/>
+      </test>
     </tests>
 
     <help><![CDATA[
@@ -303,7 +329,5 @@
 - ``smudgeplot.py plot kmer_pairs_coverages.tsv -o my_genome``
 
     ]]></help>
-  <citations>
-      <citation type="doi">10.1038/s41467-020-14998-3</citation>
-  </citations>
+    <expand macro="citations"/>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/histogram.tabular	Thu May 04 16:33:09 2023 +0000
@@ -0,0 +1,74 @@
+1	114512
+2	3739
+3	1711
+4	296
+5	140
+6	306
+7	91
+8	72
+9	53
+10	36
+11	36
+12	26
+13	22
+14	16
+15	17
+16	17
+17	15
+18	8
+19	8
+20	4
+21	2
+22	32
+23	86
+24	374
+25	753
+26	2
+27	1
+28	9
+31	1
+33	1
+34	1
+37	9
+38	2
+39	3
+40	13
+41	1
+42	18
+43	25
+44	6
+45	100
+46	215
+47	112
+48	380
+49	12
+50	108
+51	316
+61	1
+62	14
+63	3
+64	5
+65	64
+66	55
+67	92
+68	238
+69	312
+70	714
+71	1014
+72	743
+73	1395
+74	185
+75	471
+76	867
+100	17
+101	49
+144	9
+145	12
+147	5
+148	17
+149	46
+150	45
+151	46
+152	50
+155	2
+224	11
Binary file test-data/kmerdb.meryldb has changed
Binary file test-data/my_genome_smudgeplot.png has changed
Binary file test-data/my_genome_smudgeplot_02.png has changed
Binary file test-data/my_genome_smudgeplot_03.png has changed
Binary file test-data/my_genome_smudgeplot_04.png has changed