Page 1 of 1

JSON-API/IDR-API - searching multiple OMERO on annotation

PostPosted: Tue May 07, 2019 1:13 pm
by KenHo
Dear all (but more specifically probably Will),

Trying to find a way to combine searching multiple OMERO instances specifically on annotations.
The approach is to use currently available JSON-API to do the search.

As the API was written natively in Python/Django and not using any API frameworks, it seems that it doesn't provide services to search for specific strings.

The API that are being used are mainly based on the following 2 documents:
https://idr.openmicroscopy.org/about/api.html
https://docs.openmicroscopy.org/omero/5 ... n-api.html

Examples of using the API through SSBD database can be found below.
List all the projects in OMERO
http://ssbd.qbic.riken.jp/image/webgateway/proj/list/
List the meta data of a project
http://ssbd.qbic.riken.jp/image/webclie ... &project=2
List all the dataset in a project
http://ssbd.qbic.riken.jp/image/webgate ... /children/
List all the images in a dataset
http://ssbd.qbic.riken.jp/image/webgate ... /children/
List the attributes of an image
http://ssbd.qbic.riken.jp/image/webclie ... mage=25021
Image link:
http://ssbd.qbic.riken.jp/image/webclie ... mage-25021
Image viewer link:
http://ssbd.qbic.riken.jp/image/webclie ... ail/25021/
Thumbnail:
http://ssbd.qbic.riken.jp/image/webclie ... ail/25021/

Given the above, in order to do the search, a list of projects is retrieved. By iterating through the list of projects, annotation data are retrieved and a list of key value pairs is created. Search is then done by searching through the key, value pairs. It is possible to extend this method to search for annotations within the datasets.
The main disadvantage of this approach is that it is not scalable when the list of projects and their attributes become large.

Here is the pilot code that I put together to test out the idea of searching multiple OMEROs (IDR and SSBD). It is written in iPython notebook with explanation. Great to hear any feedback from Will and others whether there is a better way to achieve this.

https://github.com/openssbd/CombineSear ... MERO.ipynb

Thanks in advance
Ken

Re: JSON-API/IDR-API - searching multiple OMERO on annotati

PostPosted: Wed May 08, 2019 12:39 pm
by wmoore
Hi Ken,

The approach you're taking is about the best available, given the limited scope of the currently available JSON APIs. One thing you can do to reduce the number of calls to load map annotations is to specify multiple objects in the same URL, for example: This gets the Map Annotations on all Screens and Projects in the IDR:

https://idr.openmicroscopy.org/webclien ... 2&screen=3

The webgateway/proj/list and other webgateway URLs you're using for listing Datasets and Images are now replaced by the /api/ JSON API, which gives you more data (owners, permissions etc), pagination details (e.g. total count) and options to filter by owner, group etc.
E.g. Projects by owner:
https://idr.openmicroscopy.org/api/v0/m ... s/?owner=2

Images in a Dataset with pagination:
https://idr.openmicroscopy.org/api/v0/m ... offset=200

One option for finding objects via Map-Annotations is the OMERO.mapr app: https://github.com/ome/omero-mapr. This is designed to work with Map Annotations linked to Images. E.g. to find Screens and Projects containing Images annotated with "gene" map annotation ("gene" is linked to a Map-Annotation name-space in the config) you can use:
http://idr.openmicroscopy.org/mapr/api/ ... lue=INCENP

However, this doesn't support Map Annotations linked to e.g. Projects, Datasets etc.
Since we don't yet offer any search functionality via the JSON API, you would have to use the OMERO Python API (via ICE).

Also, if you were to use the OMERO Python API, you can write queries to e.g. find Projects annotated with specific key-value pairs.

See an example I just created at https://gist.github.com/will-moore/d790 ... f8bea1c841

Regards,

Will.

Re: JSON-API/IDR-API - searching multiple OMERO on annotati

PostPosted: Thu May 09, 2019 6:02 am
by KenHo
Thanks Will for the valuable comments and suggestions.

I shall look into them. Yes, I think mapr may well be a better way forward and we are already planning to install that in SSBD in future releases.

Ken