annotate tile.py @ 2:bad171ed1e96 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:33:04 +0000
parents e8f822eeb9fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
1 #!/usr/bin/env python
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
2
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
3 import argparse
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
4 import json
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
5
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
6 from cp_common_functions import (get_json_value,
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
7 get_pipeline_lines,
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
8 get_total_number_of_modules,
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
9 INDENTATION, update_module_count,
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
10 write_pipeline)
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
11
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
12 MODULE_NAME = "Tile"
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
13 OUTPUT_FILENAME = "output.cppipe"
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
14
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
15
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
16 def build_header(module_name, module_number):
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
17 result = "|".join(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
18 [
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
19 f"{module_name}:[module_num:{module_number}",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
20 "svn_version:\\'Unknown\\'",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
21 "variable_revision_number:1",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
22 "show_window:True",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
23 "notes:\\x5B\\'Tile the original color image, the outlined image and the image of tracked labels together.\\'\\x5D",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
24 "batch_state:array(\\x5B\\x5D, dtype=uint8)",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
25 "enabled:True",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
26 "wants_pause:False]\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
27 ]
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
28 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
29 return result
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
30
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
31
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
32 def build_main_block(input_params):
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
33 result = INDENTATION.join(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
34 [
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
35 f"{INDENTATION}Select an input image:{get_json_value(input_params,'input_image')}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
36 f"Name the output image:{get_json_value(input_params,'output_image_name')}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
37 f"Tile assembly method:{get_json_value(input_params,'con_assembly_method.assembly_method')}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
38 ]
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
39 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
40
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
41 calc_rows = get_json_value(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
42 input_params, "con_assembly_method.con_calc_no_row.calc_no_row"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
43 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
44 no_of_rows = 8
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
45
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
46 calc_cols = get_json_value(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
47 input_params, "con_assembly_method.con_calc_no_cols.calc_no_cols"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
48 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
49 no_of_cols = 12
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
50
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
51 if calc_rows == "No":
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
52 no_of_rows = get_json_value(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
53 input_params, "con_assembly_method.con_calc_no_row.no_of_row"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
54 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
55
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
56 if calc_cols == "No":
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
57 no_of_cols = get_json_value(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
58 input_params, "con_assembly_method.con_calc_no_cols.no_of_cols"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
59 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
60
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
61 corner_to_begin = get_json_value(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
62 input_params, "con_assembly_method.corner_to_begin"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
63 )
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
64 direction_tiling = get_json_value(input_params, "con_assembly_method.direction")
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
65 meander = get_json_value(input_params, "con_assembly_method.meander_mode")
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
66
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
67 assembly_method = get_json_value(
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
68 input_params, "con_assembly_method.assembly_method"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
69 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
70
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
71 result += INDENTATION.join(
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
72 [
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
73 f"{INDENTATION}Final number of rows:{str(no_of_rows)}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
74 f"Final number of columns:{str(no_of_cols)}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
75 f"Image corner to begin tiling:{corner_to_begin}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
76 f"Direction to begin tiling:{direction_tiling}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
77 f"Use meander mode?:{meander}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
78 f"Automatically calculate number of rows?:{calc_rows}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
79 f"Automatically calculate number of columns?:{calc_cols}\n",
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
80 ]
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
81 )
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
82
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
83 if assembly_method == "Within cycles":
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
84 additionals = input_params["con_assembly_method"]["rpt_additional_image"]
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
85
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
86 for img in additionals:
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
87 result += INDENTATION.join(
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
88 [
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
89 f"{INDENTATION}Select an additional image to tile:{get_json_value(img, 'additional_img')}\n"
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
90 ]
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
91 )
1
e8f822eeb9fd "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 7d7a519c3a2cc612d38695b335d0f6c75a099de3"
bgruening
parents: 0
diff changeset
92 result = result.rstrip("\n")
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
93 return result
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
94
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
95
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
96 if __name__ == "__main__":
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
97 parser = argparse.ArgumentParser()
2
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
98 parser.add_argument("-p", "--pipeline", help="CellProfiler pipeline")
bad171ed1e96 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
bgruening
parents: 1
diff changeset
99 parser.add_argument("-i", "--inputs", help="JSON inputs from Galaxy")
0
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
100 args = parser.parse_args()
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
101
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
102 pipeline_lines = get_pipeline_lines(args.pipeline)
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
103 inputs_galaxy = json.load(open(args.inputs, "r"))
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
104
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
105 current_module_num = get_total_number_of_modules(pipeline_lines)
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
106 current_module_num += 1
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
107 pipeline_lines = update_module_count(pipeline_lines, current_module_num)
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
108
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
109 header_block = build_header(MODULE_NAME, current_module_num)
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
110 main_block = build_main_block(inputs_galaxy)
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
111
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
112 module_pipeline = f"\n{header_block}{main_block}\n"
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
113 pipeline_lines.append(module_pipeline)
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
114
4395ea2a01f4 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
diff changeset
115 write_pipeline(OUTPUT_FILENAME, pipeline_lines)