comparison measure_granularity.xml @ 0:1062c9e44147 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 6d73056a625002d0275b5a9a90a9fae329ce47f1"
author bgruening
date Thu, 26 Mar 2020 17:42:07 -0400
parents
children 88dd3674c4d0
comparison
equal deleted inserted replaced
-1:000000000000 0:1062c9e44147
1 <tool id="cp_measure_granularity" name="MeasureGranularity" version="@CP_VERSION@">
2 <description>outputs spectra of size measurements of the textures in the image</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 writemg():
26 _str = "\nMeasureGranularity:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:3|show_window:False|notes:\\x5B\\'PARAMS\\x3A\\', \\'- Radius\\', \'- Range\\'\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count
27
28 image_count = len(params['rpt_image'])
29
30 _str += FOURSPACES + "Image count:%d\n" % image_count
31
32 for img in params['rpt_image']:
33 obj_count = len(img['rpt_object'])
34
35 _str += FOURSPACES + "Object count:%d\n" % obj_count
36
37 _str += FOURSPACES + "Select an image to measure:%s\n" % img['image_to_measure']
38
39 _str += FOURSPACES + "Subsampling factor for granularity measurements:%s\n" % img['subsampling_factor_granularity']
40
41 _str += FOURSPACES + "Subsampling factor for background reduction:%.2f\n" % img['subsampling_factor_background_reduction']
42
43 _str += FOURSPACES + "Radius of structuring element:%d\n" % img['radius']
44 _str += FOURSPACES + "Range of the granular spectrum:%d\n" % img['range_granular_spectrum']
45
46 for obj in img['rpt_object']:
47 _str += FOURSPACES + "Select objects to meausre:%s\n" % obj['object_to_measure']
48
49 return _str
50
51 with open(input_pipeline) as fin:
52 lines = fin.readlines()
53
54 k, v = lines[4].strip().split(':')
55
56 module_count = int(v)
57 new_count = module_count + 1
58 lines[4] = k + ":%d\n" % new_count
59 with open("output", "w") as f:
60 f.writelines(lines)
61 f.write(writemg())
62
63 f.close()
64 </configfile>
65 </configfiles>
66
67 <inputs>
68 <expand macro="input_pipeline_macro" />
69 <repeat name="rpt_image" title="Add another image">
70 <param name="image_to_measure" type="text" label="Select an image to measure">
71 <expand macro="text_validator" />
72 </param>
73
74 <param name="subsampling_factor_granularity" type="float" value="0.25" label="Subsampling factor for granularity measurements" />
75
76 <param name="subsampling_factor_background_reduction" type="float" value="0.25" min="0.125" max="0.25" label="Subsampling factor for background reduction" />
77
78 <param name="radius" type="integer" value="10" label="Radius of structuring element" />
79
80 <param name="range_granular_spectrum" type="integer" value="16" label="Range of the granular spectrum" />
81
82 <repeat name="rpt_object" title="Add another object">
83 <param name="object_to_measure" type="text" label="Select object to measure" >
84 <expand macro="text_validator" />
85 </param>
86 </repeat>
87 </repeat>
88 </inputs>
89
90 <outputs>
91 <expand macro="output_pipeline_macro" />
92 </outputs>
93
94 <tests>
95 <test>
96 <expand macro="test_input_pipeline_param" />
97 <repeat name="rpt_image">
98 <param name="image_to_measure" value="DNA" />
99 <param name="subsampling_factor_granularity" value="0.25" />
100 <param name="subsampling_factor_background_reduction" value="0.25" />
101 <param name="radius" value="10" />
102 <param name="range_granular_spectrum" value="16" />
103 </repeat>
104 <expand macro="test_out_file" file="measure_granularity.txt" />
105 </test>
106 </tests>
107
108 <expand macro="help" module="MeasureGranularity" />
109 <expand macro="citations" />
110 </tool>