Repository 'snipit'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/snipit

Changeset 1:9f23fe0cb70b (2022-10-28)
Previous changeset 0:20b4c59bec12 (2022-07-17) Next changeset 2:92b9fd5f1f9f (2024-01-27)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snipit commit ec96004a9f92c601a3e6474efbe1bd408bed088d
modified:
snipit.xml
added:
test-data/custom_labels.csv
test-data/snps.csv
b
diff -r 20b4c59bec12 -r 9f23fe0cb70b snipit.xml
--- a/snipit.xml Sun Jul 17 15:01:31 2022 +0000
+++ b/snipit.xml Fri Oct 28 20:58:45 2022 +0000
[
b'@@ -1,108 +1,330 @@\n <tool id="snipit" name="snipit" version="@TOOL_VERSION@+galaxy0">\n     <description>Summarise snps relative to a reference sequence</description>\n     <macros>\n-        <token name="@TOOL_VERSION@">1.0.5</token>\n+        <token name="@TOOL_VERSION@">1.0.7</token>\n+        <xml name="handle_background" tokens="format">\n+            <when value="@FORMAT@">\n+                <param argument="--solid-background" name="transparent_background" type="boolean" truevalue="" falsevalue="--solid-background" label="Plot on transparent background?" />\n+            </when>\n+        </xml>\n     </macros>\n     <requirements>\n         <requirement type="package" version="@TOOL_VERSION@">snipit</requirement>\n     </requirements>\n     <command detect_errors="exit_code"><![CDATA[\n-        snipit \'$alignment\'\n-            #if $opt.reference\n-                -r \'$opt.reference\'\n+        MPLCONFIGDIR=.matplotlib snipit \'$alignment\'\n+            #if str($ref.select) == \'by_id\'\n+                -r \'$ref.id\'\n+            #end if\n+            #if str($style.labels.choose)\n+                -l \'$style.labels.source\'\n+                #if str($style.labels.choose) == \'custom_csv\'\n+                    --l-header \'${style.labels.names_column},${style.labels.labels_column}\'\n+                #end if\n             #end if\n-            #if $opt.labels\n-                -l \'$opt.labels\'\n+            -f $plot.format\n+            #if str($plot.format) in [\'png\', \'svg\', \'tiff\']\n+                $plot.transparent_background\n+            #end if\n+            $write_snps\n+            #if $dims.height > 0\n+                --height $dims.height\n+            #end if\n+            #if $dims.width > 0\n+                --width $dims.width\n             #end if\n-            --l-header \'$opt.l_header\'\n-            -f \'$opt.format\'\n-            --height \'$opt.height\'\n-            --width \'$opt.width\'\n-            --size-option \'$opt.size_option\'\n-            $opt.flip_vertical\n-            #if $opt.exclude_positions\n-                --exclude-positions \'$opt.exclude_positions\'\n+            $dims.size_option\n+            $style.flip_vertical\n+            #if len($pos_restrict.include_positions)\n+                --include-positions\n+                #for $p in $pos_restrict.include_positions\n+                    \'$p.pos\'\n+                #end for\n+            #end if\n+            #if len($pos_restrict.exclude_positions)\n+                --exclude-positions\n+                #for $p in $pos_restrict.exclude_positions\n+                    \'$p.pos\'\n+                #end for\n             #end if\n-            $opt.exclude_ambig_pos\n-            $opt.sort_by_mutation_number\n-            $opt.sort_by_id\n-            #if $opt.sort_by_mutations\n-                --sort-by-mutations \'$opt.sort_by_mutations\'\n+            $pos_restrict.exclude_ambig_pos\n+            $style.sort.order\n+            #if str($style.sort.order) == \'--sort-by-mutation-number\'\n+                $style.sort.high_to_low\n+            #else if str($style.sort.order) == \'--sort-by-mutations\'\n+                #echo \',\'.join([str(p[\'pos\']) for p in $style.sort.positions])\n+                $style.sort.high_to_low\n             #end if\n-            $opt.high_to_low\n-            -c \'$opt.colour_palette\'\n-    ]]>    </command>\n+            #if not str($style.colouring.palette)\n+                --recombi-mode --recombi-references \'$style.colouring.parent1,$style.colouring.parent2\'\n+            #else\n+                -c $style.colouring.palette\n+            #end if\n+    ]]></command>\n     <inputs>\n         <param name="alignment" format="fasta" type="data" label="Input alignment fasta file" />\n-        <section name="opt" title="Optional arguments" expanded="true">\n-            <param name="reference" argument="-r" type="text" optional="true" label="Reference sequence (by sequence ID)" help="Indicates which sequence in the alignment is the reference (by sequence ID). Default: first sequence in alignment" />\n-        '..b'ons" />\n+                    <repeat name="positions">\n+                        <param name="pos" value="3" />\n+                    </repeat>\n+                    <repeat name="positions">\n+                        <param name="pos" value="1" />\n+                    </repeat>\n+                    <repeat name="positions">\n+                        <param name="pos" value="2" />\n+                    </repeat>\n+                    <param name="high_to_low" value="true" />\n+                </conditional>\n+            </section>\n+            <conditional name="plot">\n+                <param name="format" value="svg" />\n+                <param name="transparent_background" value="true" />\n+            </conditional>\n+            <assert_command>\n+                <has_text text="--include-positions \'1-10000\' \'10001-30000\'" />\n+                <has_text text="--exclude-positions \'1000-2000\'" />\n+                <has_text text="--exclude-ambig-pos" />\n+                <has_text text="--sort-by-mutations 3,1,2" />\n+                <has_text text="--high-to-low" />\n+            </assert_command>\n+            <output name="snp_plot" ftype="svg">\n+                <assert_contents>\n+                    <!-- check that the plot does NOT refer to excluded\n+                    position 1059, uses darkseagreen (to highlight Ts) and\n+                    transparent (i.e. NOT white) background -->\n+                    <not_has_text text="&lt;!-- 1059 --&gt;" />\n+                    <has_text text="style=&quot;fill: #8fbc8f" />\n+                    <not_has_text text="style=&quot;fill: #ffffff&quot;" />\n+                </assert_contents>\n+            </output>\n         </test>\n+        <test expect_num_outputs="1">\n+            <param name="alignment" value="input.fasta" />\n+            <section name="style">\n+                <conditional name="colouring">\n+                    <param name="palette" value="" />\n+                    <param name="parent1" value="USA_1" />\n+                    <param name="parent2" value="USA_5" />\n+                </conditional>\n+            </section>\n+            <conditional name="plot">\n+                <param name="format" value="svg" />\n+            </conditional>\n+            <output name="snp_plot" ftype="svg">\n+                <assert_contents>\n+                    <!-- check that the plot does mention position 1059,\n+                    uses goldenrod and #EA5463 as colors (to\n+                    indicate private and parent2 mutations, respectively, in\n+                    recombi-mode) and uses a solid white background -->\n+                    <has_text text="&lt;!-- 1059 --&gt;" />\n+                    <has_text text="style=&quot;fill: #daa520" />\n+                    <has_text text="style=&quot;fill: #ea5463" />\n+                    <has_text text="style=&quot;fill: #ffffff&quot;" />\n+                </assert_contents>\n+            </output>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="alignment" value="input.fasta" />\n+            <section name="style">\n+                <conditional name="labels">\n+                    <param name="choose" value="custom_csv" />\n+                    <param name="source" value="custom_labels.csv" />\n+                    <param name="names_column" value="ori" />\n+                    <param name="labels_column" value="new" />\n+                </conditional>\n+            </section>\n+            <conditional name="plot">\n+                <param name="format" value="svg" />\n+            </conditional>\n+            <output name="snp_plot" ftype="svg">\n+                <assert_contents>\n+                    <!-- check that the plot does not mention the original\n+                    seq IDs but the mapped labels -->\n+                    <not_has_text text="USA_" />\n+                    <has_text text="SAMPLE_" />\n+                </assert_contents>\n+            </output>\n+        </test>\n+\n     </tests>\n     <help><![CDATA[\n **What it does**\n'
b
diff -r 20b4c59bec12 -r 9f23fe0cb70b test-data/custom_labels.csv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/custom_labels.csv Fri Oct 28 20:58:45 2022 +0000
b
@@ -0,0 +1,7 @@
+ori,new
+USA_1,SAMPLE_1
+USA_2,SAMPLE_2
+USA_3,SAMPLE_3
+USA_4,SAMPLE_4
+USA_5,SAMPLE_5
+reference,reference
b
diff -r 20b4c59bec12 -r 9f23fe0cb70b test-data/snps.csv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/snps.csv Fri Oct 28 20:58:45 2022 +0000
b
@@ -0,0 +1,6 @@
+record,snps,num_snps
+USA_1,1059CT;3037CT;8782TC;14408CT;23403AG;25563GT;28144CT,52
+USA_2,15240CT;17747CT;17858AG;18060CT;21774CT,39
+USA_3,1059CT;3037CT;8782TC;13006TC;14408CT;23403AG;25563GT;25688CT;28144CT,68
+USA_4,2005CA;2749CA;3037CT;8782TC;14408CT;20268AG;23403AG;28144CT,59
+USA_5,17747CT;17858AG;18060CT;20281TC,31