def __create_plate(self, rack_container, reservoir_specs): # Creates a new plate incl. label. The plate specs are derived # from the reservoir specs. # Creating of stock racks is not allowed. try: plate_specs = get_rack_specs_from_reservoir_specs(reservoir_specs) except ValueError as ve: msg = 'Error when trying to determine plate specs for rack "%s": ' \ '%s.' % (rack_container.identifier, ve) self.add_error(msg) result = None else: rack_id = rack_container.identifier plate_label = '%s_%s' % (self.parser.worklist_prefix, rack_id) if len(plate_label) > MAX_PLATE_LABEL_LENGTH: msg = 'The label that has been generated for the new plate ' \ '"%s" ("%s") is longer than %i characters (%i ' \ 'characters). You will not be able to print this ' \ 'label properly. To circumvent this problem choose ' \ 'a shorter rack identifier or a shorter worklist ' \ 'prefix.' \ % (rack_id, plate_label, MAX_PLATE_LABEL_LENGTH, len(plate_label)) self.add_warning(msg) result = plate_specs.create_rack(label=plate_label, status=get_item_status_future()) return result
def _populate_iso(self, iso, layout): StockSampleCreationIsoPopulator._populate_iso(self, iso, layout) # Create sector preparation plates. library_name = self.iso_request.label ir_specs_96 = get_reservoir_specs_standard_96() plate_specs_96 = get_rack_specs_from_reservoir_specs(ir_specs_96) ir_specs_384 = get_reservoir_specs_standard_384() plate_specs_384 = get_rack_specs_from_reservoir_specs(ir_specs_384) future_status = get_item_status_future() sec_layout_map = get_sector_layouts_for_384_layout(layout) # Create preparation plates. for sec_idx in range(NUMBER_SECTORS): if not sec_idx in sec_layout_map: continue # TODO: Move label creation to LABELS class. prep_label = self.PREP_PLATE_LABEL_PATTERN \ % (library_name, iso.layout_number, DEFAULT_PREPARATION_PLATE_CONCENTRATION, sec_idx + 1) prep_plate = plate_specs_96.create_rack(prep_label, future_status) sec_layout = sec_layout_map[sec_idx] iso.add_sector_preparation_plate(prep_plate, sec_idx, sec_layout.create_rack_layout()) # Create aliquot plates. for i in range(self.iso_request.number_aliquots): # TODO: Move label creation to LABELS class. aliquot_label = self.ALIQUOT_PLATE_LABEL_PATTERN \ % (library_name, iso.layout_number, DEFAULT_ALIQUOT_PLATE_CONCENTRATION, i + 1) aliquot_plate = plate_specs_384.create_rack(aliquot_label, future_status) iso.add_aliquot_plate(aliquot_plate)
def run(self): sess = ScopedSessionMaker() for bc in self.__barcodes: rack = self.__get_rack(bc) for src_cnt in itervalues_(rack.container_positions): if not src_cnt is None: if not src_cnt.sample is None: sess.delete(src_cnt.sample) rack.status = get_item_status_future()
def __populate_isos(self): """ Adds molecule design set, library layout and plates to the picked ISOs. """ self.add_debug('Create ISOs ...') ir_specs_96 = get_reservoir_specs_standard_96() plate_specs_96 = get_rack_specs_from_reservoir_specs(ir_specs_96) ir_specs_384 = get_reservoir_specs_standard_384() plate_specs_384 = get_rack_specs_from_reservoir_specs(ir_specs_384) future_status = get_item_status_future() library_name = self._iso_request.plate_set_label md_type = \ self.molecule_design_library.molecule_design_pool_set.molecule_type while len(self.__picked_isos) > 0: lci = self.__picked_isos.pop(0) library_layout = self._library_layouts.pop(0) lci.rack_layout = library_layout.create_rack_layout() lci.molecule_design_pool_set = \ library_layout.get_pool_set(md_type) layout_number = lci.layout_number # create source plates for sector_index in self._quadrant_positions.keys(): prep_label = self.PREP_PLATE_LABEL_PATTERN % ( library_name, layout_number, PREPARATION_PLATE_CONCENTRATION, (sector_index + 1)) prep_plate = plate_specs_96.create_rack(label=prep_label, status=future_status) LibrarySourcePlate(iso=lci, plate=prep_plate, sector_index=sector_index) # create aliquot plates for i in range(STARTING_NUMBER_ALIQUOTS): aliquot_label = self.ALIQUOT_PLATE_LABEL_PATTERN % ( library_name, layout_number, ALIQUOT_PLATE_CONCENTRATION, (i + 1)) aliquot_plate = plate_specs_384.create_rack( label=aliquot_label, status=future_status) IsoAliquotPlate(iso=lci, plate=aliquot_plate) self.__new_isos.append(lci)
def __populate_isos(self): """ Adds molecule design set, library layout and plates to the picked ISOs. """ self.add_debug('Create ISOs ...') ir_specs_96 = get_reservoir_specs_standard_96() plate_specs_96 = get_rack_specs_from_reservoir_specs(ir_specs_96) ir_specs_384 = get_reservoir_specs_standard_384() plate_specs_384 = get_rack_specs_from_reservoir_specs(ir_specs_384) future_status = get_item_status_future() library_name = self._iso_request.plate_set_label md_type = \ self.molecule_design_library.molecule_design_pool_set.molecule_type while len(self.__picked_isos) > 0: lci = self.__picked_isos.pop(0) library_layout = self._library_layouts.pop(0) lci.rack_layout = library_layout.create_rack_layout() lci.molecule_design_pool_set = \ library_layout.get_pool_set(md_type) layout_number = lci.layout_number # create source plates for sector_index in self._quadrant_positions.keys(): prep_label = self.PREP_PLATE_LABEL_PATTERN % (library_name, layout_number, PREPARATION_PLATE_CONCENTRATION, (sector_index + 1)) prep_plate = plate_specs_96.create_rack(label=prep_label, status=future_status) LibrarySourcePlate(iso=lci, plate=prep_plate, sector_index=sector_index) # create aliquot plates for i in range(STARTING_NUMBER_ALIQUOTS): aliquot_label = self.ALIQUOT_PLATE_LABEL_PATTERN % ( library_name, layout_number, ALIQUOT_PLATE_CONCENTRATION, (i + 1)) aliquot_plate = plate_specs_384.create_rack(label=aliquot_label, status=future_status) IsoAliquotPlate(iso=lci, plate=aliquot_plate) self.__new_isos.append(lci)