Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
rmassei committed Aug 8, 2024
2 parents 1814b7b + b9d952c commit a4d5d5d
Show file tree
Hide file tree
Showing 32 changed files with 442 additions and 136 deletions.
54 changes: 54 additions & 0 deletions .github/omero-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# from https://github.com/TheJacksonLaboratory/ezomero/blob/main/tests/docker-compose.yml

version: "3"

services:

database:
image: "postgres:11"
environment:
POSTGRES_USER: omero
POSTGRES_DB: omero
POSTGRES_PASSWORD: omero
networks:
- omero
volumes:
- "database:/var/lib/postgresql/data"

omero:
# This container uses the tag for the latest server release of OMERO 5
# To upgrade to the next major release, increment the major version number
image: "openmicroscopy/omero-server:latest"
environment:
CONFIG_omero_db_host: database
CONFIG_omero_db_user: omero
CONFIG_omero_db_pass: omero
CONFIG_omero_db_name: omero
CONFIG_omero_policy_binary__access: +read,+write,+image,+plate
CONFIG_omero_glacier2_IceSSL_Ciphers: "HIGH:!DH"
ROOTPASS: omero
networks:
- omero
ports:
- "6063:4063"
- "6064:4064"
volumes:
- "omero:/OMERO"

omeroweb:
# This container uses the tag for the latest web release of OMERO 5
# To upgrade to the next major release, increment the major version number
image: "openmicroscopy/omero-web-standalone:latest"
environment:
OMEROHOST: omero
networks:
- omero
ports:
- "5080:4080"

networks:
omero:

volumes:
database:
omero:
14 changes: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ jobs:
uses: eWaterCycle/setup-apptainer@v2
- name: Symlink singularity
run: ln -s $(which apptainer) $(dirname apptainer)/singularity
- name: Install containers
run: |
echo "${{ needs.setup.outputs.repository-list }}" > repository_list.txt
if grep -q scripting repository_list.txt; then
singularity pull --dir /tmp docker://continuumio/anaconda3
singularity pull --dir /tmp docker://rocker/tidyverse
fi
- name: Start OMERO
uses: sudo-bot/action-docker-compose@latest
with:
cli-args: "-f .github/omero-docker-compose.yml up -d"

# download or create large test data via script
- name: Create test data
run: |
Expand All @@ -182,6 +195,7 @@ jobs:
repository-list: ${{ needs.setup.outputs.repository-list }}
galaxy-fork: ${{ needs.setup.outputs.fork }}
galaxy-branch: ${{ needs.setup.outputs.branch }}
additional-planemo-options: --docker_run_extra_arguments '--add-host=host.docker.internal:host-gateway'
chunk: ${{ matrix.chunk }}
chunk-count: ${{ needs.setup.outputs.chunk-count }}
galaxy-slots: ${{ steps.cpu-cores.outputs.count }}
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,20 @@ jobs:
uses: eWaterCycle/setup-apptainer@v2
- name: Symlink singularity
run: ln -s $(which apptainer) $(dirname apptainer)/singularity
- name: Install containers
run: |
echo "${{ needs.setup.outputs.repository-list }}" > repository_list.txt
if grep -q scripting repository_list.txt; then
singularity pull --dir /tmp docker://continuumio/anaconda3
singularity pull --dir /tmp docker://rocker/tidyverse
fi
# Start OMERO
- name: Start OMERO
uses: sudo-bot/action-docker-compose@latest
with:
cli-args: "-f .github/omero-docker-compose.yml up -d"

# download or create large test data via script
- name: Create test data
run: |
Expand All @@ -323,6 +337,7 @@ jobs:
repository-list: ${{ needs.setup.outputs.repository-list }}
galaxy-fork: ${{ env.GALAXY_FORK }}
galaxy-branch: ${{ env.GALAXY_BRANCH }}
additional-planemo-options: --docker_run_extra_arguments '--add-host=host.docker.internal:host-gateway'
chunk: ${{ matrix.chunk }}
chunk-count: ${{ needs.setup.outputs.chunk-count }}
galaxy-slots: ${{ steps.cpu-cores.outputs.count }}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions tools/omero/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
categories:
- Imaging
name: omero_upload
description: Import images and metadata into an OMERO.server using omero-py
long_description: Tool to import images into a target dataset in OMERO
owner: ufz
remote_repository_url: https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero
homepage_url: https://github.com/ome/omero-py/
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: "Wrapper command line tools of the omero-py and ezomero package: {{ tool_name }}."
suite:
name: "suite_omero_py"
description: "A suite of tools that brings the omero-py and ezomero project into Galaxy."
long_description: |
OMERO.py provides an interface to the OMERO.blitz server.
19 changes: 19 additions & 0 deletions tools/omero/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# OMERO import images

## Set up user credentials on Galaxy to connect to other omero instance

To enable users to set their credentials for this tool,
make sure the file `config/user_preferences_extra.yml` has the following section:

```
omero_account:
description: Your OMERO instance connection credentials
inputs:
- name: username
label: Username
type: text
required: False
- name: password
label: Password
type: password
required: False
77 changes: 77 additions & 0 deletions tools/omero/omero_import.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<tool id="omero_import" name="OMERO Image Import" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01" license="MIT">
<description> with omero-py </description>
<macros>
<token name="@TOOL_VERSION@">5.18.0</token>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<xrefs>
<xref type="bio.tools">omero</xref>
</xrefs>
<requirements>
<requirement type="package" version="@TOOL_VERSION@">omero-py</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[
#import re
mkdir folder &&
#for $image in $folder:
#set image = $image
#set image_identifier = re.sub('[^\s\w\-]', '_', str($image.element_identifier))
ln -s '${image}' folder/'${image_identifier}.$image.ext' &&
#end for
omero import folder -T Dataset:name:$dataset_name
-s $omero_host
-p $omero_port
-u $__user__.extra_preferences.get('omero|username', $test_username)
-w $__user__.extra_preferences.get('omero|password', $test_password)
> $log &&
omero logout
]]></command>
<inputs>
<param name="folder" type="data" format="avi,bmp,btf,cif,csv,eps,fits,fli,gif,hdr,html,jp2,jpg,mov,mrc,ndpi,nhdr,nrrd,ome.tiff,par,pbm,pcx,pgm,png,ppm,psd,scn,sif,svs,tf2,tf8,tif,tif,tiff,top,txt,vms,wav,xml,zip" multiple="true" optional="false" label="Images to import into OMERO"/>
<param name="dataset_name" type="text" optional="false" label="Target Dataset Name"/>
<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>
</param>
<param name="omero_port" type="integer" value="4064" optional="false" label="OMERO port"/>
<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="folder" value="input1.tif,input2.tif"/>
<param name="dataset_name" value="galaxy_test_upload"/>
<param name="omero_host" value="host.docker.internal"/>
<param name="omero_port" value="6064"/>
<param name="test_username" value="root"/>
<param name="test_password" value="omero"/>
<output name="log" value="omero_output.txt" ftype="txt">
<assert_contents>
<has_n_lines n="2"/>
</assert_contents>
</output>
<assert_stderr>
<has_text_matching expression="IMPORT_DONE.*input1.tif"/>
<has_text_matching expression="IMPORT_DONE.*input2.tif"/>
<has_text text="files uploaded, 2 filesets created, 2 images imported, 0 errors"/>
</assert_stderr>
</test>
</tests>
<help>
- This tool allows the import of images into a user-defined OMERO server

- The user can define an existing dataset name where the images will be imported

- If the dataset does not exist, a new one will be created
</help>
<citations>
<citation type="doi">10.1038/nmeth.1896</citation>
</citations>
</tool>
147 changes: 147 additions & 0 deletions tools/omero/omero_metadata_import.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<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@">0</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>
<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|username', $test_username)
--pws $__user__.extra_preferences.get('omero|password', $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 argument="omero_host" type="text" optional="false" label="OMERO host URL"/>
<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>
Loading

0 comments on commit a4d5d5d

Please sign in to comment.