changeset 4:2983eb1d7362 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:55 +0000
parents 472780baf150
children
files main_macros.xml scimap_plotting.py
diffstat 2 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/main_macros.xml	Wed Jun 26 15:26:49 2024 +0000
+++ b/main_macros.xml	Tue Jul 30 18:20:55 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:49 2024 +0000
+++ b/scimap_plotting.py	Tue Jul 30 18:20:55 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)