comparison measure_image_intensity.xml @ 0:e87d1fd2d673 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 6d73056a625002d0275b5a9a90a9fae329ce47f1"
author bgruening
date Thu, 26 Mar 2020 17:43:18 -0400
parents
children 20525bc7f6f4
comparison
equal deleted inserted replaced
-1:000000000000 0:e87d1fd2d673
1 <tool id="cp_measure_image_intensity" name="MeasureImageIntensity" version="@CP_VERSION@">
2 <description>measures several intensity features across an entire image (excluding masked pixels)</description>
3
4 <macros>
5 <import>macros.xml</import>
6 </macros>
7
8 <expand macro="py_requirements"/>
9 <expand macro="cmd_modules" />
10
11 <configfiles>
12 <inputs name="inputs" />
13 <configfile name="script_file">
14 import json
15 import sys
16 import os
17
18 FOURSPACES=@SPACES@
19
20 input_json_path = sys.argv[1]
21 input_pipeline= sys.argv[2]
22
23 params = json.load(open(input_json_path, "r"))
24
25 def writemii():
26 _str = "\nMeasureImageIntensity:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:2|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count
27
28 for intensity in params['rpt_intensity']:
29 obj_flag = intensity['con_intensity']['only_from_objects']
30
31 _str += FOURSPACES + "Select the image to measure:%s\n" % intensity['image_to_measure']
32 _str += FOURSPACES + "Measure the intensity only from areas enclosed by objects?:%s\n" % obj_flag
33
34 if obj_flag == "No":
35 _str += FOURSPACES + "Select the input objects:None\n"
36 else:
37 _str += FOURSPACES + "Select the input objects:%s\n" % intensity['con_intensity']['input_objects']
38
39 return _str
40
41 with open(input_pipeline) as fin:
42 lines = fin.readlines()
43
44 k, v = lines[4].strip().split(':')
45
46 module_count = int(v)
47 new_count = module_count + 1
48 lines[4] = k + ":%d\n" % new_count
49 with open("output", "w") as f:
50 f.writelines(lines)
51 f.write(writemii())
52
53 f.close()
54 </configfile>
55 </configfiles>
56
57 <inputs>
58
59 <expand macro="input_pipeline_macro" />
60 <repeat name="rpt_intensity" title="Add another image">
61 <param name="image_to_measure" label="Select image to measure" type="text" >
62 <expand macro="text_validator" />
63 </param>
64 <conditional name="con_intensity">
65 <param name="only_from_objects" label="Measure the intensity only from areas enclosed by objects?" display="radio" type="select">
66 <option value="Yes">Yes</option>
67 <option value="No">No</option>
68 </param>
69 <when value="Yes">
70 <param name="input_objects" label="Select the input objects" type="text">
71 <expand macro="text_validator" />
72 </param>
73 </when>
74 <when value="No" />
75 </conditional>
76 </repeat>
77 </inputs>
78
79 <outputs>
80 <expand macro="output_pipeline_macro" />
81 </outputs>
82
83 <tests>
84 <test>
85 <expand macro="test_input_pipeline_param" />
86 <repeat name="rpt_intensity">
87 <param name="image_to_measure" value="DNA" />
88 <conditional name="con_intensity">
89 <param name="only_from_objects" value="No" />
90 </conditional>
91 </repeat>
92 <repeat name="rpt_intensity">
93 <param name="image_to_measure" value="DNA" />
94 <conditional name="con_intensity">
95 <param name="only_from_objects" value="Yes" />
96 <param name="input_objects" value="Nuclei" />
97 </conditional>
98 </repeat>
99 <expand macro="test_out_file" file="measure_image_intensity.txt" />
100 </test>
101 </tests>
102 <expand macro="help" module="MeasureImageIntensity" />
103 <expand macro="citations" />
104 </tool>