Mercurial > repos > bgruening > cp_export_to_spreadsheet
annotate starting_modules.py @ 5:d0178bdcd00e draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 7d7a519c3a2cc612d38695b335d0f6c75a099de3"
author | bgruening |
---|---|
date | Fri, 26 Feb 2021 14:12:26 +0000 |
parents | f8fa0f6718a3 |
children | f24c370e5ea4 |
rev | line source |
---|---|
3
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
1 import json |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
2 import sys |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
3 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
4 FOURSPACES = " " |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
5 |
72a7f23f3a79
"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] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
7 |
72a7f23f3a79
"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")) |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
9 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
10 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
11 def write_images(): |
72a7f23f3a79
"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'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
13 |
5
d0178bdcd00e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 7d7a519c3a2cc612d38695b335d0f6c75a099de3"
bgruening
parents:
4
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" |
4
f8fa0f6718a3
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
15 _str += FOURSPACES + ":\n" |
3
72a7f23f3a79
"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 |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
18 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
19 return _str |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
20 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
21 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
22 def write_metadata(): |
72a7f23f3a79
"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'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
24 extract = metadata_extraction['extract'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
25 |
72a7f23f3a79
"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: |
72a7f23f3a79
"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']) |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
28 else: |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
29 method_count = 1 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
30 |
5
d0178bdcd00e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 7d7a519c3a2cc612d38695b335d0f6c75a099de3"
bgruening
parents:
4
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" |
3
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
33 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
34 if extract == "No": |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
36 _str += FOURSPACES + "Metadata types:{}\n" |
72a7f23f3a79
"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 |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
46 else: |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
48 _str += FOURSPACES + "Metadata types:{}\n" |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
50 |
72a7f23f3a79
"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"]: |
72a7f23f3a79
"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"] |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
54 |
72a7f23f3a79
"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"]: |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
57 folder_regex = "(?P<folderField1>.*)" |
72a7f23f3a79
"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"]: |
72a7f23f3a79
"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]+)" |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
61 else: |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
62 # default regex |
72a7f23f3a79
"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]+)" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
64 folder_regex = "(?P<folderField1>.*)" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
65 |
72a7f23f3a79
"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 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
68 |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
70 |
72a7f23f3a79
"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": |
4
f8fa0f6718a3
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
72 rule_str = "" |
3
72a7f23f3a79
"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"]: |
72a7f23f3a79
"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": |
72a7f23f3a79
"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"] + " " + \ |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
77 else: |
4
f8fa0f6718a3
"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"] + " " +\ |
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
80 |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
82 else: |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
84 |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
88 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
89 return _str |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
90 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
91 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
92 def write_nameandtypes(): |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
93 nameandtypes = params['nameandtypes'] |
72a7f23f3a79
"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'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
95 |
72a7f23f3a79
"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']: |
72a7f23f3a79
"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'] |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
99 else: |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
100 max_intensity = 255.0 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
101 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
102 pixel_space = nameandtypes['pixel_space'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
103 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
105 |
72a7f23f3a79
"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'] |
72a7f23f3a79
"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"] |
72a7f23f3a79
"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"] |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
110 |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
112 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
114 |
72a7f23f3a79
"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": |
72a7f23f3a79
"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'] |
72a7f23f3a79
"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'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
118 _str += FOURSPACES + "Match metadata:[]\n" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
119 |
72a7f23f3a79
"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" |
72a7f23f3a79
"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'] |
72a7f23f3a79
"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 |
72a7f23f3a79
"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" |
72a7f23f3a79
"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 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
126 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
127 else: |
4
f8fa0f6718a3
"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
72a7f23f3a79
"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" |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
131 _str += FOURSPACES + "Match metadata:[]\n" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
132 |
72a7f23f3a79
"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'] |
72a7f23f3a79
"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" |
72a7f23f3a79
"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 |
72a7f23f3a79
"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" |
72a7f23f3a79
"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 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
139 |
72a7f23f3a79
"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 |
72a7f23f3a79
"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 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
143 |
72a7f23f3a79
"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": |
72a7f23f3a79
"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"]: |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
146 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
147 rule_str = "" |
4
f8fa0f6718a3
"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
72a7f23f3a79
"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"]: |
4
f8fa0f6718a3
"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": |
f8fa0f6718a3
"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"] + " " + \ |
f8fa0f6718a3
"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"] + "\")" |
f8fa0f6718a3
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
153 else: |
f8fa0f6718a3
"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"] + " " + \ |
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
156 else: |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
158 |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
160 |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
162 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
163 if img_or_obj == "Objects": |
72a7f23f3a79
"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" |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
166 else: |
72a7f23f3a79
"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"] |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
169 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
171 |
4
f8fa0f6718a3
"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
72a7f23f3a79
"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": |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
175 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
177 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
178 if intensity_range == "Manual": |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
180 else: |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
182 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
183 return _str |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
184 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
185 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
186 def write_groups(): |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
187 groups = params['groups'] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
188 |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
190 |
4
f8fa0f6718a3
"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
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
192 |
72a7f23f3a79
"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 |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
195 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
196 if group_images == "Yes": |
72a7f23f3a79
"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"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
198 else: |
72a7f23f3a79
"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" |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
200 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
201 return _str |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
202 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
203 |
72a7f23f3a79
"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: |
72a7f23f3a79
"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", |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
206 "Version:3\n", |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
207 "DateRevision:319\n", |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
208 "GitHash:\n", |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
209 "ModuleCount:4\n", |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
210 "HasImagePlaneDetails:False", |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
211 "\n"] |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
212 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
213 f.writelines(headers) |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
214 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
215 img_str = write_images() |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
216 metadata_str = write_metadata() |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
217 nameandtypes_str = write_nameandtypes() |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
218 groups_str = write_groups() |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
219 |
72a7f23f3a79
"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 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
221 |
72a7f23f3a79
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit c3917e27eb1c1deeb381aa0dc8161c07699562fb"
bgruening
parents:
diff
changeset
|
222 f.write(output_str) |
4
f8fa0f6718a3
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 35da2dcd86747c9bff138e100dbe08c6106f3780"
bgruening
parents:
3
diff
changeset
|
223 f.close() |