view cellprofiler.xml @ 0:5f72bcf26c29 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 4cb71c4badd30480d67860ff614410f37f2cc8d0"
author bgruening
date Mon, 25 Apr 2022 18:29:47 +0000
parents
children e6b2ab8769a7
line wrap: on
line source

<tool id="cp_cellprofiler4" name="CellProfiler" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01">
    <description>run a CellProfiler pipeline</description>
    <macros>
        <import>macros.xml</import>
        <token name="@VERSION_SUFFIX@">0</token>
        <xml name="test_assert_content" token_n="291">
            <assert_contents>
                <has_n_lines n="@N@" />
            </assert_contents>
        </xml>
    </macros>
    <expand macro="cp_requirements" />
    <command detect_errors="aggressive"><![CDATA[
        export MPLCONFIGDIR=\$TEMP &&
        bash '$script_file' &&
        cellprofiler -c -r --file-list list.txt -o ./output -p '$pipeline' 
        #if $detailed_output
            -L 10 > ./cp.log 2>&1
        #end if 
    ]]></command>
    <configfiles>
        <configfile name="script_file">
mkdir ./input
mkdir ./output

#if $con_input_type.input_type =="yes"
    tar -C ./input -xvf $con_input_type.input_images
#else
    #for $i, $filename in enumerate($con_input_type.input_images):
        ln -s '$filename' './input/${filename.element_identifier}.${filename.ext}'
    #end for
#end if

find `pwd`/input -name "*.*" > list.txt
        </configfile>
    </configfiles>
  
    <inputs>
        <param name="pipeline" type="data" format="txt" label="Pipeline file" help="A ready-to-run .cppipe file. It can be created with various CellProfiler modules." />
        <conditional name="con_input_type">
            <param name="input_type" type="select" label="Are the input images packed into a tar archive?">
                <option value="yes">Yes</option>
                <option value="no">No</option>
            </param> 
            <when value="no">
                <param name="input_images" type="data" multiple="true" format="@FORMATS@" label="Images" />
            </when>
            <when value="yes">
                <param name="input_images" type="data" format="tar" label="A tarball of images" />
            </when>
        </conditional>
       
        <param name="detailed_output" type="boolean" label="Detailed logging file?" help="If set, a detailed CellProfiler log file will be generated." />
    </inputs>

    <outputs>
        <collection name="pipeline_output" type="list" label="CellProfiler pipeline output files">
            <discover_datasets pattern="__designation_and_ext__" visible="false" directory="output"/>
        </collection>
        <data format="txt" name="logs" from_work_dir="cp.log" label="CellProfiler log">
            <filter>detailed_output</filter>
        </data>
    </outputs>

    <tests>
        <test expect_num_outputs="1">
            <param name="pipeline" value="ExampleHuman.cppipe" />
            <conditional name="con_input_type">
                <param name="input_type" value="no" />
                <param name="input_images" value="images/AS_09125_050116030001_D03f00d0.tif,images/AS_09125_050116030001_D03f00d1.tif,images/AS_09125_050116030001_D03f00d2.tif" />
            </conditional>
            <param name="detailed_output" value="False" />
            <output_collection name="pipeline_output" type="list" count="7">
                <element name="AS_09125_050116030001_D03f00d0.tif_Overlay">
                    <assert_contents>
                      <has_size value="168221"/>
                    </assert_contents>
                </element>
                <element name="Cells">
                    <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Cytoplasm">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Experiment">
                  <expand macro="test_assert_content" n="261" />
                </element>
                <element name="Image">
                  <expand macro="test_assert_content" n="2" />
                </element>
                <element name="Nuclei">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="PH3">
                  <expand macro="test_assert_content" n="23" />
                </element>
            </output_collection>
        </test>
        <test expect_num_outputs="2">
            <param name="pipeline" value="ExampleHuman.cppipe" />
            <conditional name="con_input_type">
                <param name="input_type" value="no" />
                <param name="input_images" value="images/AS_09125_050116030001_D03f00d0.tif,images/AS_09125_050116030001_D03f00d1.tif,images/AS_09125_050116030001_D03f00d2.tif" />
            </conditional>
            <param name="detailed_output" value="True" />
            <output_collection name="pipeline_output" type="list" count="7">
                <element name="AS_09125_050116030001_D03f00d0.tif_Overlay">
                    <assert_contents>
                      <has_size value="168221"/>
                    </assert_contents>
                </element>
                <element name="Cells">
                    <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Cytoplasm">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Experiment">
                  <expand macro="test_assert_content" n="261" />
                </element>
                <element name="Image">
                  <expand macro="test_assert_content" n="2" />
                </element>
                <element name="Nuclei">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="PH3">
                  <expand macro="test_assert_content" n="23" />
                </element>
            </output_collection>
            <output name="logs" ftype='txt'>
                <assert_contents>
                    <has_text_matching expression="JVM will be started with AWT in headless mode" />
                </assert_contents>
            </output>
        </test>
        <!-- Repeat tests for tarball input -->
        <test expect_num_outputs="1">
            <param name="pipeline" value="ExampleHuman.cppipe" />
            <conditional name="con_input_type">
                <param name="input_type" value="yes" />
                <param name="input_images" value="images.tar" />
            </conditional>
            <param name="detailed_output" value="False" />
            <output_collection name="pipeline_output" type="list" count="7">
                <element name="AS_09125_050116030001_D03f00d0_Overlay">
                    <assert_contents>
                      <has_size value="168221"/>
                    </assert_contents>
                </element>
                <element name="Cells">
                    <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Cytoplasm">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Experiment">
                  <expand macro="test_assert_content" n="261" />
                </element>
                <element name="Image">
                  <expand macro="test_assert_content" n="2" />
                </element>
                <element name="Nuclei">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="PH3">
                  <expand macro="test_assert_content" n="23" />
                </element>
            </output_collection>
        </test>
        <test expect_num_outputs="2">
            <param name="pipeline" value="ExampleHuman.cppipe" />
            <conditional name="con_input_type">
                <param name="input_type" value="yes" />
                <param name="input_images" value="images.tar" />
            </conditional>
            <param name="detailed_output" value="True" />
            <output_collection name="pipeline_output" type="list" count="7">
                <element name="AS_09125_050116030001_D03f00d0_Overlay">
                    <assert_contents>
                      <has_size value="168221"/>
                    </assert_contents>
                </element>
                <element name="Cells">
                    <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Cytoplasm">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="Experiment">
                  <expand macro="test_assert_content" n="261" />
                </element>
                <element name="Image">
                  <expand macro="test_assert_content" n="2" />
                </element>
                <element name="Nuclei">
                  <expand macro="test_assert_content" n="290" />
                </element>
                <element name="PH3">
                  <expand macro="test_assert_content" n="23" />
                </element>
            </output_collection>
            <output name="logs" ftype='txt'>
                <assert_contents>
                    <has_text_matching expression="JVM will be started with AWT in headless mode" />
                </assert_contents>
            </output>
        </test>        

    </tests>
    
    <help>
    <![CDATA[

      .. class:: infomark

      **What it does**

      This is the last tool in a CellProfiler workflow and runs a CellProfiler @TOOL_VERSION@ pipeline file on a collection of images.


      .. class:: infomark

      **Input**

      - Collection of images.

      - Existing CellProfiler pipeline file *(.cppipe)* or generated by linking CellProfiler tools.

      .. class:: infomark

      **Output**

      - Images if the tool *SaveImages* was included in the workflow.
      - The features selected if the tool *ExportToSpreadsheet* was included in the workflow.

      .. class:: warningmark

      **IMPORTANT**

      Only the pipelines generated with the version @TOOL_VERSION@ of CellProfiler can be run, other versions may cause problems.
      ]]>
    </help>
    <expand macro="citations" />
</tool>