Exemple #1
0
    def sync_secondary_L4440_row(legacy_row):
        plate_name = legacy_row[0]
        well = get_three_character_well(legacy_row[1])

        new_well = LibraryStock(
            id=generate_library_stock_name(plate_name, well),
            plate=get_library_plate(plate_name), well=well,
            parent_stock=None, intended_clone=get_clone('L4440'))

        return update_or_save_object(command, new_well, recorded_wells,
                                     fields_to_compare)
Exemple #2
0
    def sync_primary_row(legacy_row):
        plate_name = legacy_row[0]
        well = get_three_character_well(legacy_row[1])
        clone_name = legacy_row[2]
        parent_plate_name = legacy_row[4]

        if re.match('sjj', clone_name):
            parent_chromosome = legacy_row[3]
            parent_plate_name = generate_ahringer_384_plate_name(
                parent_chromosome, parent_plate_name)
        parent_well_improper = legacy_row[5]
        if re.match('mv', clone_name):
            clone_name = generate_vidal_clone_name(parent_plate_name,
                                                   parent_well_improper)

        intended_clone = get_clone(clone_name)

        if re.match('L4440', clone_name):
            parent_stock = None

        else:
            parent_well_proper = get_three_character_well(parent_well_improper)
            parent_stock = get_library_stock(parent_plate_name,
                                             parent_well_proper)

            # Confirm that this intended clone matches parent's clone
            if parent_stock.intended_clone != intended_clone:
                raise CommandError('Clone {} does not match parent\n'
                                   .format(clone_name))

        new_well = LibraryStock(
            id=generate_library_stock_name(plate_name, well),
            plate=get_library_plate(plate_name), well=well,
            parent_stock=parent_stock,
            intended_clone=intended_clone)

        return update_or_save_object(command, new_well, recorded_wells,
                                     fields_to_compare)
Exemple #3
0
    def sync_source_row(legacy_row):
        plate_name = legacy_row[0]
        clone_name = legacy_row[3]

        if re.match('sjj', clone_name):
            chromosome = legacy_row[2]
            plate_name = generate_ahringer_384_plate_name(
                chromosome, plate_name)

        well_improper = legacy_row[1]
        well_proper = get_three_character_well(well_improper)

        if re.match('mv', clone_name):
            clone_name = generate_vidal_clone_name(plate_name,
                                                   well_improper)

        new_well = LibraryStock(
            id=generate_library_stock_name(plate_name, well_proper),
            plate=get_library_plate(plate_name), well=well_proper,
            parent_stock=None, intended_clone=get_clone(clone_name))

        return update_or_save_object(command, new_well, recorded_wells,
                                     fields_to_compare)
Exemple #4
0
    def sync_secondary_row(legacy_row):
        plate_name = legacy_row[0]
        well = get_three_character_well(legacy_row[1])
        clone_name = legacy_row[2]

        definite_parent_plate_name = legacy_row[3]
        definite_parent_well = legacy_row[4]
        if definite_parent_well:
            definite_parent_well = get_three_character_well(
                definite_parent_well)

        likely_parent_plate_name = legacy_row[5]
        likely_parent_well = legacy_row[6]
        if likely_parent_well:
            likely_parent_well = get_three_character_well(likely_parent_well)

        likely_parent_clone_name = legacy_row[7]

        if (definite_parent_plate_name and likely_parent_plate_name and
                definite_parent_plate_name != likely_parent_plate_name):
            raise CommandError(
                'ERROR: definite and likely parent plates disagree '
                'for {} {}\n'.format(plate_name, well))

        if (definite_parent_well and likely_parent_well and
                definite_parent_well != likely_parent_well):
            raise CommandError(
                'ERROR: definite and likely parent wells disagree '
                'for {} {}\n'.format(plate_name, well))

        try:
            if definite_parent_plate_name and definite_parent_well:
                parent_stock = get_library_stock(definite_parent_plate_name,
                                                 definite_parent_well)

            else:
                parent_stock = get_library_stock(likely_parent_plate_name,
                                                 likely_parent_well)

            intended_clone = parent_stock.intended_clone

        except ObjectDoesNotExist:
            command.stderr.write(
                'WARNING for LibraryStock {} {}: parent not '
                'found in LibraryStock\n'.format(plate_name, well))

            parent_stock = None
            intended_clone = None

        if clone_name and (clone_name != likely_parent_clone_name):
            command.stderr.write(
                'WARNING for LibraryStock {} {}: clone recorded '
                'in CherryPickRNAiPlate is inconsistent with '
                'CherryPickTemplate source/destination records\n'
                .format(plate_name, well))

        if re.match('sjj', clone_name):
            try:
                recorded_clone = get_clone(clone_name)
                if recorded_clone != intended_clone:
                    command.stderr.write(
                        'WARNING for LibraryStock {} {}: clone recorded '
                        'in CherryPickRNAiPlate does not match its '
                        'parent\'s clone\n'.format(plate_name, well))

            except ObjectDoesNotExist:
                command.stderr.write(
                    'WARNING for LibraryStock {} {}: clone recorded in '
                    'CherryPickRNAiPlate not found at all in RNAiPlate\n'
                    .format(plate_name, well))

        new_well = LibraryStock(
            id=generate_library_stock_name(plate_name, well),
            plate=get_library_plate(plate_name), well=well,
            parent_stock=parent_stock,
            intended_clone=intended_clone)

        return update_or_save_object(command, new_well, recorded_wells,
                                     fields_to_compare)