Example #1
0
File: models.py Project: katur/eegi
    def create_wells(self, worm_strain, library_plate, is_junk=False):
        """
        Returns the experiment wells that go with this experiment plate.

        Raises an exception if there are already experiment wells
        for this experiment plate in the database.

        Initializes each new well's worm, library stock, and junk
        according to the parameters passed in.
        """
        if Experiment.objects.filter(plate=self).exists():
            raise Exception('Experiments already exists for plate {}'
                            .format(self))

        stocks_by_well = library_plate.get_stocks_as_dictionary()
        new_experiment_wells = []

        for well in get_well_list():
            library_stock = stocks_by_well[well]

            new_experiment_wells.append(Experiment(
                id=generate_experiment_id(self.id, well),
                plate=self, well=well,
                worm_strain=worm_strain,
                library_stock=library_stock,
                is_junk=is_junk))

        return new_experiment_wells
Example #2
0
    def create_wells(self, worm_strain, library_plate, is_junk=False):
        """
        Returns the experiment wells that go with this experiment plate.

        Raises an exception if there are already experiment wells
        for this experiment plate in the database.

        Initializes each new well's worm, library stock, and junk
        according to the parameters passed in.
        """
        if Experiment.objects.filter(plate=self).exists():
            raise Exception(
                'Experiments already exists for plate {}'.format(self))

        stocks_by_well = library_plate.get_stocks_as_dictionary()
        new_experiment_wells = []

        for well in get_well_list():
            library_stock = stocks_by_well[well]

            new_experiment_wells.append(
                Experiment(id=generate_experiment_id(self.id, well),
                           plate=self,
                           well=well,
                           worm_strain=worm_strain,
                           library_stock=library_stock,
                           is_junk=is_junk))

        return new_experiment_wells
Example #3
0
    def sync_experiment_row(legacy_row):
        experiment_plate_id = legacy_row[0]
        worm_strain = get_worm_strain(legacy_row[1], legacy_row[2])
        legacy_library_plate_name = legacy_row[3]
        temperature = legacy_row[4]
        date = legacy_row[5]
        is_junk = legacy_row[6]
        comment = legacy_row[7]

        all_match = True

        if experiment_plate_id < 40000:
            screen_stage = 1
        else:
            screen_stage = 2

        new_plate = ExperimentPlate(
            id=experiment_plate_id,
            screen_stage=screen_stage,
            temperature=temperature,
            date=date,
            comment=comment)

        all_match &= update_or_save_object(
            command, new_plate, recorded_plates, plate_fields_to_compare)

        experiment_plate = get_experiment_plate(experiment_plate_id)

        for well in get_well_list():
            new_well = Experiment(
                id=generate_experiment_id(experiment_plate_id, well),
                plate=experiment_plate, well=well,
                worm_strain=worm_strain,
                library_stock=get_library_stock(
                    legacy_library_plate_name, well),
                is_junk=is_junk)

            all_match &= update_or_save_object(
                command, new_well, recorded_wells,
                well_fields_to_compare)

        return all_match
Example #4
0
    def sync_experiment_row(legacy_row):
        experiment_plate_id = legacy_row[0]
        worm_strain = get_worm_strain(legacy_row[1], legacy_row[2])
        legacy_library_plate_name = legacy_row[3]
        temperature = legacy_row[4]
        date = legacy_row[5]
        is_junk = legacy_row[6]
        comment = legacy_row[7]

        all_match = True

        if experiment_plate_id < 40000:
            screen_stage = 1
        else:
            screen_stage = 2

        new_plate = ExperimentPlate(id=experiment_plate_id,
                                    screen_stage=screen_stage,
                                    temperature=temperature,
                                    date=date,
                                    comment=comment)

        all_match &= update_or_save_object(command, new_plate, recorded_plates,
                                           plate_fields_to_compare)

        experiment_plate = get_experiment_plate(experiment_plate_id)

        for well in get_well_list():
            new_well = Experiment(
                id=generate_experiment_id(experiment_plate_id, well),
                plate=experiment_plate,
                well=well,
                worm_strain=worm_strain,
                library_stock=get_library_stock(legacy_library_plate_name,
                                                well),
                is_junk=is_junk)

            all_match &= update_or_save_object(command, new_well,
                                               recorded_wells,
                                               well_fields_to_compare)

        return all_match