annotate overlay_outlines.py @ 6:f24c370e5ea4 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
author bgruening
date Sun, 05 Nov 2023 09:35:54 +0000
parents f8fa0f6718a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
1 #!/usr/bin/env python
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
2
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
3 import argparse
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
4 import json
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
5
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
6 from cp_common_functions import (get_json_value,
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
7 get_pipeline_lines,
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
8 get_total_number_of_modules,
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
9 INDENTATION, update_module_count,
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
10 write_pipeline)
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
11
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
12 MODULE_NAME = "OverlayOutlines"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
13 OUTPUT_FILENAME = "output.cppipe"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
14
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
15
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
16 def build_ctg_header(module_name, module_number):
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
17 """Creates the first line of a module given the name and module number"""
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
18 result = "|".join(
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
19 [
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
20 f"{module_name}:[module_num:{module_number}",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
21 "svn_version:\\'Unknown\\'",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
22 "variable_revision_number:4",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
23 "show_window:True",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
24 "notes:\\x5B\\'Overlay the embryo outlines on the grayscale image.\\'\\x5D",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
25 "batch_state:array(\\x5B\\x5D, dtype=uint8)",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
26 "enabled:True",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
27 "wants_pause:False]\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
28 ]
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
29 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
30 return result
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
31
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
32
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
33 def build_main_block(input_params):
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
34 result = f"{INDENTATION}Display outlines on a blank image?:{get_json_value(input_params,'con_blank_img.blank_img')}\n"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
35
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
36 on_blank = get_json_value(input_params, "con_blank_img.blank_img")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
37 # defaults
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
38 img_to_display = "None"
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
39 display_mode = get_json_value(
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
40 input_params, "con_blank_img.con_display_mode.display_mode"
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
41 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
42 method_brightness = "Max of image"
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
43 howto = get_json_value(input_params, "howto_outline")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
44 outline_color = "#FF0000"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
45 obj_to_display = "None"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
46
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
47 name_output_img = get_json_value(input_params, "name_output_image")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
48
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
49 if on_blank == "No":
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
50 img_to_display = get_json_value(input_params, "con_blank_img.image_to_outline")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
51
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
52 result += INDENTATION.join(
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
53 [
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
54 f"{INDENTATION}Select image on which to display outlines:{img_to_display}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
55 f"Name the output image:{name_output_img}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
56 f"Outline display mode:{display_mode}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
57 ]
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
58 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
59
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
60 if on_blank == "No" and display_mode == "Grayscale":
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
61 method_brightness = get_json_value(
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
62 input_params, "con_blank_img.con_display_mode.method_brightness"
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
63 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
64
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
65 result += INDENTATION.join(
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
66 [
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
67 f"{INDENTATION}Select method to determine brightness of outlines:{method_brightness}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
68 f"How to outline:{howto}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
69 ]
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
70 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
71
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
72 obj_outline_str = ""
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
73
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
74 if display_mode == "Color":
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
75 for obj in input_params["con_blank_img"]["con_display_mode"][
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
76 "rpt_obj_to_display"
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
77 ]:
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
78 outline_color = get_json_value(obj, "outline_color")
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
79 obj_to_display = get_json_value(obj, "obj_to_display")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
80 obj_outline_str += INDENTATION.join(
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
81 [
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
82 f"{INDENTATION}Select outline color:{outline_color}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
83 f"Select objects to display:{obj_to_display}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
84 ]
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
85 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
86 else: # grayscale
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
87 for obj in input_params["con_blank_img"]["con_display_mode"][
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
88 "rpt_obj_to_display"
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
89 ]:
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
90 obj_to_display = get_json_value(obj, "obj_to_display")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
91 obj_outline_str += INDENTATION.join(
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
92 [
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
93 f"{INDENTATION}Select outline color:{outline_color}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
94 f"Select objects to display:{obj_to_display}\n",
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
95 ]
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
96 )
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
97 obj_outline_str = obj_outline_str.rstrip("\n")
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
98 result += f"{obj_outline_str}"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
99
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
100 return result
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
101
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
102
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
103 if __name__ == "__main__":
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
104 parser = argparse.ArgumentParser()
6
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
105 parser.add_argument("-p", "--pipeline", help="CellProfiler pipeline")
f24c370e5ea4 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 4
diff changeset
106 parser.add_argument("-i", "--inputs", help="JSON inputs from Galaxy")
4
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
107 args = parser.parse_args()
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
108
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
109 pipeline_lines = get_pipeline_lines(args.pipeline)
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
110 inputs_galaxy = json.load(open(args.inputs, "r"))
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
111
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
112 current_module_num = get_total_number_of_modules(pipeline_lines)
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
113 current_module_num += 1
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
114 pipeline_lines = update_module_count(pipeline_lines, current_module_num)
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
115
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
116 header_block = build_ctg_header(MODULE_NAME, current_module_num)
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
117 main_block = build_main_block(inputs_galaxy)
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
118
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
119 module_pipeline = f"\n{header_block}{main_block}\n"
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
120 pipeline_lines.append(module_pipeline)
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
121
f8fa0f6718a3 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
122 write_pipeline(OUTPUT_FILENAME, pipeline_lines)