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

Changeset 16:1072ce66b426 (2024-08-20)
Previous changeset 15:70fa84e99463 (2024-07-31) Next changeset 17:2dfb2227a16c (2024-09-14)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scanpy/ commit 0ef475df22ba51263bb3d1db9f8797c723db35b0
modified:
macros.xml
plot.xml
test-data/cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1.h5ad
added:
test-data/cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1_out.h5ad
test-data/pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_1.png
test-data/pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_filtered_1.png
b
diff -r 70fa84e99463 -r 1072ce66b426 macros.xml
--- a/macros.xml Wed Jul 31 18:11:37 2024 +0000
+++ b/macros.xml Tue Aug 20 09:53:51 2024 +0000
[
@@ -435,6 +435,10 @@
             </when>
             <when value="customfile">
                 <param argument="var_names" type="data" format="tabular" label="List of variables to plot" help="This should be a tsv where row = group (e.g. celltypes) and columns = variables."></param>
+                <param name="header" type="select" label="Header in the list of markers?">
+                    <option value="included">Header incldued</option>
+                    <option value="not_included">Header not included</option>
+                </param>
             </when>
         </conditional>
     </xml>
@@ -471,6 +475,12 @@
         <expand macro="param_groupby"/>
         <expand macro="param_num_categories"/>
     </xml>
+    <token name="@CMD_var_names_header_check@"><![CDATA[
+header='infer'
+#if $method.var_names.type == 'customfile' and $method.var_names.header == 'not_included' :
+header=None
+#end if
+    ]]></token>
     <token name="@CMD_params_inputs@"><![CDATA[
     #if $method.var_names.type == 'custom'
     #set $var_names = ([x.strip() for x in str($method.var_names.var_names).split(',')])
b
diff -r 70fa84e99463 -r 1072ce66b426 plot.xml
--- a/plot.xml Wed Jul 31 18:11:37 2024 +0000
+++ b/plot.xml Tue Aug 20 09:53:51 2024 +0000
[
@@ -79,6 +79,7 @@
     frameon=$method.plot.frameon)
 
 #else if $method.method == 'pl.heatmap'
+@CMD_var_names_header_check@
 sc.pl.heatmap(
     @CMD_param_plot_inputs@
     #if $method.gene_symbols
@@ -89,6 +90,7 @@
     @CMD_pl_heatmap@)
 
 #else if $method.method == 'pl.dotplot'
+@CMD_var_names_header_check@
 sc.pl.dotplot(
     @CMD_param_plot_inputs@
     #if $method.gene_symbols
@@ -129,6 +131,7 @@
     @CMD_params_seaborn_violinplot@)
 
 #else if $method.method == 'pl.stacked_violin'
+@CMD_var_names_header_check@
 sc.pl.stacked_violin(
     @CMD_param_plot_inputs@
     #if $method.gene_symbols
@@ -139,6 +142,7 @@
     @CMD_pl_stacked_violin@)
 
 #else if $method.method == 'pl.matrixplot'
+@CMD_var_names_header_check@
 sc.pl.matrixplot(
     @CMD_param_plot_inputs@
     #if $method.gene_symbols
@@ -399,9 +403,26 @@
     scale='$method.violin_plot.scale')
 
 #else if $method.method == 'pl.rank_genes_groups_dotplot'
+
+@CMD_var_names_header_check@
+
 sc.pl.rank_genes_groups_dotplot(
     @CMD_param_plot_inputs@
-    @CMD_pl_rank_genes_groups_ext@
+    #if $method.var_names.type == 'custom'
+    #set $var_names = ([x.strip() for x in str($method.var_names.var_names).split(',')])
+    var_names=$var_names,
+    #else if $method.var_names.type == 'customfile'
+    var_names={key: [v for v in list(value.values()) if pd.notna(v)] for key, value in pd.read_csv('$var_names', sep='\t', index_col=0, header=header).to_dict(orient='index').items()},
+    #else
+    n_genes=$method.n_genes,
+    #end if
+    #if $method.groupby != ''
+    groupby='$method.groupby',
+    #end if
+    num_categories=$method.num_categories,
+    #if $method.key != ''
+    key='$method.key',
+    #end if
     #if $method.gene_symbols
     gene_symbols='$method.gene_symbols',
     #end if
@@ -819,6 +840,7 @@
                 </section>
             </when>
             <when value="pl.rank_genes_groups_dotplot">
+                <expand macro="params_inputs"/>
                 <expand macro="pl_rank_genes_groups_ext"/>
                 <expand macro="params_plots"/>
                 <expand macro="gene_symbols"/>
@@ -2033,6 +2055,9 @@
                 <param name="method" value="pl.rank_genes_groups_dotplot"/>
                 <param name="gene_symbols" value="symbol"/>
                 <param name="n_genes" value="10"/>
+                <conditional name="var_names">
+                  <param name="type" value="all"/>
+                </conditional>
                 <param name="log" value="False"/>
                 <param name="use_raw" value="False"/>
                 <param name="dendrogram" value="False"/>
@@ -2233,6 +2258,80 @@
             </output>
             <output name="out_png" file="pl.scatter.pbmc68k_reduced.png" ftype="png" compare="sim_size"/>
         </test>
+        <test expect_num_outputs="2">
+            <!-- test 35: pl.rank_genes_groups_dotplot with marker list -->
+            <param name="adata" value="cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1.h5ad" />
+            <param name="format" value="png"/>
+            <conditional name="method">
+                <param name="method" value="pl.rank_genes_groups_dotplot"/>
+                <conditional name="var_names">
+                  <param name="type" value="customfile"/>
+                  <param name="var_names" value="tl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_1.tsv"/>
+                </conditional>
+                <param name="groupby" value="bulk_labels"/>
+                <param name="log" value="False"/>
+                <param name="use_raw" value="False"/>
+                <param name="dendrogram" value="False"/>
+                <param name="color_map" value="viridis"/>
+                <section name="matplotlib_pyplot_scatter">
+                    <param name="linewidths" value="0" />
+                    <param name="edgecolors" value="face"/>
+                </section>
+            </conditional>
+            <section name="advanced_common">
+                <param name="show_log" value="true" />
+            </section>
+            <output name="hidden_output">
+                <assert_contents>
+                    <has_text_matching expression="sc.pl.rank_genes_groups_dotplot"/>
+                    <has_text_matching expression="groupby='bulk_labels'"/>
+                    <has_text_matching expression="log=False"/>
+                    <has_text_matching expression="use_raw=False"/>
+                    <has_text_matching expression="dendrogram=False"/>
+                    <has_text_matching expression="color_map='viridis'"/>
+                    <has_text_matching expression="lw=0.0"/>
+                    <has_text_matching expression="ec='face'"/>
+                </assert_contents>
+            </output>
+            <output name="out_png" file="pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_1.png" ftype="png" compare="sim_size"/>
+        </test>
+        <test expect_num_outputs="2">
+            <!-- test 36: pl.rank_genes_groups_dotplot with marker list -->
+            <param name="adata" value="cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1.h5ad" />
+            <param name="format" value="png"/>
+            <conditional name="method">
+                <param name="method" value="pl.rank_genes_groups_dotplot"/>
+                <conditional name="var_names">
+                  <param name="type" value="customfile"/>
+                  <param name="var_names" value="tl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_filtered_1.tsv"/>
+                </conditional>
+                <param name="groupby" value="bulk_labels"/>
+                <param name="log" value="False"/>
+                <param name="use_raw" value="False"/>
+                <param name="dendrogram" value="False"/>
+                <param name="color_map" value="viridis"/>
+                <section name="matplotlib_pyplot_scatter">
+                    <param name="linewidths" value="0" />
+                    <param name="edgecolors" value="face"/>
+                </section>
+            </conditional>
+            <section name="advanced_common">
+                <param name="show_log" value="true" />
+            </section>
+            <output name="hidden_output">
+                <assert_contents>
+                    <has_text_matching expression="sc.pl.rank_genes_groups_dotplot"/>
+                    <has_text_matching expression="groupby='bulk_labels'"/>
+                    <has_text_matching expression="log=False"/>
+                    <has_text_matching expression="use_raw=False"/>
+                    <has_text_matching expression="dendrogram=False"/>
+                    <has_text_matching expression="color_map='viridis'"/>
+                    <has_text_matching expression="lw=0.0"/>
+                    <has_text_matching expression="ec='face'"/>
+                </assert_contents>
+            </output>
+            <output name="out_png" file="pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_filtered_1.png" ftype="png" compare="sim_size"/>
+        </test>
     </tests>
     <help><![CDATA[
 Generic: Scatter plot along observations or variables axes (`pl.scatter`)
b
diff -r 70fa84e99463 -r 1072ce66b426 test-data/cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1.h5ad
b
Binary file test-data/cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1.h5ad has changed
b
diff -r 70fa84e99463 -r 1072ce66b426 test-data/cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1_out.h5ad
b
Binary file test-data/cosg.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_1_out.h5ad has changed
b
diff -r 70fa84e99463 -r 1072ce66b426 test-data/pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_1.png
b
Binary file test-data/pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_1.png has changed
b
diff -r 70fa84e99463 -r 1072ce66b426 test-data/pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_filtered_1.png
b
Binary file test-data/pl.rank_genes_groups.newton-cg.pbmc68k_highly_reduced_marker_filtered_1.png has changed