Mercurial > repos > goeckslab > scimap_phenotyping
annotate scimap_plotting.py @ 4:88fca6e905be 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:21:08 +0000 |
parents | ce22e846c5e4 |
children |
rev | line source |
---|---|
2
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
1 import argparse |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
2 import json |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
3 import os |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
4 import warnings |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
5 |
4
88fca6e905be
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
6 import matplotlib.pyplot as plt |
2
ce22e846c5e4
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 |
ce22e846c5e4
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 |
ce22e846c5e4
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 |
ce22e846c5e4
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 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
11 |
ce22e846c5e4
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) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
13 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
14 |
ce22e846c5e4
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): |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
16 """ |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
17 Parameter |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
18 --------- |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
19 inputs : str |
ce22e846c5e4
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. |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
21 anndata : str |
ce22e846c5e4
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. |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
23 output : str |
ce22e846c5e4
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. |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
25 """ |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
26 warnings.simplefilter('ignore') |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
27 |
ce22e846c5e4
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: |
ce22e846c5e4
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) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
30 |
ce22e846c5e4
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) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
32 |
ce22e846c5e4
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'] |
ce22e846c5e4
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'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
35 |
ce22e846c5e4
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': |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
37 |
ce22e846c5e4
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 |
ce22e846c5e4
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(): |
4
88fca6e905be
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
40 opt = options.pop(o) |
88fca6e905be
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
41 if o == 'matplotlib_cmap': |
88fca6e905be
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
42 matplotlib_cmap = opt |
88fca6e905be
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
43 elif opt != "": |
88fca6e905be
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
44 options[o] = [x.strip() for x in opt.split(',')] |
2
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
45 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
46 # add base args into options dict to pass to tool |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
47 options['x_axis'] = params['analyses']['x_axis'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
48 options['y_axis'] = params['analyses']['y_axis'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
49 options['method'] = params['analyses']['method'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
50 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
51 options['return_data'] = True |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
52 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
53 df = sm.pl.stacked_barplot(adata, **options) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
54 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
55 # Plotting |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
56 sns.set_theme(style="white") |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
57 ax = df.plot.bar(stacked=True, cmap=matplotlib_cmap) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
58 fig = ax.get_figure() |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
59 handles, labels = ax.get_legend_handles_labels() |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
60 ax.legend( |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
61 reversed(handles), |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
62 reversed(labels), |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
63 bbox_to_anchor=(1, 1), |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
64 loc='upper left' |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
65 ) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
66 plt.tight_layout() |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
67 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
68 # # save and close |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
69 fig.savefig('out.png', dpi=300) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
70 plt.close(fig) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
71 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
72 if tool == 'voronoi': |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
73 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
74 plt.style.use('fast') |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
75 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
76 tool_func = getattr(sm.pl, tool) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
77 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
78 # x_lim/y_lim need to be parsed from comma-sep str to integer tuples |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
79 for lim in ['x_lim', 'y_lim']: |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
80 opt_list = options.pop(lim) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
81 if opt_list: |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
82 options[lim] = [int(x.strip()) for x in opt_list.split(',')] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
83 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
84 # parse list text arguments |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
85 for cat in ['overlay_points_categories', 'overlay_drop_categories']: |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
86 opt_list = options.pop(cat) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
87 if opt_list: |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
88 options[cat] = [x.strip() for x in opt_list.split(',')] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
89 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
90 # add base args into options dict to pass to tool |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
91 options['color_by'] = params['analyses']['color_by'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
92 options['x_coordinate'] = params['analyses']['x_coordinate'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
93 options['y_coordinate'] = params['analyses']['y_coordinate'] |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
94 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
95 # fill any missing params with None as tool expects |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
96 for k, v in options.items(): |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
97 if v == '': |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
98 options[k] = None |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
99 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
100 options['saveDir'] = os.getcwd() |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
101 options['fileName'] = 'out.png' |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
102 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
103 if options['size_max'] is None: |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
104 options['size_max'] = np.inf |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
105 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
106 # call the tool and unpack all options |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
107 tool_func(adata, **options) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
108 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
109 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
110 if __name__ == '__main__': |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
111 aparser = argparse.ArgumentParser() |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
112 aparser.add_argument("-i", "--inputs", dest="inputs", required=True) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
113 aparser.add_argument("-a", "--anndata", dest="anndata", required=True) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
114 aparser.add_argument("-e", "--output", dest="output", required=True) |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
115 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
116 args = aparser.parse_args() |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
117 |
ce22e846c5e4
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
118 main(args.inputs, args.anndata, args.output) |