def post(self):
        user = self.current_user
        plate_config_id = self.get_argument('plate_configuration')
        plate_ext_id = self.get_argument('plate_name')

        spp = SamplePlatingProcess.create(user,
                                          PlateConfiguration(plate_config_id),
                                          plate_ext_id)

        self.write({'plate_id': spp.plate.id, 'process_id': spp.id})
Ejemplo n.º 2
0
def create_sample_plate_process(user, samples, is_96):
    plate_config = get_target_plate_configuration(is_96)
    num_rows = plate_config.num_rows
    num_cols = plate_config.num_columns
    sp_process = SamplePlatingProcess.create(user, plate_config,
                                             'Test plate %s' % datetime.now())

    # Plate the samples
    for idx, sample in enumerate(samples):
        i = int(idx / num_cols) + 1
        j = (idx % num_cols) + 1

        # Make sure that the user didn't pass more samples than wells
        if i > num_rows:
            break

        sp_process.update_well(i, j, sample)

    sample_plate = sp_process.plate
    return sp_process, sample_plate
Ejemplo n.º 3
0
    def test_get_previously_plated_wells(self):
        tester = Plate(21)
        three_plates_list = [Plate(27), Plate(30), Plate(33)]
        exp = {
            Well(3073): three_plates_list,
            Well(3079): three_plates_list,
            Well(3085): three_plates_list,
            Well(3091): three_plates_list,
            Well(3097): three_plates_list,
            Well(3103): three_plates_list,
            Well(3121): three_plates_list,
            Well(3127): three_plates_list,
            Well(3133): three_plates_list,
            Well(3139): three_plates_list,
            Well(3145): three_plates_list,
            Well(3151): three_plates_list,
            Well(3169): three_plates_list,
            Well(3175): three_plates_list,
            Well(3181): three_plates_list,
            Well(3187): three_plates_list,
            Well(3193): three_plates_list,
            Well(3199): three_plates_list,
            Well(3217): three_plates_list,
            Well(3223): three_plates_list,
            Well(3229): three_plates_list,
            Well(3235): three_plates_list,
            Well(3241): three_plates_list,
            Well(3247): three_plates_list,
            Well(3265): three_plates_list,
            Well(3271): three_plates_list,
            Well(3277): three_plates_list,
            Well(3283): three_plates_list,
            Well(3289): three_plates_list,
            Well(3295): three_plates_list,
            Well(3313): three_plates_list,
            Well(3319): three_plates_list,
            Well(3325): three_plates_list,
            Well(3331): three_plates_list,
            Well(3337): three_plates_list,
            Well(3343): three_plates_list,
            Well(3361): three_plates_list,
            Well(3367): three_plates_list,
            Well(3373): three_plates_list,
            Well(3379): three_plates_list,
            Well(3385): three_plates_list,
            Well(3391): three_plates_list,
            Well(3409): three_plates_list,
            Well(3415): three_plates_list,
            Well(3421): three_plates_list,
            Well(3427): three_plates_list,
            Well(3433): three_plates_list,
            Well(3439): three_plates_list,
            Well(3457): three_plates_list,
            Well(3463): three_plates_list,
            Well(3469): three_plates_list,
            Well(3475): three_plates_list,
            Well(3481): three_plates_list,
            Well(3487): three_plates_list,
            Well(3505): three_plates_list,
            Well(3511): three_plates_list,
            Well(3517): three_plates_list,
            Well(3523): three_plates_list,
            Well(3529): three_plates_list,
            Well(3535): three_plates_list,
            Well(3553): three_plates_list,
            Well(3559): three_plates_list,
            Well(3565): three_plates_list,
            Well(3571): three_plates_list,
            Well(3577): three_plates_list,
            Well(3583): three_plates_list,
            Well(3601): three_plates_list,
            Well(3607): three_plates_list,
            Well(3613): three_plates_list,
            Well(3619): three_plates_list,
            Well(3625): three_plates_list
        }
        obs = tester.get_previously_plated_wells()
        self.assertEqual(obs, exp)

        # Create another plate and put a sample on it that isn't anywhere else
        spp = SamplePlatingProcess.create(User('*****@*****.**'),
                                          PlateConfiguration(1),
                                          'New Plate For Prev')
        spp.update_well(1, 1, '1.SKM1.640184')
        obs = spp.plate.get_previously_plated_wells()
        self.assertEqual(obs, {})