annotate scimap_plotting.py @ 2:4c767e1a9e7c draft

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
author goeckslab
date Mon, 10 Jun 2024 18:45:21 +0000
parents
children 49c178651194
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
1 import argparse
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
2 import json
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
3 import os
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
4 import warnings
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
5
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
6 import matplotlib.pylab as plt
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
7 import numpy as np
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
8 import scimap as sm
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
9 import seaborn as sns
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
10 from anndata import read_h5ad
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
11
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
12 sns.set(color_codes=True)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
13
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
14
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
15 def main(inputs, anndata, output):
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
16 """
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
17 Parameter
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
18 ---------
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
19 inputs : str
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
20 File path to galaxy tool parameter.
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
21 anndata : str
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
22 File path to anndata containing phenotyping info.
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
23 output : str
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
24 File path to output.
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
25 """
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
26 warnings.simplefilter('ignore')
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
27
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
28 with open(inputs, 'r') as param_handler:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
29 params = json.load(param_handler)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
30
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
31 adata = read_h5ad(anndata)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
32
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
33 tool = params['analyses']['selected_tool']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
34 options = params['analyses']['options']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
35
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
36 if tool == 'stacked_barplot':
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
37
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
38 # parse list text arguments
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
39 for o in options.copy():
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
40 opt_list = options.pop(o)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
41 if opt_list:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
42 options[o] = [x.strip() for x in opt_list.split(',')]
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
43
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
44 # add base args into options dict to pass to tool
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
45 options['x_axis'] = params['analyses']['x_axis']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
46 options['y_axis'] = params['analyses']['y_axis']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
47 options['method'] = params['analyses']['method']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
48
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
49 options['return_data'] = True
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
50
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
51 df = sm.pl.stacked_barplot(adata, **options)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
52
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
53 # Pick cmap to use
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
54 num_phenotypes = len(df.columns) - 1
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
55 if num_phenotypes <= 9:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
56 matplotlib_cmap = "Set1"
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
57 elif num_phenotypes > 9 and num_phenotypes <= 20:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
58 matplotlib_cmap = plt.cm.tab20
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
59 else:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
60 matplotlib_cmap = plt.cm.gist_ncar
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
61
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
62 # Plotting
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
63 sns.set_theme(style="white")
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
64 ax = df.plot.bar(stacked=True, cmap=matplotlib_cmap)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
65 fig = ax.get_figure()
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
66 handles, labels = ax.get_legend_handles_labels()
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
67 ax.legend(
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
68 reversed(handles),
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
69 reversed(labels),
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
70 bbox_to_anchor=(1, 1),
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
71 loc='upper left'
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
72 )
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
73 plt.tight_layout()
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
74
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
75 # # save and close
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
76 fig.savefig('out.png', dpi=300)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
77 plt.close(fig)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
78
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
79 if tool == 'voronoi':
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
80
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
81 plt.style.use('fast')
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
82
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
83 tool_func = getattr(sm.pl, tool)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
84
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
85 # x_lim/y_lim need to be parsed from comma-sep str to integer tuples
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
86 for lim in ['x_lim', 'y_lim']:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
87 opt_list = options.pop(lim)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
88 if opt_list:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
89 options[lim] = [int(x.strip()) for x in opt_list.split(',')]
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
90
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
91 # parse list text arguments
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
92 for cat in ['overlay_points_categories', 'overlay_drop_categories']:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
93 opt_list = options.pop(cat)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
94 if opt_list:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
95 options[cat] = [x.strip() for x in opt_list.split(',')]
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
96
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
97 # add base args into options dict to pass to tool
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
98 options['color_by'] = params['analyses']['color_by']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
99 options['x_coordinate'] = params['analyses']['x_coordinate']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
100 options['y_coordinate'] = params['analyses']['y_coordinate']
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
101
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
102 # fill any missing params with None as tool expects
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
103 for k, v in options.items():
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
104 if v == '':
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
105 options[k] = None
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
106
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
107 options['saveDir'] = os.getcwd()
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
108 options['fileName'] = 'out.png'
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
109
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
110 if options['size_max'] is None:
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
111 options['size_max'] = np.inf
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
112
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
113 # call the tool and unpack all options
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
114 tool_func(adata, **options)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
115
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
116
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
117 if __name__ == '__main__':
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
118 aparser = argparse.ArgumentParser()
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
119 aparser.add_argument("-i", "--inputs", dest="inputs", required=True)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
120 aparser.add_argument("-a", "--anndata", dest="anndata", required=True)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
121 aparser.add_argument("-e", "--output", dest="output", required=True)
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
122
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
123 args = aparser.parse_args()
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
124
4c767e1a9e7c planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff changeset
125 main(args.inputs, args.anndata, args.output)