We're Hiring!

retrieving well data via Java API

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

retrieving well data via Java API

Postby rguha » Wed Jun 13, 2012 10:19 pm

I have some screens with plates loaded in on the server side. I am trying to write code that will list images for each of the plates in the screens. From the example at https://github.com/openmicroscopy/openm ... dData.java it appears that I must

1. retrieve ScreenData objects
2. given a ScreenData object I must then retrieve PlateData objects
3. retrieve WellData objects for a plate, via a direct SQL query

Is there no way to access well image data via something like

ParametersI pi = new ParametersI();
pi.leaves();
List<IObject> imageResults = proxy.loadContainerHierarchy(PlateData.class.getName(),
Arrays.asList(plate.getId()), param);

Will access to a WellData object let me access images associated with the well? or should I go about this in a different manner?

In general, are there any resources for a person new to the OME data model?
rguha
 
Posts: 16
Joined: Thu May 26, 2011 1:04 pm

Re: retrieving well data via Java API

Postby jburel » Thu Jun 14, 2012 9:31 am

Hi

The organisation of screening data is as follow
Screen-Plate-Plate Acquisition-Well-WellSample
i.e. a Plate can have several plate acquisition and wells obviously several fields (well samples in our model)
The image is linked to the well sample object.

1 & 2
To load all the screens/plates for a given user you can do the following
Code: Select all
ParametersI param = new ParametersI();
param.exp(omero.rtypes.rlong(userID));
param.orphan(); //to load the plate not in a screen
proxy.loadContainerHierarchy(Screen.class.getName(), null, param);       

The call above will return a collection of Screen or Plate (if orphan is set and plate not contained in a screen). The returned screen objects have the plates loaded, so you do not need another call to load the plates


To load a given plate or well, you specify the id of the screen/plate
e.g. for a plate (you code sample was not correct)
Code: Select all
proxy.loadContainerHierarchy(Plate.class.getName(), Arrays.asList(plate.getId()), param);   

Note that the param.leaves() option is not taken into account for screening data.
so the example above will return a Plate/Plate acquisition but no images.


3 To retrieve the Wells/Wells Samples/Images
Unfortunately, we have not added the method to the service so you will have to do the following
Code: Select all
ParametersI param = new ParametersI();
param.addLong("plateID", plateID);
sb = new StringBuilder();
sb.append("select well from Well as well ");
sb.append("left outer join fetch well.plate as pt ");
sb.append("left outer join fetch well.wellSamples as ws ");
sb.append("left outer join fetch ws.plateAcquisition as pa ");
sb.append("left outer join fetch ws.image as img ");
sb.append("left outer join fetch img.pixels as pix ");
sb.append("left outer join fetch pix.pixelsType as pt ");
sb.append("where well.plate.id = :plateID");
if (acquisitionID > 0) { //good if you have several plate acquisition linked to a plate
   sb.append(" and pa.id = :acquisitionID");
   param.addLong("acquisitionID", acquisitionID);
}
IQueryPrx service;
List<IObject> wells = service.findAllByQuery(sb.toString(), param);


You can then access the well sample object from the well.

Hope it helps
Jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: retrieving well data via Java API

Postby rguha » Thu Jun 14, 2012 8:01 pm

Thanks for the reply. In general is there a way for me to query for a given plate name (or barcode, identifier etc) and directly access wells for that plate? As far as I can tell one must first identify the screen that the plate is contained in and then pull all plates for that screen and subsequently identify the relevant plate.

While it could be wrapped in a utility method, it does seem inefficient to have to pull a screen and all it's plate just to identify a single plate.

Any pointers would be appreciated

Thanks,
Rajarshi
rguha
 
Posts: 16
Joined: Thu May 26, 2011 1:04 pm

Re: retrieving well data via Java API

Postby jburel » Thu Jun 14, 2012 9:02 pm

You can use the Query service to look for a specific plate using whatever criteria you want e.g.
load the plate with a given name.
You could actually adjust the query (wells query) from the previous post and instead of specifying the id of the plate, you could specify the name of the plate.

Jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest