Mercurial > repos > bgruening > cp_cellprofiler
comparison starting_modules.py @ 7:eb6c08714244 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:28:09 +0000 |
parents | 0e4dccaafef5 |
children |
comparison
equal
deleted
inserted
replaced
6:0e4dccaafef5 | 7:eb6c08714244 |
---|---|
7 | 7 |
8 params = json.load(open(input_json_path, "r")) | 8 params = json.load(open(input_json_path, "r")) |
9 | 9 |
10 | 10 |
11 def write_images(): | 11 def write_images(): |
12 filter_images = params['images']['filter_images'] | 12 filter_images = params["images"]["filter_images"] |
13 | 13 |
14 _str = "\nImages:[module_num:1|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|notes:\\x5B\\'To begin creating your project, use the Images module to compile a list of files and/or folders that you want to analyze. You can also specify a set of rules to include only the desired files in your selected folders.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" | 14 _str = "\nImages:[module_num:1|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|notes:\\x5B\\'To begin creating your project, use the Images module to compile a list of files and/or folders that you want to analyze. You can also specify a set of rules to include only the desired files in your selected folders.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" |
15 _str += FOURSPACES + ":\n" | 15 _str += FOURSPACES + ":\n" |
16 _str += FOURSPACES + "Filter images?:%s\n" % filter_images | 16 _str += FOURSPACES + "Filter images?:%s\n" % filter_images |
17 _str += FOURSPACES + "Select the rule criteria:and (extension does isimage) (directory doesnot startwith \".\")\n" | 17 _str += ( |
18 FOURSPACES | |
19 + 'Select the rule criteria:and (extension does isimage) (directory doesnot startwith ".")\n' | |
20 ) | |
18 | 21 |
19 return _str | 22 return _str |
20 | 23 |
21 | 24 |
22 def write_metadata(): | 25 def write_metadata(): |
23 metadata_extraction = params['metadata']['con_metadata_extraction'] | 26 metadata_extraction = params["metadata"]["con_metadata_extraction"] |
24 extract = metadata_extraction['extract'] | 27 extract = metadata_extraction["extract"] |
25 | 28 |
26 if 'extraction_method' in metadata_extraction: | 29 if "extraction_method" in metadata_extraction: |
27 method_count = len(metadata_extraction['extraction_method']) | 30 method_count = len(metadata_extraction["extraction_method"]) |
28 else: | 31 else: |
29 method_count = 1 | 32 method_count = 1 |
30 | 33 |
31 _str = "\nMetadata:[module_num:2|svn_version:\\'Unknown\\'|variable_revision_number:4|show_window:False|notes:\\x5B\\'The Metadata module optionally allows you to extract information describing your images (i.e, metadata) which will be stored along with your measurements. This information can be contained in the file name and/or location, or in an external file.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" | 34 _str = "\nMetadata:[module_num:2|svn_version:\\'Unknown\\'|variable_revision_number:4|show_window:False|notes:\\x5B\\'The Metadata module optionally allows you to extract information describing your images (i.e, metadata) which will be stored along with your measurements. This information can be contained in the file name and/or location, or in an external file.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" |
32 _str += FOURSPACES + "Extract metadata?:%s\n" % extract | 35 _str += FOURSPACES + "Extract metadata?:%s\n" % extract |
33 | 36 |
34 if extract == "No": | 37 if extract == "No": |
35 _str += FOURSPACES + "Metadata data type:Text\n" | 38 _str += FOURSPACES + "Metadata data type:Text\n" |
36 _str += FOURSPACES + "Metadata types:{}\n" | 39 _str += FOURSPACES + "Metadata types:{}\n" |
37 _str += FOURSPACES + "Extraction method count:%d\n" % method_count | 40 _str += FOURSPACES + "Extraction method count:%d\n" % method_count |
38 _str += FOURSPACES + "Metadata extraction method:Extract from file/folder names\n" | 41 _str += ( |
39 _str += FOURSPACES + "Regular expression to extract from file name:^(?P<Plate>.*)_(?P<Well>\x5BA-P\x5D\x5B0-9\x5D{2})_s(?P<Site>\x5B0-9\x5D)_w(?P<ChannelNumber>\x5B0-9\x5D)\n" | 42 FOURSPACES + "Metadata extraction method:Extract from file/folder names\n" |
40 _str += FOURSPACES + "Regular expression to extract from folder name:(?P<Date>\x5B0-9\x5D{4}_\x5B0-9\x5D{2}_\x5B0-9\x5D{2})$\n" | 43 ) |
44 _str += ( | |
45 FOURSPACES | |
46 + "Regular expression to extract from file name:^(?P<Plate>.*)_(?P<Well>\x5BA-P\x5D\x5B0-9\x5D{2})_s(?P<Site>\x5B0-9\x5D)_w(?P<ChannelNumber>\x5B0-9\x5D)\n" | |
47 ) | |
48 _str += ( | |
49 FOURSPACES | |
50 + "Regular expression to extract from folder name:(?P<Date>\x5B0-9\x5D{4}_\x5B0-9\x5D{2}_\x5B0-9\x5D{2})$\n" | |
51 ) | |
41 _str += FOURSPACES + "Extract metadata from:All images\n" | 52 _str += FOURSPACES + "Extract metadata from:All images\n" |
42 _str += FOURSPACES + "Select the filtering criteria:and (file does contain \"\")\n" | 53 _str += ( |
54 FOURSPACES + 'Select the filtering criteria:and (file does contain "")\n' | |
55 ) | |
43 _str += FOURSPACES + "Metadata file location:\n" | 56 _str += FOURSPACES + "Metadata file location:\n" |
44 _str += FOURSPACES + "Match file and image metadata:\x5B\x5D\n" | 57 _str += FOURSPACES + "Match file and image metadata:\x5B\x5D\n" |
45 _str += FOURSPACES + "Use case insensitive matching?:No\n" | 58 _str += FOURSPACES + "Use case insensitive matching?:No\n" |
46 else: | 59 else: |
47 _str += FOURSPACES + "Metadata data type:Text\n" # default Text,not possible to select in Galaxy | 60 _str += ( |
61 FOURSPACES + "Metadata data type:Text\n" | |
62 ) # default Text,not possible to select in Galaxy | |
48 _str += FOURSPACES + "Metadata types:{}\n" | 63 _str += FOURSPACES + "Metadata types:{}\n" |
49 _str += FOURSPACES + "Extraction method count:%d\n" % method_count | 64 _str += FOURSPACES + "Extraction method count:%d\n" % method_count |
50 | 65 |
51 for methods in metadata_extraction["extraction_method"]: | 66 for methods in metadata_extraction["extraction_method"]: |
52 _str += FOURSPACES + "Metadata extraction method:%s\n" % methods["metadata_extraction_method"] | 67 _str += ( |
53 _str += FOURSPACES + "Metadata source:%s\n" % methods["con_metadata_source"]["metadata_source"] | 68 FOURSPACES |
69 + "Metadata extraction method:%s\n" | |
70 % methods["metadata_extraction_method"] | |
71 ) | |
72 _str += ( | |
73 FOURSPACES | |
74 + "Metadata source:%s\n" | |
75 % methods["con_metadata_source"]["metadata_source"] | |
76 ) | |
54 | 77 |
55 if "file_name_regex" in methods["con_metadata_source"]: | 78 if "file_name_regex" in methods["con_metadata_source"]: |
56 file_regex = methods["con_metadata_source"]["file_name_regex"] | 79 file_regex = methods["con_metadata_source"]["file_name_regex"] |
57 folder_regex = "(?P<folderField1>.*)" | 80 folder_regex = "(?P<folderField1>.*)" |
58 elif "folder_name_regex" in methods["con_metadata_source"]: | 81 elif "folder_name_regex" in methods["con_metadata_source"]: |
61 else: | 84 else: |
62 # default regex | 85 # default regex |
63 file_regex = "(?P<field1>.*)_(?P<field2>[a-zA-Z0-9]+)" | 86 file_regex = "(?P<field1>.*)_(?P<field2>[a-zA-Z0-9]+)" |
64 folder_regex = "(?P<folderField1>.*)" | 87 folder_regex = "(?P<folderField1>.*)" |
65 | 88 |
66 _str += FOURSPACES + "Regular expression to extract from file name:%s\n" % file_regex | 89 _str += ( |
67 _str += FOURSPACES + "Regular expression to extract from folder name:%s\n" % folder_regex | 90 FOURSPACES |
68 | 91 + "Regular expression to extract from file name:%s\n" % file_regex |
69 _str += FOURSPACES + "Extract metadata from:%s\n" % methods["con_metadata_extract_from"]["extract_metadata_from"] | 92 ) |
70 | 93 _str += ( |
71 if methods["con_metadata_extract_from"]["extract_metadata_from"] == "Images matching a rule": | 94 FOURSPACES |
95 + "Regular expression to extract from folder name:%s\n" % folder_regex | |
96 ) | |
97 | |
98 _str += ( | |
99 FOURSPACES | |
100 + "Extract metadata from:%s\n" | |
101 % methods["con_metadata_extract_from"]["extract_metadata_from"] | |
102 ) | |
103 | |
104 if ( | |
105 methods["con_metadata_extract_from"]["extract_metadata_from"] | |
106 == "Images matching a rule" | |
107 ): | |
72 rule_str = "" | 108 rule_str = "" |
73 for r in methods["con_metadata_extract_from"]["r_match"]: | 109 for r in methods["con_metadata_extract_from"]["r_match"]: |
74 if r["con_match"]["rule_type"] == "extension": | 110 if r["con_match"]["rule_type"] == "extension": |
75 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " + \ | 111 rule_str += ( |
76 r["con_match"]["match_type"] + ")" | 112 " (" |
113 + r["con_match"]["rule_type"] | |
114 + " " | |
115 + r["con_match"]["operator"] | |
116 + " " | |
117 + r["con_match"]["match_type"] | |
118 + ")" | |
119 ) | |
77 else: | 120 else: |
78 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " +\ | 121 rule_str += ( |
79 r["con_match"]["contain"] + " \"" + r["con_match"]["match_value"] + "\")" | 122 " (" |
80 | 123 + r["con_match"]["rule_type"] |
81 _str += FOURSPACES + "Select the filtering criteria:" + methods["con_metadata_extract_from"]["match_all_any"] + rule_str + "\n" | 124 + " " |
82 else: | 125 + r["con_match"]["operator"] |
83 _str += FOURSPACES + "Select the filtering criteria:and (file does contain \"\")\n" # this line is required even if it's not used | 126 + " " |
127 + r["con_match"]["contain"] | |
128 + ' "' | |
129 + r["con_match"]["match_value"] | |
130 + '")' | |
131 ) | |
132 | |
133 _str += ( | |
134 FOURSPACES | |
135 + "Select the filtering criteria:" | |
136 + methods["con_metadata_extract_from"]["match_all_any"] | |
137 + rule_str | |
138 + "\n" | |
139 ) | |
140 else: | |
141 _str += ( | |
142 FOURSPACES | |
143 + 'Select the filtering criteria:and (file does contain "")\n' | |
144 ) # this line is required even if it's not used | |
84 | 145 |
85 _str += FOURSPACES + "Metadata file location:\n" | 146 _str += FOURSPACES + "Metadata file location:\n" |
86 _str += FOURSPACES + "Match file and image metadata:\x5B\x5D\n" | 147 _str += FOURSPACES + "Match file and image metadata:\x5B\x5D\n" |
87 _str += FOURSPACES + "Use case insensitive matching?:No\n" | 148 _str += FOURSPACES + "Use case insensitive matching?:No\n" |
88 | 149 |
89 return _str | 150 return _str |
90 | 151 |
91 | 152 |
92 def write_nameandtypes(): | 153 def write_nameandtypes(): |
93 nameandtypes = params['nameandtypes'] | 154 nameandtypes = params["nameandtypes"] |
94 assign_a_name = nameandtypes['con_assign_a_name_to']['assign_a_name_to'] | 155 assign_a_name = nameandtypes["con_assign_a_name_to"]["assign_a_name_to"] |
95 | 156 |
96 if "con_select_image_type" in nameandtypes['con_assign_a_name_to']: | 157 if "con_select_image_type" in nameandtypes["con_assign_a_name_to"]: |
97 con_set_intensity = nameandtypes['con_assign_a_name_to']['con_select_image_type']['con_set_intensity'] | 158 con_set_intensity = nameandtypes["con_assign_a_name_to"][ |
98 max_intensity = con_set_intensity['maximum_intensity'] if "maximum_intensity" in con_set_intensity else 255.0 | 159 "con_select_image_type" |
160 ]["con_set_intensity"] | |
161 max_intensity = ( | |
162 con_set_intensity["maximum_intensity"] | |
163 if "maximum_intensity" in con_set_intensity | |
164 else 255.0 | |
165 ) | |
99 else: | 166 else: |
100 max_intensity = 255.0 | 167 max_intensity = 255.0 |
101 | 168 |
102 pixel_space = nameandtypes['pixel_space'] | 169 pixel_space = nameandtypes["pixel_space"] |
103 | 170 |
104 rule_count = len(nameandtypes['con_assign_a_name_to']['r_match_rule']) if "r_match_rule" in nameandtypes['con_assign_a_name_to'] else 1 | 171 rule_count = ( |
105 | 172 len(nameandtypes["con_assign_a_name_to"]["r_match_rule"]) |
106 process_3d = nameandtypes['pixel_space']['process_3d'] | 173 if "r_match_rule" in nameandtypes["con_assign_a_name_to"] |
174 else 1 | |
175 ) | |
176 | |
177 process_3d = nameandtypes["pixel_space"]["process_3d"] | |
107 x_spacing = 1.0 if "x_spacing" not in pixel_space else pixel_space["x_spacing"] | 178 x_spacing = 1.0 if "x_spacing" not in pixel_space else pixel_space["x_spacing"] |
108 y_spacing = 1.0 if "y_spacing" not in pixel_space else pixel_space["y_spacing"] | 179 y_spacing = 1.0 if "y_spacing" not in pixel_space else pixel_space["y_spacing"] |
109 z_spacing = 1.0 if "z_spacing" not in pixel_space else pixel_space["z_spacing"] | 180 z_spacing = 1.0 if "z_spacing" not in pixel_space else pixel_space["z_spacing"] |
110 | 181 |
111 _str = "\nNamesAndTypes:[module_num:3|svn_version:\\'Unknown\\'|variable_revision_number:8|show_window:False|notes:\\x5B\\'The NamesAndTypes module allows you to assign a meaningful name to each image by which other modules will refer to it.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" | 182 _str = "\nNamesAndTypes:[module_num:3|svn_version:\\'Unknown\\'|variable_revision_number:8|show_window:False|notes:\\x5B\\'The NamesAndTypes module allows you to assign a meaningful name to each image by which other modules will refer to it.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" |
112 | 183 |
113 _str += FOURSPACES + "Assign a name to:%s\n" % assign_a_name | 184 _str += FOURSPACES + "Assign a name to:%s\n" % assign_a_name |
114 | 185 |
115 if assign_a_name == "All images": | 186 if assign_a_name == "All images": |
116 _str += FOURSPACES + "Select the image type:%s\n" % nameandtypes['con_assign_a_name_to']['con_select_image_type']['select_image_type'] | 187 _str += ( |
117 _str += FOURSPACES + "Name to assign these images:%s\n" % nameandtypes['con_assign_a_name_to']['name_to_assign'] | 188 FOURSPACES |
189 + "Select the image type:%s\n" | |
190 % nameandtypes["con_assign_a_name_to"]["con_select_image_type"][ | |
191 "select_image_type" | |
192 ] | |
193 ) | |
194 _str += ( | |
195 FOURSPACES | |
196 + "Name to assign these images:%s\n" | |
197 % nameandtypes["con_assign_a_name_to"]["name_to_assign"] | |
198 ) | |
118 _str += FOURSPACES + "Match metadata:[]\n" | 199 _str += FOURSPACES + "Match metadata:[]\n" |
119 | 200 |
120 _str += FOURSPACES + "Image set matching method:Order\n" | 201 _str += FOURSPACES + "Image set matching method:Order\n" |
121 _str += FOURSPACES + "Set intensity range from:%s\n" % con_set_intensity['set_intensity_range_from'] | 202 _str += ( |
203 FOURSPACES | |
204 + "Set intensity range from:%s\n" | |
205 % con_set_intensity["set_intensity_range_from"] | |
206 ) | |
122 _str += FOURSPACES + "Assignments count:%s\n" % rule_count | 207 _str += FOURSPACES + "Assignments count:%s\n" % rule_count |
123 _str += FOURSPACES + "Single images count:0\n" | 208 _str += FOURSPACES + "Single images count:0\n" |
124 _str += FOURSPACES + "Maximum intensity:%.1f\n" % max_intensity | 209 _str += FOURSPACES + "Maximum intensity:%.1f\n" % max_intensity |
125 _str += FOURSPACES + "Process as 3D?:%s\n" % process_3d | 210 _str += FOURSPACES + "Process as 3D?:%s\n" % process_3d |
126 | 211 |
128 # the below lines are not relevant to "images matching rules", but needed in pipeline file | 213 # the below lines are not relevant to "images matching rules", but needed in pipeline file |
129 _str += FOURSPACES + "Select the image type:Grayscale image\n" | 214 _str += FOURSPACES + "Select the image type:Grayscale image\n" |
130 _str += FOURSPACES + "Name to assign these images:DNA\n" | 215 _str += FOURSPACES + "Name to assign these images:DNA\n" |
131 _str += FOURSPACES + "Match metadata:[]\n" | 216 _str += FOURSPACES + "Match metadata:[]\n" |
132 | 217 |
133 _str += FOURSPACES + "Image set matching method:%s\n" % nameandtypes['con_assign_a_name_to']['matching_method'] | 218 _str += ( |
219 FOURSPACES | |
220 + "Image set matching method:%s\n" | |
221 % nameandtypes["con_assign_a_name_to"]["matching_method"] | |
222 ) | |
134 _str += FOURSPACES + "Set intensity range from:Image metadata\n" | 223 _str += FOURSPACES + "Set intensity range from:Image metadata\n" |
135 _str += FOURSPACES + "Assignments count:%d\n" % rule_count | 224 _str += FOURSPACES + "Assignments count:%d\n" % rule_count |
136 _str += FOURSPACES + "Single images count:0\n" | 225 _str += FOURSPACES + "Single images count:0\n" |
137 _str += FOURSPACES + "Maximum intensity:%.1f\n" % max_intensity | 226 _str += FOURSPACES + "Maximum intensity:%.1f\n" % max_intensity |
138 _str += FOURSPACES + "Process as 3D?:%s\n" % process_3d | 227 _str += FOURSPACES + "Process as 3D?:%s\n" % process_3d |
145 for rule in nameandtypes["con_assign_a_name_to"]["r_match_rule"]: | 234 for rule in nameandtypes["con_assign_a_name_to"]["r_match_rule"]: |
146 | 235 |
147 rule_str = "" | 236 rule_str = "" |
148 if len(rule["r_match"]) > 0: | 237 if len(rule["r_match"]) > 0: |
149 for r in rule["r_match"]: | 238 for r in rule["r_match"]: |
150 if r["con_match"]["rule_type"] == "file" or r["con_match"]["rule_type"] == "directory": | 239 if ( |
151 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " + \ | 240 r["con_match"]["rule_type"] == "file" |
152 r["con_match"]["contain"] + " \"" + r["con_match"]["match_value"] + "\")" | 241 or r["con_match"]["rule_type"] == "directory" |
242 ): | |
243 rule_str += ( | |
244 " (" | |
245 + r["con_match"]["rule_type"] | |
246 + " " | |
247 + r["con_match"]["operator"] | |
248 + " " | |
249 + r["con_match"]["contain"] | |
250 + ' "' | |
251 + r["con_match"]["match_value"] | |
252 + '")' | |
253 ) | |
153 else: | 254 else: |
154 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " + \ | 255 rule_str += ( |
155 r["con_match"]["match_type"] + ")" | 256 " (" |
156 else: | 257 + r["con_match"]["rule_type"] |
157 rule_str = " (file does contain \"\")" # need to have a value even if it is not used | 258 + " " |
158 | 259 + r["con_match"]["operator"] |
159 _str += FOURSPACES + "Select the rule criteria:" + rule["match_all_any"] + rule_str + "\n" | 260 + " " |
261 + r["con_match"]["match_type"] | |
262 + ")" | |
263 ) | |
264 else: | |
265 rule_str = ' (file does contain "")' # need to have a value even if it is not used | |
266 | |
267 _str += ( | |
268 FOURSPACES | |
269 + "Select the rule criteria:" | |
270 + rule["match_all_any"] | |
271 + rule_str | |
272 + "\n" | |
273 ) | |
160 | 274 |
161 img_or_obj = rule["con_select_image_type"]["select_image_type"] | 275 img_or_obj = rule["con_select_image_type"]["select_image_type"] |
162 | 276 |
163 if img_or_obj == "Objects": | 277 if img_or_obj == "Objects": |
164 _str += FOURSPACES + "Name to assign these images:DNA\n" | 278 _str += FOURSPACES + "Name to assign these images:DNA\n" |
165 _str += FOURSPACES + "Name to assign these objects:%s\n" % rule["con_select_image_type"]["name_to_assign"] | 279 _str += ( |
166 else: | 280 FOURSPACES |
167 _str += FOURSPACES + "Name to assign these images:%s\n" % rule["con_select_image_type"]["name_to_assign"] | 281 + "Name to assign these objects:%s\n" |
282 % rule["con_select_image_type"]["name_to_assign"] | |
283 ) | |
284 else: | |
285 _str += ( | |
286 FOURSPACES | |
287 + "Name to assign these images:%s\n" | |
288 % rule["con_select_image_type"]["name_to_assign"] | |
289 ) | |
168 _str += FOURSPACES + "Name to assign these objects:Cell\n" | 290 _str += FOURSPACES + "Name to assign these objects:Cell\n" |
169 | 291 |
170 _str += FOURSPACES + "Select the image type:%s\n" % img_or_obj | 292 _str += FOURSPACES + "Select the image type:%s\n" % img_or_obj |
171 | 293 |
172 intensity_range = "Image metadata" # default value | 294 intensity_range = "Image metadata" # default value |
173 if img_or_obj == "Grayscale image" or img_or_obj == "Color image": | 295 if img_or_obj == "Grayscale image" or img_or_obj == "Color image": |
174 intensity_range = rule["con_select_image_type"]["con_set_intensity"]["set_intensity_range_from"] | 296 intensity_range = rule["con_select_image_type"]["con_set_intensity"][ |
297 "set_intensity_range_from" | |
298 ] | |
175 | 299 |
176 _str += FOURSPACES + "Set intensity range from:%s\n" % intensity_range | 300 _str += FOURSPACES + "Set intensity range from:%s\n" % intensity_range |
177 | 301 |
178 if intensity_range == "Manual": | 302 if intensity_range == "Manual": |
179 _str += FOURSPACES + "Maximum intensity:%s\n" % rule["con_select_image_type"]["con_set_intensity"]["maximum_intensity"] | 303 _str += ( |
304 FOURSPACES | |
305 + "Maximum intensity:%s\n" | |
306 % rule["con_select_image_type"]["con_set_intensity"][ | |
307 "maximum_intensity" | |
308 ] | |
309 ) | |
180 else: | 310 else: |
181 _str += FOURSPACES + "Maximum intensity:255.0\n" | 311 _str += FOURSPACES + "Maximum intensity:255.0\n" |
182 | 312 |
183 return _str | 313 return _str |
184 | 314 |
185 | 315 |
186 def write_groups(): | 316 def write_groups(): |
187 groups = params['groups'] | 317 groups = params["groups"] |
188 | 318 |
189 _str = "\nGroups:[module_num:4|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|notes:\\x5B\\\'The Groups module optionally allows you to split your list of images into image subsets (groups) which will be processed independently of each other. Examples of groupings include screening batches, microtiter plates, time-lapse movies, etc.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" | 319 _str = "\nGroups:[module_num:4|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|notes:\\x5B\\'The Groups module optionally allows you to split your list of images into image subsets (groups) which will be processed independently of each other. Examples of groupings include screening batches, microtiter plates, time-lapse movies, etc.\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" |
190 | 320 |
191 group_images = groups["con_groups"]["group_images"] | 321 group_images = groups["con_groups"]["group_images"] |
192 | 322 |
193 _str += FOURSPACES + "Do you want to group your images?:%s\n" % group_images | 323 _str += FOURSPACES + "Do you want to group your images?:%s\n" % group_images |
194 _str += FOURSPACES + "grouping metadata count:1\n" | 324 _str += FOURSPACES + "grouping metadata count:1\n" |
195 | 325 |
196 if group_images == "Yes": | 326 if group_images == "Yes": |
197 _str += FOURSPACES + "Metadata category:%s\n" % groups["con_groups"]["group_category"] | 327 _str += ( |
328 FOURSPACES | |
329 + "Metadata category:%s\n" % groups["con_groups"]["group_category"] | |
330 ) | |
198 else: | 331 else: |
199 _str += FOURSPACES + "Metadata category:None\n" | 332 _str += FOURSPACES + "Metadata category:None\n" |
200 | 333 |
201 return _str | 334 return _str |
202 | 335 |
203 | 336 |
204 with open("output.cppipe", "w") as f: | 337 with open("output.cppipe", "w") as f: |
205 headers = ["CellProfiler Pipeline: http://www.cellprofiler.org\n", | 338 headers = [ |
206 "Version:3\n", | 339 "CellProfiler Pipeline: http://www.cellprofiler.org\n", |
207 "DateRevision:319\n", | 340 "Version:3\n", |
208 "GitHash:\n", | 341 "DateRevision:319\n", |
209 "ModuleCount:4\n", | 342 "GitHash:\n", |
210 "HasImagePlaneDetails:False", | 343 "ModuleCount:4\n", |
211 "\n"] | 344 "HasImagePlaneDetails:False", |
345 "\n", | |
346 ] | |
212 | 347 |
213 f.writelines(headers) | 348 f.writelines(headers) |
214 | 349 |
215 img_str = write_images() | 350 img_str = write_images() |
216 metadata_str = write_metadata() | 351 metadata_str = write_metadata() |