comparison mcmicro_to_anndata.py @ 0:199b5f278356 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:44:49 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:199b5f278356
1 import argparse
2 import json
3 import warnings
4
5 import scimap as sm
6
7
8 def main(inputs, outfile):
9 """
10 Parameter
11 ---------
12 inputs : str
13 File path to galaxy tool parameter.
14
15 outfile : str
16 File path to estimator.
17 """
18 warnings.simplefilter('ignore')
19
20 with open(inputs, 'r') as param_handler:
21 params = json.load(param_handler)
22
23 image_path = params['image_path']
24 drop_markers = params['drop_markers']
25 if not drop_markers:
26 drop_markers = None
27 else:
28 drop_markers = [x.strip() for x in drop_markers.split(',')]
29 options = params['options']
30 for k, v in options.items():
31 if v == '':
32 options[k] = None
33
34 adata = sm.pp.mcmicro_to_scimap(
35 image_path,
36 drop_markers=drop_markers,
37 **options
38 )
39
40 adata.write(outfile)
41
42
43 if __name__ == '__main__':
44 aparser = argparse.ArgumentParser()
45 aparser.add_argument("-i", "--inputs", dest="inputs", required=True)
46 aparser.add_argument("-e", "--outfile", dest="outfile", required=True)
47 args = aparser.parse_args()
48
49 main(args.inputs, args.outfile)