Exemplo n.º 1
0
def get_library_plate(legacy_plate_name):
    """Get a library plate from a legacy library plate name."""
    legacy_plate_name = generate_library_plate_name(legacy_plate_name)

    try:
        return LibraryPlate.objects.get(id=legacy_plate_name)

    except ObjectDoesNotExist:
        raise ObjectDoesNotExist(get_missing_object_message(
            'LibraryPlate', id=legacy_plate_name))
Exemplo n.º 2
0
    def sync_library_plate_row(legacy_row, screen_stage=None,
                               number_of_wells=96):
        if len(legacy_row) > 1:
            plate_name = generate_ahringer_384_plate_name(legacy_row[0],
                                                          legacy_row[1])
        else:
            plate_name = generate_library_plate_name(legacy_row[0])

        new_plate = LibraryPlate(id=plate_name, screen_stage=screen_stage,
                                 number_of_wells=number_of_wells)

        return update_or_save_object(command, new_plate, recorded_plates,
                                     fields_to_compare)
Exemplo n.º 3
0
def _parse_gdoc_experiment_rows(rows, screen_stage, date, worms,
                                temperatures):
    """Parse the rows with new experiments."""
    all_new_plates = []
    all_new_wells = []

    for i, row in enumerate(rows):
        current_row_number = FIRST_EXP_ROW + i + 1  # gdoc 1-indexed
        library_plate_name = generate_library_plate_name(row[0])
        if not library_plate_name:
            raise ValueError('Library plate cannot be blank; see row {}'
                             .format(current_row_number))

        try:
            library_plate = LibraryPlate.objects.get(id=library_plate_name)
        except ObjectDoesNotExist:
            raise ValueError('Library Plate {} does not exist; see row {}'
                             .format(library_plate_name,
                                     current_row_number))

        for j, experiment_plate_id in enumerate(row[1:]):
            if not experiment_plate_id:
                continue

            # Do dry_run=True to save inserts for bulk queries at end
            plate, wells = ExperimentPlate.create_plate_and_wells(
                experiment_plate_id, screen_stage, date,
                temperatures[j], worms[j], library_plate, dry_run=True)

            all_new_plates.append(plate)
            all_new_wells.extend(wells)

    ExperimentPlate.objects.bulk_create(all_new_plates)
    Experiment.objects.bulk_create(all_new_wells)

    return len(all_new_plates)