Ejemplo n.º 1
0
 def test_iter(self):
     obs = PlateConfiguration.iter()
     self.assertIsInstance(obs, GeneratorType)
     obs = list(obs)
     # Since we can't ensure the test order between this test and
     # test_create, we check both lengths, but we only check the content
     # of the first 5 elements
     self.assertIn(len(obs), [5, 6])
     exp = [PlateConfiguration(1), PlateConfiguration(2),
            PlateConfiguration(3), PlateConfiguration(4),
            PlateConfiguration(5)]
     self.assertEqual(obs[:5], exp)
Ejemplo n.º 2
0
def plate_map_handler_get_request(plate_id):
    process_id = None
    if plate_id is not None:
        plate = _get_plate(plate_id)
        # Access the first well to get the process id - all wells have the same
        well = plate.get_well(1, 1)
        process_id = well.latest_process.id

    plate_confs = [[pc.id, pc.description, pc.num_rows, pc.num_columns]
                   for pc in PlateConfiguration.iter()]
    return {'plate_confs': plate_confs, 'plate_id': plate_id,
            'process_id': process_id}
Ejemplo n.º 3
0
def plate_map_handler_get_request(process_id):
    plate_id = None
    if process_id is not None:
        try:
            process = SamplePlatingProcess(process_id)
        except LabmanUnknownIdError:
            raise HTTPError(404, reason="Plating process %s doesn't exist"
                            % process_id)
        plate_id = process.plate.id

    plate_confs = [[pc.id, pc.description, pc.num_rows, pc.num_columns]
                   for pc in PlateConfiguration.iter()
                   if 'template' not in pc.description]
    return {'plate_confs': plate_confs, 'plate_id': plate_id,
            'process_id': process_id}
Ejemplo n.º 4
0
def get_target_plate_configuration(is_96):
    plate_configs = list(PlateConfiguration.iter())
    plate_config = None

    if is_96:
        target = '96-well deep-well plate'
    else:
        target = '384-well microtiter plate'

    for pc in plate_configs:
        if pc.description == target:
            plate_config = pc
            break

    if plate_config is None:
        raise ValueError("Unable to identify a plate of type: %s" % target)

    return plate_config