diff mcmicro_to_anndata.py @ 0:7ed4b55b11f7 draft

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/scimap commit b19cb55dfb751cccc857b95a432890299bfeebb5
author goeckslab
date Tue, 19 Jul 2022 20:29:22 +0000
parents
children ce22e846c5e4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mcmicro_to_anndata.py	Tue Jul 19 20:29:22 2022 +0000
@@ -0,0 +1,45 @@
+import argparse
+import json
+import warnings
+
+import scimap as sm
+
+
+def main(inputs, outfile):
+    """
+    Parameter
+    ---------
+    inputs : str
+        File path to galaxy tool parameter.
+
+    outfile : str
+        File path to estimator.
+    """
+    warnings.simplefilter('ignore')
+
+    with open(inputs, 'r') as param_handler:
+        params = json.load(param_handler)
+
+    image_path = params['image_path']
+    drop_markers = params['drop_markers']
+    if not drop_markers:
+        drop_markers = None
+    else:
+        drop_markers = [x.strip() for x in drop_markers.split(',')]
+    options = params['options']
+    for k, v in options.items():
+        if v == '':
+            options[k] = None
+
+    adata = sm.pp.mcmicro_to_scimap(image_path, drop_markers=drop_markers, **options)
+
+    adata.write(outfile)
+
+
+if __name__ == '__main__':
+    aparser = argparse.ArgumentParser()
+    aparser.add_argument("-i", "--inputs", dest="inputs", required=True)
+    aparser.add_argument("-e", "--outfile", dest="outfile", required=True)
+    args = aparser.parse_args()
+
+    main(args.inputs, args.outfile)