view measure_object_intensity.xml @ 0:1373b765c8f9 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 6d73056a625002d0275b5a9a90a9fae329ce47f1"
author bgruening
date Thu, 26 Mar 2020 17:07:39 -0400
parents
children ae299f107121
line wrap: on
line source

<tool id="cp_measure_object_intensity" name="MeasureObjectIntensity" version="@CP_VERSION@">
    <description>measures several intensity features for 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 writemoi():
    _str = "\nMeasureObjectIntensity:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:3|show_window:False|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count

    hidden = len(params['rpt_image'])

    _str += FOURSPACES + "Hidden:%d\n" % hidden

    for img in params['rpt_image']:
        _str += FOURSPACES + "Select an image to measure:%s\n" % img['image_to_measure']

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

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

f.close()
        </configfile>    
    </configfiles>

    <inputs>
        <expand macro="input_pipeline_macro" />
        <repeat name="rpt_image" title="Add another image">
            <param name="image_to_measure" label="Select an image to measure" type="text">
              <expand macro="text_validator" />
            </param>
        </repeat>

        <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>
    </inputs>

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

    <tests>
        <test>
            <expand macro="test_input_pipeline_param" />
            <repeat name="rpt_image">
                <param name="image_to_measure" value="DNA"/>
            </repeat>
            <repeat name="rpt_object" >
                <param name="objects_to_measure" value="Nuclei" />
            </repeat>
            <expand macro="test_out_file" file="measure_object_intensity.txt" />
        </test>
    </tests>
    
    <expand macro="help" module="MeasureObjectIntensity" />
    <expand macro="citations" /> 

</tool>