view measure_object_size_shape.xml @ 2:5ef26243a4a5 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 1907942bef43b20edfdbd1d1b5eb1cac3602848b"
author bgruening
date Thu, 16 Apr 2020 05:43:28 -0400
parents eba2ec72f967
children 5c9549983af8
line wrap: on
line source

<tool id="cp_measure_object_size_shape" name="MeasureObjectSizeShape" version="@CP_VERSION@">
    <description>measure area and shape features of identified objects</description>
  
    <macros>
        <import>macros.xml</import>
    </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 writemoss():
    _str = "\nMeasureObjectSizeShape:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:1|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count

    for obj in params['rpt_object']:
        _str += FOURSPACES + "Select objects to measure:%s\n" % obj['objects_to_measure']

    _str += FOURSPACES + "Calculate the Zernike features?:%s\n" % params['zernike_feature']

    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(writemoss())

f.close()
        </configfile>    
    </configfiles>
    
    <inputs>
      <expand macro="input_pipeline_macro" />
      <repeat name="rpt_object" title="Add another object">
          <param name="objects_to_measure" label="Select objects to measure" type="text" >
            <expand macro="text_validator" />
          </param>
      </repeat>
      <param name="zernike_feature" type="select" display="radio" label="Calculate the Zernike features?">
          <option value="Yes">Yes</option>
          <option value="No">No</option>
      </param>
    </inputs>

    <outputs>
        <expand macro="output_pipeline_macro" />
    </outputs>

    <tests>
        <test>
            <expand macro="test_input_pipeline_param" />
            <repeat name="rpt_object">
                <param name="objects_to_measure" value="Nuclei" />
            </repeat>
            <repeat name="rpt_object">
                <param name="objects_to_measure" value="Nucleoli" />
            </repeat>
            <param name="zernike_feature" value="Yes" />
            <expand macro="test_out_file" file="measure_object_size_shape.txt" />
        </test>
    </tests>

    <expand macro="help" module="MeasureObjectSizeShape" />
    <expand macro="citations" /> 

</tool>