changeset 2:ef73596d678a draft default tip

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
author goeckslab
date Tue, 30 Jul 2024 18:20:43 +0000
parents c42e97dc5a3a
children
files main_macros.xml scimap_plotting.py scimap_plotting.xml
diffstat 3 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/main_macros.xml	Wed Jun 26 15:26:55 2024 +0000
+++ b/main_macros.xml	Tue Jul 30 18:20:43 2024 +0000
@@ -1,6 +1,6 @@
 <macros>
     <token name="@TOOL_VERSION@">2.1.0</token>
-    <token name="@VERSION_SUFFIX@">1</token>
+    <token name="@VERSION_SUFFIX@">2</token>
     <token name="@PROFILE@">20.01</token>
 
     <xml name="scimap_requirements">
--- a/scimap_plotting.py	Wed Jun 26 15:26:55 2024 +0000
+++ b/scimap_plotting.py	Tue Jul 30 18:20:43 2024 +0000
@@ -3,7 +3,7 @@
 import os
 import warnings
 
-import matplotlib.pylab as plt
+import matplotlib.pyplot as plt
 import numpy as np
 import scimap as sm
 import seaborn as sns
@@ -37,9 +37,11 @@
 
         # parse list text arguments
         for o in options.copy():
-            opt_list = options.pop(o)
-            if opt_list:
-                options[o] = [x.strip() for x in opt_list.split(',')]
+            opt = options.pop(o)
+            if o == 'matplotlib_cmap':
+                matplotlib_cmap = opt
+            elif opt != "":
+                options[o] = [x.strip() for x in opt.split(',')]
 
         # add base args into options dict to pass to tool
         options['x_axis'] = params['analyses']['x_axis']
@@ -50,15 +52,6 @@
 
         df = sm.pl.stacked_barplot(adata, **options)
 
-        # Pick cmap to use
-        num_phenotypes = len(df.columns) - 1
-        if num_phenotypes <= 9:
-            matplotlib_cmap = "Set1"
-        elif num_phenotypes > 9 and num_phenotypes <= 20:
-            matplotlib_cmap = plt.cm.tab20
-        else:
-            matplotlib_cmap = plt.cm.gist_ncar
-
         # Plotting
         sns.set_theme(style="white")
         ax = df.plot.bar(stacked=True, cmap=matplotlib_cmap)
--- a/scimap_plotting.xml	Wed Jun 26 15:26:55 2024 +0000
+++ b/scimap_plotting.xml	Tue Jul 30 18:20:43 2024 +0000
@@ -38,6 +38,20 @@
                     <param argument="subset_yaxis" type="text" value="" optional="true" label="Subset y-axis prior to plotting. Type in a list of categories to include on y-axis" help="Optional. Comma delimited. Default is all categories in y-axis variable" />
                     <param argument="order_xaxis" type="text" value="" optional="true" label="Type in a list of categories to order to x-axis" help="Optional. Comma delimited. Default ordering is alphabetical" />
                     <param argument="order_yaxis" type="text" value="" optional="true" label="Type in a list of categories to order to y-axis" help="Optional. Comma delimited. Default ordering is alphabetical" />
+                    <param argument="matplotlib_cmap" type="select" label="Matplotlib colormap to use for y-axis categories" help="See link below for colormaps explanation">
+                        <option value="Pastel1">Pastel1</option>
+                        <option value="Pastel2">Pastel2</option>
+                        <option value="Paired">Paired</option>
+                        <option value="Accent">Accent</option>
+                        <option value="Dark2">Dark2</option>
+                        <option selected="true" value="Set1">Set1</option>
+                        <option value="Set2">Set2</option>
+                        <option value="Set3">Set3</option>
+                        <option value="tab10">tab10</option>
+                        <option value="tab20">tab20</option>
+                        <option value="tab20b">tab20b</option>
+                        <option value="tab20c">tab20c</option>
+                    </param>
                 </section>
             </when>
             <when value="voronoi">
@@ -97,16 +111,9 @@
         <![CDATA[
 **What it does**
 
-This tool does various single cell spatial analyses with Scimap.
-
-**Input**
+This tool creates stacked barplots or Voronoi plots from single-cell spatial data using Scimap
 
-AnnData.
-
-**Output**
-
-Anndata with a corresponding key added.
-
+For the stacked barplot tool, find colormap descriptions here: https://matplotlib.org/stable/users/explain/colors/colormaps.html
 
         ]]>
     </help>