Esempio n. 1
0
    def __rename_final_plates(self, experiment_metadata):
        """
        Replaces the labels of the final plates by a new label derived from
        the plate set labels specified by the scientist. For ISO request
        that cannot contain more than one final plate (not regarding copies)
        the final plate label is equal to the ISO request label. Otherwise
        ISO number and aliquot number (in case of several plates per ISO),
        are added.
        Assumes the ISOs to be completed and the label of experiment metadata
        and ISO request to be different.
        """
        if len(self.__final_plates) == 1 and \
                              experiment_metadata.experiment_metadata_type_id \
                              in EXPERIMENT_SCENARIOS.ONE_PLATE_TYPES:
            for final_plates in self.__final_plates.values():
                final_plates[0].rack.label = self._iso_request.label

        else:
            for iso, final_plates in self.__final_plates.iteritems():
                if len(final_plates) == 1:
                    new_label = LABELS.create_final_plate_label(iso)
                    final_plates[0].rack.label = new_label
                else:
                    for container in final_plates:
                        values = LABELS.parse_rack_marker(container.rack_marker)
                        plate_num = None
                        if values.has_key(LABELS.MARKER_RACK_NUM):
                            plate_num = values[LABELS.MARKER_RACK_NUM]
                        new_label = LABELS.create_final_plate_label(iso,
                                                                    plate_num)
                        container.rack.label = new_label
Esempio n. 2
0
    def __rename_final_plates(self, experiment_metadata):
        """
        Replaces the labels of the final plates by a new label derived from
        the plate set labels specified by the scientist. For ISO request
        that cannot contain more than one final plate (not regarding copies)
        the final plate label is equal to the ISO request label. Otherwise
        ISO number and aliquot number (in case of several plates per ISO),
        are added.
        Assumes the ISOs to be completed and the label of experiment metadata
        and ISO request to be different.
        """
        if len(self.__final_plates) == 1 and \
                              experiment_metadata.experiment_metadata_type_id \
                              in EXPERIMENT_SCENARIOS.ONE_PLATE_TYPES:
            for final_plates in self.__final_plates.values():
                final_plates[0].rack.label = self._iso_request.label

        else:
            for iso, final_plates in self.__final_plates.iteritems():
                if len(final_plates) == 1:
                    new_label = LABELS.create_final_plate_label(iso)
                    final_plates[0].rack.label = new_label
                else:
                    for container in final_plates:
                        values = LABELS.parse_rack_marker(
                            container.rack_marker)
                        plate_num = None
                        if values.has_key(LABELS.MARKER_RACK_NUM):
                            plate_num = values[LABELS.MARKER_RACK_NUM]
                        new_label = LABELS.create_final_plate_label(
                            iso, plate_num)
                        container.rack.label = new_label
Esempio n. 3
0
    def _create_stock_rack_layouts(self):
        """
        Creates stock rack layout for each required rack (potential rack
        sector constraints are expected to be confirmed).
        The rack markers might not match the layout rack markers anymore
        but this does not matter, since further processing do not use the
        layout rack markers anymore.
        """
        marker_map = dict()
        for marker, rack_barcode in self._stock_rack_map.iteritems():
            marker_map[rack_barcode] = marker

        layouts = dict()

        used_rack_markers = set()
        for pool, container in self._stock_tube_containers.iteritems():
            tc = container.tube_candidate
            rack_barcode = tc.rack_barcode
            if marker_map.has_key(rack_barcode):
                rack_marker = marker_map[rack_barcode]
                if layouts.has_key(rack_barcode):
                    layout = layouts[rack_barcode]
                else:
                    layout = StockRackLayout()
                    layouts[rack_barcode] = layout
            else:
                rack_marker = container.stock_rack_marker
                if rack_marker in used_rack_markers:
                    nums = []
                    for marker in used_rack_markers:
                        value_parts = LABELS.parse_rack_marker(marker)
                        nums.append(value_parts[LABELS.MARKER_RACK_NUM])
                    new_num = max(nums) + 1
                    rack_marker = LABELS.create_rack_marker(LABELS.ROLE_STOCK,
                                                            new_num)
                marker_map[rack_barcode] = rack_marker
                layout = StockRackLayout()
                layouts[rack_barcode] = layout

            tts = []
            for plate_label, positions in container.plate_target_positions.\
                                          iteritems():
                if plate_label == LABELS.ROLE_FINAL:
                    trg_marker = plate_label
                else:
                    trg_marker = self._rack_containers[plate_label].rack_marker
                for plate_pos in positions:
                    tts.append(plate_pos.as_transfer_target(trg_marker))

            sr_pos = StockRackPosition(rack_position=tc.rack_position,
                                       molecule_design_pool=pool,
                                       tube_barcode=tc.tube_barcode,
                                       transfer_targets=tts)
            layout.add_position(sr_pos)

        for rack_barcode, marker in marker_map.iteritems():
            self._stock_rack_layouts[marker] = layouts[rack_barcode]
            if not self._stock_rack_map.has_key(marker):
                self._stock_rack_map[marker] = rack_barcode