Mercurial > repos > goeckslab > scimap_mcmicro_to_anndata
annotate scimap_plotting.py @ 4:49c178651194 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:49 +0000 |
parents | 4c767e1a9e7c |
children |
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 |
4
49c178651194
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
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(): |
4
49c178651194
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) |
49c178651194
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': |
49c178651194
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 |
49c178651194
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit c39cea5ae2ebf61b3d51d687fd9d2930c907b72d
goeckslab
parents:
2
diff
changeset
|
43 elif opt != "": |
49c178651194
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
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
45 |
4c767e1a9e7c
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 |
4c767e1a9e7c
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'] |
4c767e1a9e7c
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'] |
4c767e1a9e7c
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'] |
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 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
|
52 |
4c767e1a9e7c
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) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
54 |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
55 # Plotting |
4c767e1a9e7c
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") |
4c767e1a9e7c
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) |
4c767e1a9e7c
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() |
4c767e1a9e7c
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() |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
60 ax.legend( |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
61 reversed(handles), |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
62 reversed(labels), |
4c767e1a9e7c
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), |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
64 loc='upper left' |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
65 ) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
66 plt.tight_layout() |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
67 |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
68 # # save and close |
4c767e1a9e7c
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) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
70 plt.close(fig) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
71 |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
72 if tool == 'voronoi': |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
73 |
4c767e1a9e7c
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') |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
75 |
4c767e1a9e7c
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) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
77 |
4c767e1a9e7c
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 |
4c767e1a9e7c
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']: |
4c767e1a9e7c
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) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
81 if opt_list: |
4c767e1a9e7c
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(',')] |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
83 |
4c767e1a9e7c
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 |
4c767e1a9e7c
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']: |
4c767e1a9e7c
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) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
87 if opt_list: |
4c767e1a9e7c
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(',')] |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
89 |
4c767e1a9e7c
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 |
4c767e1a9e7c
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'] |
4c767e1a9e7c
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'] |
4c767e1a9e7c
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'] |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
94 |
4c767e1a9e7c
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 |
4c767e1a9e7c
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(): |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
97 if v == '': |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
98 options[k] = None |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
99 |
4c767e1a9e7c
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() |
4c767e1a9e7c
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' |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
102 |
4c767e1a9e7c
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: |
4c767e1a9e7c
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 |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
105 |
4c767e1a9e7c
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 |
4c767e1a9e7c
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) |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
108 |
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 __name__ == '__main__': |
4c767e1a9e7c
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit 9fb5578191db8a559191e45156cfb95350f01aea
goeckslab
parents:
diff
changeset
|
111 aparser = argparse.ArgumentParser() |
4c767e1a9e7c
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) |
4c767e1a9e7c
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) |
4c767e1a9e7c
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) |
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 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
|
117 |
4c767e1a9e7c
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) |