Mercurial > repos > bgruening > cp_cellprofiler
annotate starting_modules.py @ 5:e917a2424690 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
author | bgruening |
---|---|
date | Sat, 06 Feb 2021 09:58:14 +0000 |
parents | a98608f3abc5 |
children | 0e4dccaafef5 |
rev | line source |
---|---|
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
1 import json |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
2 import sys |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
3 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
4 FOURSPACES = " " |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
5 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
6 input_json_path = sys.argv[1] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
7 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
8 params = json.load(open(input_json_path, "r")) |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
9 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
10 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
11 def write_images(): |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
12 filter_images = params['images']['filter_images'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
13 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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" |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
15 _str += FOURSPACES + ":\n" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
16 _str += FOURSPACES + "Filter images?:%s\n" % filter_images |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
17 _str += FOURSPACES + "Select the rule criteria:and (extension does isimage) (directory doesnot startwith \".\")\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
18 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
19 return _str |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
20 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
21 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
22 def write_metadata(): |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
23 metadata_extraction = params['metadata']['con_metadata_extraction'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
24 extract = metadata_extraction['extract'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
25 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
26 if 'extraction_method' in metadata_extraction: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
27 method_count = len(metadata_extraction['extraction_method']) |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
28 else: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
29 method_count = 1 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
30 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
32 _str += FOURSPACES + "Extract metadata?:%s\n" % extract |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
33 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
34 if extract == "No": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
35 _str += FOURSPACES + "Metadata data type:Text\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
36 _str += FOURSPACES + "Metadata types:{}\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
37 _str += FOURSPACES + "Extraction method count:%d\n" % method_count |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
38 _str += FOURSPACES + "Metadata extraction method:Extract from file/folder names\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
41 _str += FOURSPACES + "Extract metadata from:All images\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
42 _str += FOURSPACES + "Select the filtering criteria:and (file does contain \"\")\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
43 _str += FOURSPACES + "Metadata file location:\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
44 _str += FOURSPACES + "Match file and image metadata:\x5B\x5D\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
45 _str += FOURSPACES + "Use case insensitive matching?:No\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
46 else: |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
47 _str += FOURSPACES + "Metadata data type:Text\n" # default Text,not possible to select in Galaxy |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
48 _str += FOURSPACES + "Metadata types:{}\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
49 _str += FOURSPACES + "Extraction method count:%d\n" % method_count |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
50 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
51 for methods in metadata_extraction["extraction_method"]: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
52 _str += FOURSPACES + "Metadata extraction method:%s\n" % methods["metadata_extraction_method"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
53 _str += FOURSPACES + "Metadata source:%s\n" % methods["con_metadata_source"]["metadata_source"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
54 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
55 if "file_name_regex" in methods["con_metadata_source"]: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
56 file_regex = methods["con_metadata_source"]["file_name_regex"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
57 folder_regex = "(?P<folderField1>.*)" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
58 elif "folder_name_regex" in methods["con_metadata_source"]: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
59 file_regex = "(?P<field1>.*)_(?P<field2>[a-zA-Z0-9]+)" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
60 folder_regex = methods["con_metadata_source"]["folder_name_regex"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
61 else: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
62 # default regex |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
63 file_regex = "(?P<field1>.*)_(?P<field2>[a-zA-Z0-9]+)" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
64 folder_regex = "(?P<folderField1>.*)" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
65 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
66 _str += FOURSPACES + "Regular expression to extract from file name:%s\n" % file_regex |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
67 _str += FOURSPACES + "Regular expression to extract from folder name:%s\n" % folder_regex |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
68 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
69 _str += FOURSPACES + "Extract metadata from:%s\n" % methods["con_metadata_extract_from"]["extract_metadata_from"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
70 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
71 if methods["con_metadata_extract_from"]["extract_metadata_from"] == "Images matching a rule": |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
72 rule_str = "" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
73 for r in methods["con_metadata_extract_from"]["r_match"]: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
74 if r["con_match"]["rule_type"] == "extension": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
75 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " + \ |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
76 r["con_match"]["match_type"] + ")" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
77 else: |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
78 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " +\ |
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
79 r["con_match"]["contain"] + " \"" + r["con_match"]["match_value"] + "\")" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
80 |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
81 _str += FOURSPACES + "Select the filtering criteria:" + methods["con_metadata_extract_from"]["match_all_any"] + rule_str + "\n" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
82 else: |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
83 _str += FOURSPACES + "Select the filtering criteria:and (file does contain \"\")\n" # this line is required even if it's not used |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
84 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
85 _str += FOURSPACES + "Metadata file location:\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
86 _str += FOURSPACES + "Match file and image metadata:\x5B\x5D\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
87 _str += FOURSPACES + "Use case insensitive matching?:No\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
88 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
89 return _str |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
90 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
91 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
92 def write_nameandtypes(): |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
93 nameandtypes = params['nameandtypes'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
94 assign_a_name = nameandtypes['con_assign_a_name_to']['assign_a_name_to'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
95 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
96 if "con_select_image_type" in nameandtypes['con_assign_a_name_to']: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
97 con_set_intensity = nameandtypes['con_assign_a_name_to']['con_select_image_type']['con_set_intensity'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
98 max_intensity = con_set_intensity['maximum_intensity'] if "maximum_intensity" in con_set_intensity else 255.0 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
99 else: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
100 max_intensity = 255.0 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
101 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
102 pixel_space = nameandtypes['pixel_space'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
103 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
105 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
106 process_3d = nameandtypes['pixel_space']['process_3d'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
107 x_spacing = 1.0 if "x_spacing" not in pixel_space else pixel_space["x_spacing"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
108 y_spacing = 1.0 if "y_spacing" not in pixel_space else pixel_space["y_spacing"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
109 z_spacing = 1.0 if "z_spacing" not in pixel_space else pixel_space["z_spacing"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
110 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
112 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
113 _str += FOURSPACES + "Assign a name to:%s\n" % assign_a_name |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
114 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
115 if assign_a_name == "All images": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
116 _str += FOURSPACES + "Select the image type:%s\n" % nameandtypes['con_assign_a_name_to']['con_select_image_type']['select_image_type'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
117 _str += FOURSPACES + "Name to assign these images:%s\n" % nameandtypes['con_assign_a_name_to']['name_to_assign'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
118 _str += FOURSPACES + "Match metadata:[]\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
119 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
120 _str += FOURSPACES + "Image set matching method:Order\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
121 _str += FOURSPACES + "Set intensity range from:%s\n" % con_set_intensity['set_intensity_range_from'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
122 _str += FOURSPACES + "Assignments count:%s\n" % rule_count |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
123 _str += FOURSPACES + "Single images count:0\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
124 _str += FOURSPACES + "Maximum intensity:%.1f\n" % max_intensity |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
125 _str += FOURSPACES + "Process as 3D?:%s\n" % process_3d |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
126 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
127 else: |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
128 # the below lines are not relevant to "images matching rules", but needed in pipeline file |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
129 _str += FOURSPACES + "Select the image type:Grayscale image\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
130 _str += FOURSPACES + "Name to assign these images:DNA\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
131 _str += FOURSPACES + "Match metadata:[]\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
132 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
133 _str += FOURSPACES + "Image set matching method:%s\n" % nameandtypes['con_assign_a_name_to']['matching_method'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
134 _str += FOURSPACES + "Set intensity range from:Image metadata\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
135 _str += FOURSPACES + "Assignments count:%d\n" % rule_count |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
136 _str += FOURSPACES + "Single images count:0\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
137 _str += FOURSPACES + "Maximum intensity:%.1f\n" % max_intensity |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
138 _str += FOURSPACES + "Process as 3D?:%s\n" % process_3d |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
139 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
140 _str += FOURSPACES + "Relative pixel spacing in X:%.1f\n" % x_spacing |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
141 _str += FOURSPACES + "Relative pixel spacing in Y:%.1f\n" % y_spacing |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
142 _str += FOURSPACES + "Relative pixel spacing in Z:%.1f\n" % z_spacing |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
143 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
144 if assign_a_name == "Images matching rules": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
145 for rule in nameandtypes["con_assign_a_name_to"]["r_match_rule"]: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
146 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
147 rule_str = "" |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
148 if len(rule["r_match"]) > 0: |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
149 for r in rule["r_match"]: |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
150 if r["con_match"]["rule_type"] == "file" or r["con_match"]["rule_type"] == "directory": |
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
151 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " + \ |
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
152 r["con_match"]["contain"] + " \"" + r["con_match"]["match_value"] + "\")" |
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
153 else: |
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
154 rule_str += " (" + r["con_match"]["rule_type"] + " " + r["con_match"]["operator"] + " " + \ |
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
155 r["con_match"]["match_type"] + ")" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
156 else: |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
157 rule_str = " (file does contain \"\")" # need to have a value even if it is not used |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
158 |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
159 _str += FOURSPACES + "Select the rule criteria:" + rule["match_all_any"] + rule_str + "\n" |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
160 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
161 img_or_obj = rule["con_select_image_type"]["select_image_type"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
162 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
163 if img_or_obj == "Objects": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
164 _str += FOURSPACES + "Name to assign these images:DNA\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
165 _str += FOURSPACES + "Name to assign these objects:%s\n" % rule["con_select_image_type"]["name_to_assign"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
166 else: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
167 _str += FOURSPACES + "Name to assign these images:%s\n" % rule["con_select_image_type"]["name_to_assign"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
168 _str += FOURSPACES + "Name to assign these objects:Cell\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
169 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
170 _str += FOURSPACES + "Select the image type:%s\n" % img_or_obj |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
171 |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
172 intensity_range = "Image metadata" # default value |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
173 if img_or_obj == "Grayscale image" or img_or_obj == "Color image": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
174 intensity_range = rule["con_select_image_type"]["con_set_intensity"]["set_intensity_range_from"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
175 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
176 _str += FOURSPACES + "Set intensity range from:%s\n" % intensity_range |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
177 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
178 if intensity_range == "Manual": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
179 _str += FOURSPACES + "Maximum intensity:%s\n" % rule["con_select_image_type"]["con_set_intensity"]["maximum_intensity"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
180 else: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
181 _str += FOURSPACES + "Maximum intensity:255.0\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
182 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
183 return _str |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
184 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
185 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
186 def write_groups(): |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
187 groups = params['groups'] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
188 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
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" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
190 |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
191 group_images = groups["con_groups"]["group_images"] |
3
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
192 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
193 _str += FOURSPACES + "Do you want to group your images?:%s\n" % group_images |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
194 _str += FOURSPACES + "grouping metadata count:1\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
195 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
196 if group_images == "Yes": |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
197 _str += FOURSPACES + "Metadata category:%s\n" % groups["con_groups"]["group_category"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
198 else: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
199 _str += FOURSPACES + "Metadata category:None\n" |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
200 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
201 return _str |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
202 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
203 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
204 with open("output.cppipe", "w") as f: |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
205 headers = ["CellProfiler Pipeline: http://www.cellprofiler.org\n", |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
206 "Version:3\n", |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
207 "DateRevision:319\n", |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
208 "GitHash:\n", |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
209 "ModuleCount:4\n", |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
210 "HasImagePlaneDetails:False", |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
211 "\n"] |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
212 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
213 f.writelines(headers) |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
214 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
215 img_str = write_images() |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
216 metadata_str = write_metadata() |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
217 nameandtypes_str = write_nameandtypes() |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
218 groups_str = write_groups() |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
219 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
220 output_str = img_str + metadata_str + nameandtypes_str + groups_str |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
221 |
a98608f3abc5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
222 f.write(output_str) |
5
e917a2424690
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
223 f.close() |