view measure_object_intensity.xml @ 6:e52c75a28c4b draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
author bgruening
date Sun, 05 Nov 2023 09:40:06 +0000
parents 407925835dd9
children
line wrap: on
line source

<tool id="cp_measure_object_intensity" name="MeasureObjectIntensity" version="@CP_VERSION@+galaxy@VERSION_SUFFIX@">
    <description>with CellProfiler</description>

    <macros>
        <import>macros.xml</import>
        <token name="@VERSION_SUFFIX@">1</token>
    </macros>

    <edam_operations>
        <edam_operation>operation_3443</edam_operation>
    </edam_operations>
    <xrefs>
        <xref type="bio.tools">CellProfiler</xref>
        <xref type="biii">cellprofiler</xref>
    </xrefs>

    <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.cppipe", "w") as f:
        f.writelines(lines)
        f.write(writemoi())

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

    <inputs>
        <expand macro="input_pipeline_param" />
        <repeat name="rpt_image" title="new image" min="1">
            <param name="image_to_measure" label="Enter the name of an image to measure" type="text">
                <expand macro="text_validator" />
            </param>
        </repeat>

        <repeat name="rpt_object" title="new object" min="1">
            <param name="objects_to_measure" label="Enter the name of the objects to measure" type="text">
                <expand macro="text_validator" />
            </param>
        </repeat>
    </inputs>

    <outputs>
        <expand macro="output_pipeline_param" />
    </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.cppipe" />
        </test>
    </tests>

    <help>
        <![CDATA[

            .. class:: infomark

            **What it does**

            MeasureObjectIntensity measures several intensity features for identified objects.

            Given an image with objects identified (e.g., nuclei or cells), this module extracts intensity features for each object based on one or more corresponding grayscale images.
            Measurements are recorded for each object.
            Intensity measurements are made for all combinations of the images and objects entered.
            If you want only specific image/object measurements, you can use multiple MeasureObjectIntensity modules for each group of measurements desired.
            Note that for publication purposes, the units of intensity from microscopy images are usually described as “Intensity units” or “Arbitrary intensity units” because microscopes are not calibrated to an absolute scale.
            Also, it is important to note whether you are reporting the mean vs. the integrated intensity, so specify “Mean intensity units” or “Integrated intensity units” accordingly.
            Keep in mind that the default behavior in CellProfiler is to rescale the image intensity from 0 to 1 by dividing all pixels in the image by the maximum possible intensity value.
            This “maximum possible” value is defined by the “Set intensity range from” setting in NamesAndTypes; see the help for that setting for more details.

            @COMMON_HELP@
            ]]>
    </help>



    <expand macro="citations" />

</tool>