Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omero-download-tool #535

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions utils/omero-download-tool/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[bumpversion]
current_version = 0.1.0-dev0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{dev}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = _
first_value = dev
values =
dev
_

[bumpversion:part:dev]

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:plugin.json]

[bumpversion:file:VERSION]

[bumpversion:file:src/polus/images/utils/omero_download/__init__.py]
175 changes: 175 additions & 0 deletions utils/omero-download-tool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
#Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
poetry.lock
../../poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# vscode
.vscode

# test data directory
data
# yaml file
.pre-commit-config.yaml

# hidden files
.DS_Store
.ds_store
# flake8
.flake8
34 changes: 34 additions & 0 deletions utils/omero-download-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM continuumio/miniconda3

# environment variables defined in polusai/bfio
ENV EXEC_DIR="/opt/executables"
ENV POLUS_IMG_EXT=".ome.tif"
ENV POLUS_TAB_EXT=".csv"
ENV POLUS_LOG="INFO"

ARG OMERO_USERNAME
ARG OMERO_PASSWORD
ENV OMERO_USERNAME=$OMERO_USERNAME
ENV OMERO_PASSWORD=$OMERO_PASSWORD


ARG conda_env=project_env

# Work directory defined in the base container
WORKDIR ${EXEC_DIR}

COPY pyproject.toml ${EXEC_DIR}
COPY environment.yml ${EXEC_DIR}
COPY VERSION ${EXEC_DIR}
COPY README.md ${EXEC_DIR}
COPY src ${EXEC_DIR}/src

RUN conda env create -f environment.yml

ENV PATH /opt/conda/envs/myenv/bin:$PATH
RUN /bin/bash -c "source activate project_env"

RUN pip3 install ${EXEC_DIR} --no-cache-dir

ENTRYPOINT ["python3", "-m", "polus.images.utils.omero_download"]
CMD ["--help"]
45 changes: 45 additions & 0 deletions utils/omero-download-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Omero Download (v0.1.0-dev0)

This tool enables the retrieval of data from the Omero NCATS server. [omero_plus](http://165.112.226.159/omero_plus/login/?url=%2Fwebclient%2F).

## Note
To access data from the Omero NCATS server, user must have to be connection to `NIHVPN`
1. Specify environmental variables for a server's username and password using the command prompt

export `OMERO_USERNAME=XXXX` \
export `OMERO_PASSWORD=XXXX`


Conda is employed to install all dependencies because one of the critical packages, `omero-py`, encountered installation issues with pip

Currently, the supported object types in a tool include: `project`, `dataset`, `screen`, `plate`, `well`


## Building

To build the Docker image for the download plugin, run
`bash build-docker.sh`.

## Run the Docker image

To execute the built docker image for the download plugin, run
`bash run-plugin.sh`.

## Options

This plugin takes 2 input arguments and
1 output argument:

| Name | Description | I/O | Type |
| --------------- | ------------------------------------------------------------ | ------ | ----------- |
| `--dataType` | Object types to be retreived from Omero Server | Input | String |
| `--name ` | Name of an object | Input | String |
| `--objectId ` | Identification of an object of an object | Input | Integer |
| `--outDir` | Directory to store the downloaded data | Output | genericData |
| `--preview` | Generate a JSON file with outputs | Output | JSON |



## Sample docker command:
```bash
docker run -e OMERO_USERNAME=$OMERO_USERNAME -e OMERO_PASSWORD=$OMERO_PASSWORD -v /home/ec2-user/data/:/home/ec2-user/data/ polusai/omero-download-tool:0.1.0-dev0 --dataType="plate" --objectId=108 --outDir=/home/ec2-user/data/output```
1 change: 1 addition & 0 deletions utils/omero-download-tool/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0-dev0
4 changes: 4 additions & 0 deletions utils/omero-download-tool/build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

version=$(<VERSION)
docker build . -t polusai/omero-download-tool:${version}
11 changes: 11 additions & 0 deletions utils/omero-download-tool/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: project_env
channels:
- defaults
- conda-forge
dependencies:
- python==3.9.18
- numpy==1.21.0
- bfio=*
- ome:omero-py
- pydantic=*
- pip
68 changes: 68 additions & 0 deletions utils/omero-download-tool/ict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
author:
- Hamdah Shafqat
contact: [email protected]
container: polusai/omero-download-tool:0.1.0-dev0
description: This plugin allows to retrieve the microscopy image data from the OMERO
NCATS server.
entrypoint: python3 -m polus.images.utils.omero_download
inputs:
- description: The supported object types to be retreived.
format:
- dataType
name: dataType
required: true
type: string
- description: Name of the object to be downloaded.
format:
- name
name: name
required: false
type: string
- description: Identifier of the object to be downloaded.
format:
- objectId
name: objectId
required: false
type: number
- description: Generate an output preview.
format:
- preview
name: preview
required: false
type: boolean
name: polusai/OmeroDownload
outputs:
- description: Output collection.
format:
- outDir
name: outDir
required: true
type: path
repository: https://github.com/PolusAI/image-tools
specVersion: 1.0.0
title: Omero Download
ui:
- description: The supported object types to be retreived.
fields:
- project
- dataset
- screen
- plate
- well
- default
key: inputs.dataType
title: dataType
type: select
- description: Name of the object to be downloaded.
key: inputs.name
title: name
type: text
- description: Identifier of the object to be downloaded.
key: inputs.objectId
title: objectId
type: number
- description: Generate an output preview.
key: inputs.preview
title: Preview example output of this plugin
type: checkbox
version: 0.1.0-dev0
Loading
Loading