We're Hiring!

A way to flip well coordinates during/after import

General user discussion about using the OMERO platform to its fullest. Please ask 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

There are workflow guides for various OMERO functions on our help site - http://help.openmicroscopy.org

You should find answers to any basic questions about using the clients there.

A way to flip well coordinates during/after import

Postby rguha » Tue Jun 26, 2012 2:23 pm

Hi, we have collected Incell images from a set of 1536 well plates on our robot, but due to a setup issue the well coordinates have been flipped in the output files - ie the XDCE file and the plate file names.

I have been able to import these plates successfully via the importer GUI and I can see the wells in their 'flipped' layout.

Is there a way during the import process (or after the import is done) that I could flip the well coordinates? Can this be solved by some sort of plugin that could hook into the import process?

I could go through the actual XDCE and image files and do the flip myself via a Python script, but was wondering if OME could handle this type of problem.

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

Re: A way to flip well coordinates during/after import

Postby cxallan » Wed Jun 27, 2012 8:24 am

There are currently no real extension points within the importer that would allow you to do this. Your options really are limited to modifying the XDCE file with a Python script or similar as you've already suggested or write an OMERO Python script that switches the Well coordinates after import.
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: A way to flip well coordinates during/after import

Postby rguha » Wed Jun 27, 2012 8:52 pm

Thanks for the suggestions. Are there any examples of OMERO Python scripts that I could work of of?
rguha
 
Posts: 16
Joined: Thu May 26, 2011 1:04 pm

Re: A way to flip well coordinates during/after import

Postby wmoore » Wed Jun 27, 2012 10:49 pm

If you look in the Insight or Web client, run a script Util_Scripts > Dataset_To_Plate, you will see how to create a plate from a series of images.

Demo Movie:
http://cvs.openmicroscopy.org.uk/snapsh ... -4.3.2.mov

You can access the script from the run-script dialog (bottom left of dialog - "View Script") or look at the code:
https://github.com/openmicroscopy/openm ... o_Plate.py


But really I think all you want to do is switch the column and row values on each well.
In fact, the code below almost does what you want:

Code: Select all
import omero.clients
from omero.gateway import BlitzGateway
from omero.rtypes import rint

user = 'root'
pw = 'ome'
host = 'localhost'

conn = BlitzGateway(user, pw, host=host, port=4064)
conn.connect()

pId = 57
plate = conn.getObject("Plate", pId)

wells = []
for well in plate.listChildren():
    c = well.column
    r = well.row
    print r, c
    well._obj.column = rint(r)
    well._obj.row = rint(c)
    wells.append(well._obj)

conn.getUpdateService().saveArray(wells)


The only problem is that the Save action generates a ValidationException since when you try to swap the position of 2 wells, you try to save one of them in position that is already occupied. It is not valid to have two wells in the same position in a Plate!

You may be able to get around this by first saving all the wells to vacant position E.g. column = 100+column, then placing them back in the desired location. I'll try and think of a nicer solution....!
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: A way to flip well coordinates during/after import

Postby wmoore » Thu Jun 28, 2012 10:31 am

After a bit of discussion, it turns out that the DB will not allow a "nice" way of doing this, due to various constraints etc. Probably the best way to do it is to temporarily save the wells to a new Plate when switching their rows & columns. Then save them back to the original plate.

The complete script for doing this is at https://gist.github.com/3010541

If you want to allow users to run this from the clients, you can put this logic into an OMERO script (see Dataset_To_Plate.py above). If you get Data_Type as "Plate" instead of "Dataset", and use IDs to get the Plate ID, then the clients will auto-populate these when a Plate is selected and you run the script.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 1 guest