Mercurial > repos > bgruening > cp_relate_objects
view 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 |
line wrap: on
line source
<tool id="cp_relate_objects" name="RelateObjects" version="@CP_VERSION@"> <description>assigns relationships parent-children between objects</description> <macros> <import>macros.xml</import> <xml name="distToOtherParents"> <conditional name="con_other_parent_dist"> <param name="calc_dist_to_others" label="Calculate distances to other parents?" display="radio" type="select"> <option value="Yes">Yes</option> <option value="No">No</option> </param> <when value="Yes"> <repeat name="rpt_parent_name" title="Parent Name"> <param name="other_parent_name" type="text" label="Parent name"> <expand macro="text_validator" /> </param> </repeat> </when> <when value="No" /> </conditional> </xml> </macros> <expand macro="py_requirements"/> <expand macro="cmd_modules" /> <configfiles> <inputs name="inputs" /> <configfile name="script_file"> import json import sys import os FOURSPACES=@SPACES@ input_json_path = sys.argv[1] input_pipeline= sys.argv[2] params = json.load(open(input_json_path, "r")) def writero(): _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 _str += FOURSPACES + "Parent objects:%s\n" % params['parent_objects'] _str += FOURSPACES + "Child objects:%s\n" % params['child_objects'] _str += FOURSPACES + "Calculate child-parent distances?:%s\n" % params['con_dist']['calc_dist'] _str += FOURSPACES + "Calculate per-parent means for all child measurements?:%s\n" % params['means_for_all'] dist_others = params['con_dist']['con_other_parent_dist']['calc_dist_to_others'] _str += FOURSPACES + "Calculate distances to other parents?:%s\n" % dist_others name_flag = params['con_save_child']['save_child_as_new'] _str += FOURSPACES + "Do you want to save the children with parents as a new object set?:%s\n" % name_flag if name_flag == "Yes": _str += FOURSPACES + "Name the output object:%s\n" % params['con_save_child']['name_output'] else: _str += FOURSPACES + "Name the output object:None\n" if dist_others == "Yes": for pname in params['con_dist']['con_other_parent_dist']['rpt_parent_name']: _str += FOURSPACES + "Parent name:%s\n" % pname['other_parent_name'] return _str with open(input_pipeline) as fin: lines = fin.readlines() k, v = lines[4].strip().split(':') module_count = int(v) new_count = module_count + 1 lines[4] = k + ":%d\n" % new_count with open("output", "w") as f: f.writelines(lines) f.write(writero()) f.close() </configfile> </configfiles> <inputs> <expand macro="input_pipeline_macro"/> <param name="parent_objects" label="Parent objects" type="text"> <expand macro="text_validator" /> </param> <param name="child_objects" label="Child objects" type="text" > <expand macro="text_validator" /> </param> <param name="means_for_all" label="Calculate per-parent means for all child measurements?:" display="radio" type="select"> <option value="Yes">Yes</option> <option value="No">No</option> </param> <conditional name="con_dist"> <param name="calc_dist" label="Calculate child-parent distances?" type="select"> <option value="None">None</option> <option value="Centroid">Centroid</option> <option value="Minimum">Minimum</option> <option value="Both">Both</option> </param> <when value="Centroid"> <expand macro="distToOtherParents" /> </when> <when value="Minimum"> <expand macro="distToOtherParents" /> </when> <when value="Both"> <expand macro="distToOtherParents" /> </when> <when value="None" /> </conditional> <conditional name="con_save_child"> <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"> <option value="Yes">Yes</option> <option value="No">No</option> </param> <when value="Yes"> <param name="name_output" type="text" label="Name the output object"> <expand macro="text_validator" /> </param> </when> <when value="No" /> </conditional> </inputs> <outputs> <expand macro="output_pipeline_macro" /> </outputs> <tests> <test> <expand macro="test_input_pipeline_param" /> <param name="parent_objects" value="Nuclei" /> <param name="child_objects" value="Nucleoli" /> <param name="means_for_all" value="Yes" /> <conditional name="con_dist"> <param name="calc_dist" value="Both" /> <conditional name="con_other_parent_dist"> <param name="calc_dist_to_others" value="No" /> </conditional> </conditional> <conditional name="con_save_child"> <param name="save_child_as_new" value="Yes" /> <param name="name_output" value="RelateObjects" /> </conditional> <expand macro="test_out_file" file="relate_objects.txt" /> </test> </tests> <expand macro="help" module="RelateObjects" /> <expand macro="citations" /> </tool>