view omero_metadata_import.xml @ 1:588d6fa22fc4 draft

planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero commit 5b1b30d409355cee98485815c1dd4ac48649bcc1
author ufz
date Thu, 05 Sep 2024 11:55:55 +0000
parents 352e9d4eaf70
children e41f70e69349
line wrap: on
line source

<tool id="omero_metadata_import" name="OMERO Metadata Import" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"
      profile="20.01" license="MIT">
    <description> with ezomero </description>
    <macros>
        <token name="@TOOL_VERSION@">5.18.0</token>
        <token name="@VERSION_SUFFIX@">1</token>
    </macros>
    <xrefs>
        <xref type="bio.tools">omero</xref>
    </xrefs>
    <requirements>
        <requirement type="package" version="3.0.1">ezomero</requirement>
        <requirement type="package" version="2.2.2">pandas</requirement>
        <!-- openjdk is needed: https://github.com/conda-forge/omero-py-feedstock/pull/16 -->
        <requirement type="package" version="21.0.2">openjdk</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        python $__tool_directory__/omero_metadata_upload.py
        --user $__user__.extra_preferences.get('omero_account|username', $test_username)
        --pws $__user__.extra_preferences.get('omero_account|username', $test_password)
        --host $omero_host
        --port $omero_port
        --obj_type $obj_type
        --ann_type $ann_type
        --ann_file $ann_file
        --an_name $an_name
        --log_file $log
        #if $object_id_selection == "existing_object"
            --did "$did"
        #end if
    ]]></command>
    <inputs>
        <param name="omero_host" type="text" label="OMERO host URL">
            <validator type="regex" message="Enter a valid host location, for example, your.omero.server">^[a-zA-Z0-9._-]*$</validator>
            <validator type="expression" message="No two dots (..) allowed">'..' not in value</validator>
        </param>
        <param argument="omero_port" type="integer" optional="false" value="4064" label="OMERO port"/>
        <param argument="obj_type" type="select" optional="true" label="Target Object Type">
            <option value="project">Project</option>
            <option value="screen">Screen</option>
            <option value="dataset">Dataset</option>
            <option value="image">Image</option>
        </param>
        <conditional name="object_id">
        <param name="object_id_selection" type="select" label="Selection"  help="Create a new OMERO object or target an existing one">
            <option value="new_object">Create new object</option>
            <option value="existing_object">Target an existing object</option>
        </param>
        <when value="new_object"/>
        <when value="existing_object">
            <param name="did" type="integer" value="" optional="false" label="Object ID"/>
        </when>
        </conditional>
        <param argument="ann_type" type="select" optional="false" label="Annotation type" help="Select annotation format">
            <option value="table">Table</option>
            <option value="KV">Key-Value Pairs</option>
        </param>
        <param argument="ann_file" type="data" format="tabular" optional="false" label="Annotation file" help="Select annotation file"/>
        <param argument="an_name" type="text" optional="false" label="Annotation Name"/>
        <param name="test_username" type="hidden" value=""/>
        <param name="test_password" type="hidden" value=""/>
    </inputs>
    <outputs>
        <data name="log" format="txt"/>
    </outputs>
    <tests>
        <test>
            <param name="omero_host" value="host.docker.internal"/>
            <param name="omero_port" value="6064"/>
            <param name="obj_type" value="project"/>
            <param name="ann_type" value="table"/>
            <param name="object_id_selection" value="new_object"/>
            <param name="ann_file" value="metadata.tsv"/>
            <param name="an_name" value="Table_Test"/>
            <param name="test_username" value="root"/>
            <param name="test_password" value="omero"/>
            <output name="log" value="output_table_import.txt" ftype="txt">
                <assert_contents>
                    <has_text text="SUCCESS: Successfully uploaded metadata for project"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="omero_host" value="host.docker.internal"/>
            <param name="omero_port" value="6064"/>
            <param name="obj_type" value="dataset"/>
            <param name="ann_type" value="KV"/>
            <param name="object_id_selection" value="new_object"/>
            <param name="ann_file" value="metadata.tsv"/>
            <param name="an_name" value="KV_Test"/>
            <param name="test_username" value="root"/>
            <param name="test_password" value="omero"/>
            <output name="log" value="output_KV_import.txt" ftype="txt">
                <assert_contents>
                    <has_text text="SUCCESS: Successfully uploaded metadata for dataset"/>
                </assert_contents>
            </output>
        </test>
            <test>
            <param name="omero_host" value="host.docker.internal"/>
            <param name="omero_port" value="6064"/>
            <param name="obj_type" value="dataset"/>
            <param name="ann_type" value="KV"/>
            <param name="object_id_selection" value="existing_object"/>
            <param name="did" value="1"/>
            <param name="ann_file" value="metadata.tsv"/>
            <param name="an_name" value="Additional_KV_Values"/>
            <param name="test_username" value="root"/>
            <param name="test_password" value="omero"/>
            <output name="log" value="output_target_import.txt" ftype="txt">
                <assert_contents>
                    <has_text text="SUCCESS: Successfully uploaded metadata for dataset"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help>
Description
-----------

Tool to import metadata (Table and K/V pairs) into user defined OMERO.server.
Metadata can be attached to an existing OMERO object (Project, Dataset, Screen, or Image).
Optionally, a new OMERO object can be created before uploading the metadata.
If the object does not exist, a new one will be created.

**Tabular metadata file example**

- Table

  +------------+---------------+---------------+
  | image_id   | attribute_1   | attribute_2   |
  +============+===============+===============+
  | 235        | 0             | 1             |
  +------------+---------------+---------------+
  | 564        | 1             | 1             |
  +------------+---------------+---------------+
  | 120        | 0             | 1             |
  +------------+---------------+---------------+

- Key-Value Pairs

  +--------+---------+----------+
  | Key1   | Key2    | Key3     |
  +========+=========+==========+
  | Value1 | Value2  | Value3   |
  +--------+---------+----------+
    </help>
    <citations>
        <citation type="doi">10.1038/nmeth.1896</citation>
    </citations>
</tool>