.. image:: https://github.com/ome/omero-parade/workflows/OMERO/badge.svg
:target: https://github.com/ome/omero-parade/actions
.. image:: https://badge.fury.io/py/omero-parade.svg
:target: https://badge.fury.io/py/omero-parade
OMERO.parade
============
An OMERO.web app for filtering Data in OMERO.web centre panel.
For full details see `SUPPORT.md <https://github.com/ome/omero-parade/blob/master/SUPPORT.md>`_.
Requirements
------------
* OMERO.web 5.6.1 or newer.
Installing from PyPI
--------------------
This section assumes that an OMERO.web is already installed.
Install the app using `pip <https://pip.pypa.io/en/stable/>`_:
::
$ pip install -U omero-parade
Add parade custom app to your installed web apps:
::
$ bin/omero config append omero.web.apps '"omero_parade"'
Display parade in the centre of the webclient:
::
$ bin/omero config append omero.web.ui.center_plugins \
'["Parade", "omero_parade/init.js.html", "omero_parade"]'
Now restart OMERO.web as normal.
Build
-----
In order to build you need:
* npm version equal or greater than `npm 8.19.4`.
::
$ npm install
To build and automatically rebuild when source files change, run:
::
$ npm run watch
To build a compressed, minified version for production, run:
::
$ npm run build
Custom Filtering
----------------
Users can customize the filtering options available by adding their own
python modules to the setting:
::
omero.web.parade.filters
The current default setting lists the ``omero_parade`` app itself and two
other modules that are in the same directory and are therefore expected to
be on the PYTHONPATH when the app is installed.
::
'["omero_parade", "omero_parade.annotation_filters", "omero_parade.table_filters"]'
Each of these modules contains an ``omero_filters.py`` which is expected to
implement 2 methods: ``get_filters`` and ``get_script``.
The ``get_filters`` method is used to compile the list of filters returned
by the URL ``/omero_parade/filters/``.
Some examples of ``get_filters``
::
# Return a list of filter names.
def get_filters(request, conn):
return ["Rating", "Comment", "Tag"]
The request may include ``plate`` or ``dataset`` ID if we only want to
support the filter for certain data types. In this example we could even
check whether an OMERO.table exists on the plate.
::
def get_filters(request, conn):
if request.GET.get('plate', None) is not None:
return ["Table"]
return []
The ``get_script`` function for a named filter should return a ``JsonResponse``
that includes a list of parameters for the user input to the filter
and a JavaScript filter function.
The JavaScript function will be called for each image to filter and will
also be passed in a params object with the user input.
::
# Return a JS function to filter images by various params.
def get_script(request, script_name, conn):
dataset_id = request.GET.get('dataset')
// OR...
plate_id = request.GET.get('plate')
if script_name == "Rating":
# Load rating data for images in Dataset or Wells in Plate...
# ...
# var ratings = {imageId: rating} for all images
var js_object_attr = 'id'; # or 'wellId' if filtering Wells
# Return a JS function that will be passed an object
# e.g. {id: 1} for Image or {id: 1, wellId:2} for Image in Well.
# and should return true or false
f = """(function filter(data, params) {
var ratings = %s;
var match = ratings[data.%s] == params.rating;
return (params.rating === '-' || match);
})
""" % (json.dumps(ratings), js_object_attr)
filter_params = [{'name': 'rating',
'type': 'text',
'values': ['-', '1', '2', '3', '4', '5'],
'default': '-',
}]
return JsonResponse(
{
'f': f,
'params': filter_params,
})
Custom Data Providers
---------------------
Custom data providers return numerical data for Images that can
be shown in a table for sorting, or plotted in a graph.
NB: Even if data applies to Wells, you need to map this to Image ID, since
that is the common denominator that is used to identify images in the
various list, grid or plot layouts.
Using the same setup as for filtering above, each module listed in the
``omero.web.parade.filters`` setting can also contain a ``data_providers.py``
file that implements two methods ``get_dataproviders`` and ``get_data``.
Examples for ``omero_parade/data_providers.py``
::
def get_dataproviders(request, conn):
return ["ROI_count"]
def get_data(request, data_name, conn):
"""Return data for images in a Dataset or Plate."""
dataset_id = request.GET.get('dataset')
plate_id = request.GET.get('plate')
field_id = request.GET.get('field')
# ... get img_ids for container, then...
if data_name == "ROI_count":
# Want to get ROI count for images
params = ParametersI()
params.addIds(img_ids)
query = "select roi.image.id, count(roi.id) from Roi roi "\
"where roi.image.id in (:ids) group by roi.image"
p = query_service.projection(query, params, conn.SERVICE_OPTS)
roi_counts = {}
for i in p:
roi_counts[i[0].val] = i[1].val
return roi_counts
Release process
---------------
This repository uses `bump2version <https://pypi.org/project/bump2version/>`_ to manage version numbers.
To tag a release run::
$ bumpversion release
This will remove the ``.dev0`` suffix from the current version, commit, and tag the release.
To switch back to a development version run::
$ bumpversion --no-tag [major|minor|patch]
specifying ``major``, ``minor`` or ``patch`` depending on whether the development branch will be a `major, minor or patch release <https://semver.org/>`_. This will also add the ``.dev0`` suffix.
Remember to ``git push`` all commits and tags.
License
-------
This project, similar to many Open Microscopy Environment (OME) projects, is
licensed under the terms of the GNU General Public License (GPL) v2 or later.
Copyright
---------
2019-2023, The Open Microscopy Environment
Raw data
{
"_id": null,
"home_page": "https://github.com/ome/omero-parade",
"name": "omero-parade",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "OMERO.web,parade",
"author": "The Open Microscopy Team",
"author_email": "ome-devel@lists.openmicroscopy.org.uk",
"download_url": "https://files.pythonhosted.org/packages/b5/12/141fa996e47573010dc2f85317d85b3dc56304b791f192faed79cee5fbba/omero-parade-0.2.4.tar.gz",
"platform": null,
"description": ".. image:: https://github.com/ome/omero-parade/workflows/OMERO/badge.svg\n :target: https://github.com/ome/omero-parade/actions\n\n.. image:: https://badge.fury.io/py/omero-parade.svg\n :target: https://badge.fury.io/py/omero-parade\n\nOMERO.parade\n============\n\nAn OMERO.web app for filtering Data in OMERO.web centre panel.\n\nFor full details see `SUPPORT.md <https://github.com/ome/omero-parade/blob/master/SUPPORT.md>`_.\n\n\nRequirements\n------------\n\n* OMERO.web 5.6.1 or newer.\n\n\nInstalling from PyPI\n--------------------\n\nThis section assumes that an OMERO.web is already installed.\n\nInstall the app using `pip <https://pip.pypa.io/en/stable/>`_:\n\n::\n\n $ pip install -U omero-parade\n\nAdd parade custom app to your installed web apps:\n\n::\n\n $ bin/omero config append omero.web.apps '\"omero_parade\"'\n\nDisplay parade in the centre of the webclient:\n\n::\n\n $ bin/omero config append omero.web.ui.center_plugins \\\n '[\"Parade\", \"omero_parade/init.js.html\", \"omero_parade\"]'\n\n\nNow restart OMERO.web as normal.\n\n\nBuild\n-----\n\nIn order to build you need:\n\n* npm version equal or greater than `npm 8.19.4`.\n\n::\n\n $ npm install\n\nTo build and automatically rebuild when source files change, run:\n\n::\n\n $ npm run watch\n\nTo build a compressed, minified version for production, run:\n\n::\n\n $ npm run build\n\n\nCustom Filtering\n----------------\n\nUsers can customize the filtering options available by adding their own\npython modules to the setting:\n\n::\n\n omero.web.parade.filters\n\nThe current default setting lists the ``omero_parade`` app itself and two\nother modules that are in the same directory and are therefore expected to\nbe on the PYTHONPATH when the app is installed.\n\n::\n\n '[\"omero_parade\", \"omero_parade.annotation_filters\", \"omero_parade.table_filters\"]'\n\nEach of these modules contains an ``omero_filters.py`` which is expected to\nimplement 2 methods: ``get_filters`` and ``get_script``.\n\nThe ``get_filters`` method is used to compile the list of filters returned\nby the URL ``/omero_parade/filters/``.\n\nSome examples of ``get_filters``\n\n::\n\n # Return a list of filter names.\n def get_filters(request, conn):\n return [\"Rating\", \"Comment\", \"Tag\"]\n\nThe request may include ``plate`` or ``dataset`` ID if we only want to\nsupport the filter for certain data types. In this example we could even\ncheck whether an OMERO.table exists on the plate.\n\n::\n\n def get_filters(request, conn):\n if request.GET.get('plate', None) is not None:\n return [\"Table\"]\n return []\n\nThe ``get_script`` function for a named filter should return a ``JsonResponse``\nthat includes a list of parameters for the user input to the filter\nand a JavaScript filter function.\n\nThe JavaScript function will be called for each image to filter and will\nalso be passed in a params object with the user input.\n\n::\n\n # Return a JS function to filter images by various params.\n def get_script(request, script_name, conn):\n\n dataset_id = request.GET.get('dataset')\n // OR...\n plate_id = request.GET.get('plate')\n\n if script_name == \"Rating\":\n # Load rating data for images in Dataset or Wells in Plate...\n # ...\n # var ratings = {imageId: rating} for all images\n var js_object_attr = 'id'; # or 'wellId' if filtering Wells\n\n # Return a JS function that will be passed an object\n # e.g. {id: 1} for Image or {id: 1, wellId:2} for Image in Well.\n # and should return true or false\n f = \"\"\"(function filter(data, params) {\n var ratings = %s;\n var match = ratings[data.%s] == params.rating;\n return (params.rating === '-' || match);\n })\n \"\"\" % (json.dumps(ratings), js_object_attr)\n\n filter_params = [{'name': 'rating',\n 'type': 'text',\n 'values': ['-', '1', '2', '3', '4', '5'],\n 'default': '-',\n }]\n return JsonResponse(\n {\n 'f': f,\n 'params': filter_params,\n })\n\n\nCustom Data Providers\n---------------------\n\nCustom data providers return numerical data for Images that can\nbe shown in a table for sorting, or plotted in a graph.\nNB: Even if data applies to Wells, you need to map this to Image ID, since\nthat is the common denominator that is used to identify images in the\nvarious list, grid or plot layouts.\n\nUsing the same setup as for filtering above, each module listed in the\n``omero.web.parade.filters`` setting can also contain a ``data_providers.py``\nfile that implements two methods ``get_dataproviders`` and ``get_data``.\n\nExamples for ``omero_parade/data_providers.py``\n\n::\n\n def get_dataproviders(request, conn):\n return [\"ROI_count\"]\n\n\n def get_data(request, data_name, conn):\n \"\"\"Return data for images in a Dataset or Plate.\"\"\"\n dataset_id = request.GET.get('dataset')\n plate_id = request.GET.get('plate')\n field_id = request.GET.get('field')\n\n # ... get img_ids for container, then...\n\n if data_name == \"ROI_count\":\n # Want to get ROI count for images\n params = ParametersI()\n params.addIds(img_ids)\n query = \"select roi.image.id, count(roi.id) from Roi roi \"\\\n \"where roi.image.id in (:ids) group by roi.image\"\n p = query_service.projection(query, params, conn.SERVICE_OPTS)\n roi_counts = {}\n for i in p:\n roi_counts[i[0].val] = i[1].val\n return roi_counts\n\nRelease process\n---------------\n\nThis repository uses `bump2version <https://pypi.org/project/bump2version/>`_ to manage version numbers.\nTo tag a release run::\n\n $ bumpversion release\n\nThis will remove the ``.dev0`` suffix from the current version, commit, and tag the release.\n\nTo switch back to a development version run::\n\n $ bumpversion --no-tag [major|minor|patch]\n\nspecifying ``major``, ``minor`` or ``patch`` depending on whether the development branch will be a `major, minor or patch release <https://semver.org/>`_. This will also add the ``.dev0`` suffix.\n\nRemember to ``git push`` all commits and tags.\n\nLicense\n-------\n\nThis project, similar to many Open Microscopy Environment (OME) projects, is\nlicensed under the terms of the GNU General Public License (GPL) v2 or later.\n\nCopyright\n---------\n\n2019-2023, The Open Microscopy Environment\n\n\n",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "A Python plugin for OMERO.web",
"version": "0.2.4",
"project_urls": {
"Download": "https://github.com/ome/omero-parade/archive/v0.2.4.tar.gz",
"Homepage": "https://github.com/ome/omero-parade"
},
"split_keywords": [
"omero.web",
"parade"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "46944b1394f8947f053bfe03f8ab1f52dfc781c8dad3b83f5881edeecfa412cc",
"md5": "7215afc8530eefd0249df251b827ce05",
"sha256": "cf45cc92a80d796c28f1193c921690370b585de5941041d4bba73477da98de25"
},
"downloads": -1,
"filename": "omero_parade-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7215afc8530eefd0249df251b827ce05",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 293759,
"upload_time": "2023-06-23T09:42:52",
"upload_time_iso_8601": "2023-06-23T09:42:52.772415Z",
"url": "https://files.pythonhosted.org/packages/46/94/4b1394f8947f053bfe03f8ab1f52dfc781c8dad3b83f5881edeecfa412cc/omero_parade-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b512141fa996e47573010dc2f85317d85b3dc56304b791f192faed79cee5fbba",
"md5": "09017068a61c22b54ea7e00a7c68c28a",
"sha256": "79a51ff5a236b7cd22a699224533ffa8cef2625e74d4410839f351ded9390a17"
},
"downloads": -1,
"filename": "omero-parade-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "09017068a61c22b54ea7e00a7c68c28a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 280193,
"upload_time": "2023-06-23T09:42:54",
"upload_time_iso_8601": "2023-06-23T09:42:54.735537Z",
"url": "https://files.pythonhosted.org/packages/b5/12/141fa996e47573010dc2f85317d85b3dc56304b791f192faed79cee5fbba/omero-parade-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-23 09:42:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ome",
"github_project": "omero-parade",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "omero-parade"
}