Skip to content

Commit

Permalink
Merge pull request Helmholtz-UFZ#34 from rmassei/omero-upload
Browse files Browse the repository at this point in the history
OMERO basic upload using omero-py
  • Loading branch information
bernt-matthias authored Jul 29, 2024
2 parents 4ad36d1 + bf77ca1 commit 5497619
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 0 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:
13 changes: 13 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ 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
run: docker-compose -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 +194,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
13 changes: 13 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,18 @@ 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
run: docker-compose -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 +335,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
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 to an OMERO instance
long_description: Import images to an OMERO.server from Galaxy
owner: ufz
remote_repository_url: https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/omero/omero_basic_upload
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 package: {{ tool_name }}."
suite:
name: "suite_omero_py"
description: "A suite of tools that brings the omery-py 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="Dataset where to import the images"/>
<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>
Binary file added tools/omero/test-data/input1.tif
Binary file not shown.
Binary file added tools/omero/test-data/input2.tif
Binary file not shown.
2 changes: 2 additions & 0 deletions tools/omero/test-data/omero_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Image:1
Image:2

0 comments on commit 5497619

Please sign in to comment.