Mercurial > repos > bgruening > cp_relate_objects
comparison relate_objects.xml @ 0:3a2cfcd7c38a draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 6d73056a625002d0275b5a9a90a9fae329ce47f1"
author | bgruening |
---|---|
date | Thu, 26 Mar 2020 17:44:27 -0400 |
parents | |
children | b6f13e783ac5 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3a2cfcd7c38a |
---|---|
1 <tool id="cp_relate_objects" name="RelateObjects" version="@CP_VERSION@"> | |
2 <description>assigns relationships parent-children between objects</description> | |
3 <macros> | |
4 <import>macros.xml</import> | |
5 <xml name="distToOtherParents"> | |
6 <conditional name="con_other_parent_dist"> | |
7 <param name="calc_dist_to_others" label="Calculate distances to other parents?" display="radio" type="select"> | |
8 <option value="Yes">Yes</option> | |
9 <option value="No">No</option> | |
10 </param> | |
11 <when value="Yes"> | |
12 <repeat name="rpt_parent_name" title="Parent Name"> | |
13 <param name="other_parent_name" type="text" label="Parent name"> | |
14 <expand macro="text_validator" /> | |
15 </param> | |
16 </repeat> | |
17 </when> | |
18 <when value="No" /> | |
19 </conditional> | |
20 </xml> | |
21 </macros> | |
22 | |
23 <expand macro="py_requirements"/> | |
24 <expand macro="cmd_modules" /> | |
25 | |
26 <configfiles> | |
27 <inputs name="inputs" /> | |
28 <configfile name="script_file"> | |
29 import json | |
30 import sys | |
31 import os | |
32 | |
33 FOURSPACES=@SPACES@ | |
34 | |
35 input_json_path = sys.argv[1] | |
36 input_pipeline= sys.argv[2] | |
37 | |
38 params = json.load(open(input_json_path, "r")) | |
39 | |
40 def writero(): | |
41 _str = "\nRelateObjects:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:5|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count | |
42 | |
43 _str += FOURSPACES + "Parent objects:%s\n" % params['parent_objects'] | |
44 | |
45 _str += FOURSPACES + "Child objects:%s\n" % params['child_objects'] | |
46 _str += FOURSPACES + "Calculate child-parent distances?:%s\n" % params['con_dist']['calc_dist'] | |
47 _str += FOURSPACES + "Calculate per-parent means for all child measurements?:%s\n" % params['means_for_all'] | |
48 | |
49 dist_others = params['con_dist']['con_other_parent_dist']['calc_dist_to_others'] | |
50 | |
51 _str += FOURSPACES + "Calculate distances to other parents?:%s\n" % dist_others | |
52 | |
53 name_flag = params['con_save_child']['save_child_as_new'] | |
54 _str += FOURSPACES + "Do you want to save the children with parents as a new object set?:%s\n" % name_flag | |
55 | |
56 if name_flag == "Yes": | |
57 _str += FOURSPACES + "Name the output object:%s\n" % params['con_save_child']['name_output'] | |
58 else: | |
59 _str += FOURSPACES + "Name the output object:None\n" | |
60 | |
61 if dist_others == "Yes": | |
62 for pname in params['con_dist']['con_other_parent_dist']['rpt_parent_name']: | |
63 _str += FOURSPACES + "Parent name:%s\n" % pname['other_parent_name'] | |
64 | |
65 return _str | |
66 | |
67 with open(input_pipeline) as fin: | |
68 lines = fin.readlines() | |
69 | |
70 k, v = lines[4].strip().split(':') | |
71 | |
72 module_count = int(v) | |
73 new_count = module_count + 1 | |
74 lines[4] = k + ":%d\n" % new_count | |
75 with open("output", "w") as f: | |
76 f.writelines(lines) | |
77 f.write(writero()) | |
78 | |
79 f.close() | |
80 </configfile> | |
81 </configfiles> | |
82 | |
83 <inputs> | |
84 <expand macro="input_pipeline_macro"/> | |
85 <param name="parent_objects" label="Parent objects" type="text"> | |
86 <expand macro="text_validator" /> | |
87 </param> | |
88 <param name="child_objects" label="Child objects" type="text" > | |
89 <expand macro="text_validator" /> | |
90 </param> | |
91 <param name="means_for_all" label="Calculate per-parent means for all child measurements?:" display="radio" type="select"> | |
92 <option value="Yes">Yes</option> | |
93 <option value="No">No</option> | |
94 </param> | |
95 <conditional name="con_dist"> | |
96 <param name="calc_dist" label="Calculate child-parent distances?" type="select"> | |
97 <option value="None">None</option> | |
98 <option value="Centroid">Centroid</option> | |
99 <option value="Minimum">Minimum</option> | |
100 <option value="Both">Both</option> | |
101 </param> | |
102 <when value="Centroid"> | |
103 <expand macro="distToOtherParents" /> | |
104 </when> | |
105 <when value="Minimum"> | |
106 <expand macro="distToOtherParents" /> | |
107 </when> | |
108 <when value="Both"> | |
109 <expand macro="distToOtherParents" /> | |
110 </when> | |
111 <when value="None" /> | |
112 </conditional> | |
113 <conditional name="con_save_child"> | |
114 <param name="save_child_as_new" label="Do you want to save the children with parents as a new object set?" display="radio" type="select"> | |
115 <option value="Yes">Yes</option> | |
116 <option value="No">No</option> | |
117 </param> | |
118 <when value="Yes"> | |
119 <param name="name_output" type="text" label="Name the output object"> | |
120 <expand macro="text_validator" /> | |
121 </param> | |
122 </when> | |
123 <when value="No" /> | |
124 </conditional> | |
125 </inputs> | |
126 | |
127 <outputs> | |
128 <expand macro="output_pipeline_macro" /> | |
129 </outputs> | |
130 | |
131 <tests> | |
132 <test> | |
133 <expand macro="test_input_pipeline_param" /> | |
134 | |
135 <param name="parent_objects" value="Nuclei" /> | |
136 <param name="child_objects" value="Nucleoli" /> | |
137 <param name="means_for_all" value="Yes" /> | |
138 <conditional name="con_dist"> | |
139 <param name="calc_dist" value="Both" /> | |
140 <conditional name="con_other_parent_dist"> | |
141 <param name="calc_dist_to_others" value="No" /> | |
142 </conditional> | |
143 </conditional> | |
144 <conditional name="con_save_child"> | |
145 <param name="save_child_as_new" value="Yes" /> | |
146 <param name="name_output" value="RelateObjects" /> | |
147 </conditional> | |
148 | |
149 <expand macro="test_out_file" file="relate_objects.txt" /> | |
150 </test> | |
151 </tests> | |
152 | |
153 <expand macro="help" module="RelateObjects" /> | |
154 <expand macro="citations" /> | |
155 | |
156 </tool> |