Skip to content

Commit

Permalink
fix preview function
Browse files Browse the repository at this point in the history
  • Loading branch information
hamshkhawar committed Apr 23, 2024
1 parent 07b6a64 commit 98ac45f
Show file tree
Hide file tree
Showing 17 changed files with 933 additions and 0 deletions.
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
21 changes: 21 additions & 0 deletions utils/omero-download-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM polusai/bfio:2.3.6

# 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"

# 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 pip3 install ${EXEC_DIR} --no-cache-dir

ENTRYPOINT ["python3", "-m", "polus.images.utils.omero_download"]
CMD ["--help"]
44 changes: 44 additions & 0 deletions utils/omero-download-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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 |
| `--id ` | 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:
```docker run -v /home/ec2-user/data/:/home/ec2-user/data/ polusai/omero-download-tool:0.1.0-dev0 --dataType="plate" --id=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}
15 changes: 15 additions & 0 deletions utils/omero-download-tool/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: myenv
channels:
- defaults
- conda-forge
dependencies:
- python=3.9
- numpy=1.21.0
- ome:omero-py
- requests=*
- tqdm=*
- pydantic=*
- cryptography=*
- pip
- pip:
- preadator==0.4.0-dev2
96 changes: 96 additions & 0 deletions utils/omero-download-tool/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"name": "Omero Download",
"version": "0.1.0-dev0",
"title": "Retrieve data from the OMERO NCATS server",
"description": "This plugin allows to retrieve the microscopy image data from the OMERO NCATS server.",
"author": "Hamdah Shafqat Abbasi (hamdahshafqat.abbasi@nih.gov)",
"institution": "National Center for Advancing Translational Sciences, National Institutes of Health",
"repository": "https://github.com/PolusAI/image-tools",
"website": "https://ncats.nih.gov/preclinical/core/informatics",
"citation": "",
"containerId": "polusai/omero-download-tool:0.1.0-dev0",
"baseCommand": [
"python3",
"-m",
"polus.images.utils.omero_download"
],
"inputs": [
{
"name": "dataType",
"type": "enum",
"title": "dataType",
"description": "The supported object types to be retreived.",
"default": "default",
"options": {
"values": [
"project",
"dataset",
"screen",
"plate",
"well",
"default"
]
},
"required": true
},
{
"name": "name",
"type": "string",
"title": "name",
"description": "Name of the object to be downloaded.",
"required": "False"
},
{
"name": "id",
"type": "integer",
"title": "id",
"description": "Identifier of the object to be downloaded.",
"required": "False"
},
{
"name": "preview",
"type": "boolean",
"title": "Preview",
"description": "Generate an output preview.",
"required": "False"
}
],
"outputs": [
{
"name": "outDir",
"type": "genericData",
"description": "Output collection."
}
],
"ui": [
{
"key": "inputs.dataType",
"type": "enum",
"title": "dataType",
"description": "The supported object types to be retreived.",
"default": "dataset",
"required": "True"
},
{
"key": "inputs.name",
"type": "string",
"title": "name",
"description": "Name of the object to be downloaded.",
"required": "False"
},
{
"key": "inputs.id",
"type": "integer",
"title": "id",
"description": "Identifier of the object to be downloaded.",
"required": "False"
},
{
"key": "inputs.preview",
"type": "boolean",
"title": "Preview example output of this plugin",
"description": "Generate an output preview.",
"required": "False"
}
]
}
Loading

0 comments on commit 98ac45f

Please sign in to comment.