def screen_plate_run_well(self): """ Returns a new OMERO Screen, linked Plate, linked Well, linked WellSample, linked Image populate by an L{test.integration.library.ITest} instance and linked PlateAcquisition with all required fields set. """ screen = ScreenI() screen.name = rstring(self.uuid()) plate = PlateI() plate.name = rstring(self.uuid()) # Well A10 (will have two WellSamples) well_a = WellI() well_a.row = rint(0) well_a.column = rint(9) # Well A11 (will not have a WellSample) well_b = WellI() well_b.row = rint(0) well_b.column = rint(10) ws_a = WellSampleI() image_a = self.new_image(name=self.uuid()) ws_a.image = image_a ws_b = WellSampleI() image_b = self.new_image(name=self.uuid()) ws_b.image = image_b plate_acquisition = PlateAcquisitionI() plate_acquisition.plate = plate ws_a.plateAcquisition = plate_acquisition ws_b.plateAcquisition = plate_acquisition well_a.addWellSample(ws_a) well_a.addWellSample(ws_b) plate.addWell(well_a) plate.addWell(well_b) screen.linkPlate(plate) return self.update.saveAndReturnObject(screen)
def screen_plates(self, user1): """Return Screen with Plates and an orphaned Plate.""" # Create and name all the objects screen = ScreenI() screen.name = rstring('screen') for i in range(5): plate1 = PlateI() plate1.name = rstring('Plate%s' % i) screen.linkPlate(plate1) # Create single orphaned Plate plate = PlateI() plate.name = rstring('plate') screen = get_update_service(user1).saveAndReturnObject(screen) plate = get_update_service(user1).saveAndReturnObject(plate) # Add well to first plate plates = screen.linkedPlateList() plates.sort(cmp_name_insensitive) plate_id = plates[0].id.val well = WellI() well.column = rint(0) well.row = rint(0) well.plate = PlateI(plate_id, False) image = self.create_test_image(size_x=5, size_y=5, session=user1[0].getSession()) ws = WellSampleI() ws.image = ImageI(image.id, False) ws.well = well well.addWellSample(ws) well = get_update_service(user1).saveAndReturnObject(well) return screen, plate
def screen_plate_run_well(request, itest, update_service): """ Returns a new OMERO Screen, linked Plate, linked Well, linked WellSample, linked Image populate by an L{test.integration.library.ITest} instance and linked PlateAcquisition with all required fields set. """ screen = ScreenI() screen.name = rstring(itest.uuid()) plate = PlateI() plate.name = rstring(itest.uuid()) # Well A10 (will have two WellSamples) well_a = WellI() well_a.row = rint(0) well_a.column = rint(9) # Well A11 (will not have a WellSample) well_b = WellI() well_b.row = rint(0) well_b.column = rint(10) ws_a = WellSampleI() image_a = itest.new_image(name=itest.uuid()) ws_a.image = image_a ws_b = WellSampleI() image_b = itest.new_image(name=itest.uuid()) ws_b.image = image_b plate_acquisition = PlateAcquisitionI() plate_acquisition.plate = plate ws_a.plateAcquisition = plate_acquisition ws_b.plateAcquisition = plate_acquisition well_a.addWellSample(ws_a) well_a.addWellSample(ws_b) plate.addWell(well_a) plate.addWell(well_b) screen.linkPlate(plate) return update_service.saveAndReturnObject(screen)
def screen_plate(request, itest, update_service): """ Returns a new OMERO Screen and linked Plate with required fields set. """ screen = ScreenI() screen.name = rstring(itest.uuid()) plate = PlateI() plate.name = rstring(itest.uuid()) screen.linkPlate(plate) return update_service.saveAndReturnObject(screen)
def screen_plate(self): """ Returns a new OMERO Screen and linked Plate with required fields set. """ screen = ScreenI() screen.name = rstring(self.uuid()) plate = PlateI() plate.name = rstring(self.uuid()) screen.linkPlate(plate) return self.update.saveAndReturnObject(screen)
def screen_plate_run(self): """ Returns a new OMERO Screen, linked Plate, and linked PlateAcquisition with all required fields set. """ screen = ScreenI() screen.name = rstring(self.uuid()) plate = PlateI() plate.name = rstring(self.uuid()) plate_acquisition = PlateAcquisitionI() plate.addPlateAcquisition(plate_acquisition) screen.linkPlate(plate) return self.update.saveAndReturnObject(screen)
def screen_plate_run(request, itest, update_service): """ Returns a new OMERO Screen, linked Plate, and linked PlateAcquisition with all required fields set. """ screen = ScreenI() screen.name = rstring(itest.uuid()) plate = PlateI() plate.name = rstring(itest.uuid()) plate_acquisition = PlateAcquisitionI() plate.addPlateAcquisition(plate_acquisition) screen.linkPlate(plate) return update_service.saveAndReturnObject(screen)
def create_screen(self, row_count, col_count): # TODO: remove 5.2 vs 5.3 compatibility try: plate = self.importPlates(plateRows=row_count, plateCols=col_count)[0] except AttributeError: plate = self.import_plates(plate_rows=row_count, plate_cols=col_count)[0] plate = self.set_name(plate, "Plate001") screen = ScreenI() screen.name = rstring("Screen001") screen.linkPlate(plate.proxy()) return (self.client.sf.getUpdateService().saveAndReturnObject(screen), plate)
def create_screen(self, row_count, col_count): # TODO: remove 5.2 vs 5.3 compatibility try: plate = self.importPlates(plateRows=row_count, plateCols=col_count)[0] except AttributeError: plate = self.import_plates(plateRows=row_count, plateCols=col_count)[0] plate = self.set_name(plate, "Plate001") screen = ScreenI() screen.name = rstring("Screen001") screen.linkPlate(plate.proxy()) return (self.client.sf.getUpdateService().saveAndReturnObject(screen), plate)
def testChgrp11109(self): """ Place a plate in a single screen and attempt to move it. """ # One user in two groups client, user = self.new_client_and_user(perms=PRIVATE) admin = client.sf.getAdminService() target_grp = self.new_group([user], perms=PRIVATE) target_gid = target_grp.id.val admin.getEventContext() # Refresh update = client.sf.getUpdateService() plate = PlateI() plate.name = rstring("testChgrp11109") screen = ScreenI() screen.name = rstring("testChgrp11109") link = screen.linkPlate(plate) link = update.saveAndReturnObject(link) # Now chgrp, should succeed chgrp = Chgrp2( targetObjects={"Plate": [link.child.id.val]}, groupId=target_gid) self.doSubmit(chgrp, client) # Check that the links have been destroyed query = client.sf.getQueryService() with pytest.raises(omero.ValidationException): query.get("ScreenPlateLink", link.id.val, {"omero.group": "-1"})
def screen_plate_well(request, itest, update_service): """ Returns a new OMERO Screen, linked Plate and linked Well with required fields set. """ screen = ScreenI() screen.name = rstring(itest.uuid()) plate = PlateI() plate.name = rstring(itest.uuid()) # Well A10 well = WellI() well.row = rint(0) well.column = rint(9) plate.addWell(well) screen.linkPlate(plate) return update_service.saveAndReturnObject(screen)
def screen_plate_well(self): """ Returns a new OMERO Screen, linked Plate and linked Well with required fields set. """ screen = ScreenI() screen.name = rstring(self.uuid()) plate = PlateI() plate.name = rstring(self.uuid()) # Well A10 well = WellI() well.row = rint(0) well.column = rint(9) plate.addWell(well) screen.linkPlate(plate) return self.update.saveAndReturnObject(screen)
def testChgrp11109(self): """ Place a plate in a single screen and attempt to move it. """ # One user in two groups client, user = self.new_client_and_user(perms=PRIVATE) admin = client.sf.getAdminService() target_grp = self.new_group([user], perms=PRIVATE) target_gid = target_grp.id.val admin.getEventContext() # Refresh update = client.sf.getUpdateService() plate = PlateI() plate.name = rstring("testChgrp11109") screen = ScreenI() screen.name = rstring("testChgrp11109") link = screen.linkPlate(plate) link = update.saveAndReturnObject(link) # Now chgrp, should succeed chgrp = Chgrp2(targetObjects={"Plate": [link.child.id.val]}, groupId=target_gid) self.doSubmit(chgrp, client) # Check that the links have been destroyed query = client.sf.getQueryService() with pytest.raises(omero.ValidationException): query.get("ScreenPlateLink", link.id.val, {"omero.group": "-1"})
def plates_runs(request, itest, update_service, names): """ Returns a four new Plates, and two linked PlateAcquisitions with required fields set and with names that can be used to exercise sorting semantics. """ plates = [PlateI(), PlateI(), PlateI(), PlateI()] for index, plate in enumerate(plates): plate.name = rstring(names[index]) plate_acquisitions = [PlateAcquisitionI(), PlateAcquisitionI()] for plate_acquisition in plate_acquisitions: plate.addPlateAcquisition(plate_acquisition) # Non-orphaned Plate to catch issues with queries where non-orphaned # plates are included in the results. screen = ScreenI() screen.name = rstring(itest.uuid()) plate = PlateI() plate.name = rstring(itest.uuid()) screen.linkPlate(plate) update_service.saveAndReturnObject(screen) return update_service.saveAndReturnArray(plates)
def testListParentsSPW(self): """Test listParents() for Image in WellSample""" client, exp = self.new_client_and_user() conn = BlitzGateway(client_obj=client) # setup SPW-WS-Img... s = ScreenI() s.name = wrap('ScreenA') p = PlateI() p.name = wrap('PlateA') s.linkPlate(p) w = WellI() w.column = wrap(0) w.row = wrap(0) p.addWell(w) s = client.sf.getUpdateService().saveAndReturnObject(s) p = s.linkedPlateList()[0] w = p.copyWells()[0] i = self.make_image(name="SPW listParents", client=client) ws = WellSampleI() ws.image = i ws.well = WellI(w.id.val, False) w.addWellSample(ws) ws = client.sf.getUpdateService().saveAndReturnObject(ws) # Traverse from Image -> Screen image = conn.getObject("Image", i.id.val) wellSample = image.listParents()[0] well = wellSample.listParents()[0] assert well.id == w.id.val plate = well.listParents()[0] assert plate.id == p.id.val screen = plate.listParents()[0] assert screen.id == s.id.val # Screen has no parent assert len(screen.listParents()) == 0