def __get_planned_liquid_transfers(self, step_container, transfer_type): # Create :class:`PlannedSampleDilution`s for dilution (requires # valid diluent), otherwise it creates # :class:`PlannedSampleTransfer`s. planned_liquid_transfers = [] for transfer_container in step_container.get_transfer_containers(): src_positions = transfer_container.get_source_positions() trg_positions = transfer_container.get_target_positions() volume = float(transfer_container.volume) / VOLUME_CONVERSION_FACTOR if transfer_type == TRANSFER_TYPES.SAMPLE_DILUTION: diluent = transfer_container.diluent if diluent is None or not len(str(diluent)) > 1: msg = 'A diluent must be at least 2 characters long! ' \ 'Change the diluent for step %i code %s, ' \ 'please.' \ % (step_container.number, transfer_container.code) self.add_error(msg) return None for trg_pos_container in trg_positions: trg_pos = self._convert_to_rack_position(trg_pos_container) kw = dict(target_position=trg_pos, volume=volume) if transfer_type == TRANSFER_TYPES.SAMPLE_DILUTION: kw['diluent_info'] = str(transfer_container.diluent) psd = PlannedSampleDilution.get_entity(**kw) planned_liquid_transfers.append(psd) else: for src_pos_container in src_positions: src_pos = self._convert_to_rack_position( src_pos_container) kw['source_position'] = src_pos pst = PlannedSampleTransfer.get_entity(**kw) planned_liquid_transfers.append(pst) return planned_liquid_transfers
def _create_planned_liquid_transfers(self): """ Generates the planned container dilutions for the worklist. """ self.add_debug('Generate planned container dilutions ...') invalid_dil_factor = dict() for rack_pos, tf_pos in self.transfection_layout.iterpositions(): if tf_pos.is_empty: continue dil_volume = tf_pos.calculate_reagent_dilution_volume() \ / VOLUME_CONVERSION_FACTOR ini_dil_factor = TransfectionParameters.\ calculate_initial_reagent_dilution( float(tf_pos.reagent_dil_factor)) if ini_dil_factor <= 1: add_list_map_element(invalid_dil_factor, tf_pos.reagent_dil_factor, rack_pos.label) continue rdf_str = get_trimmed_string(tf_pos.reagent_dil_factor) diluent_info = '%s (%s)' % (tf_pos.reagent_name, rdf_str) psd = PlannedSampleDilution.get_entity(volume=dil_volume, target_position=rack_pos, diluent_info=diluent_info) self._add_planned_transfer(psd) if len(invalid_dil_factor) > 0: msg = 'Invalid dilution reagent factor for rack positions: %s. ' \ 'The factor would result in an initial dilution factor of ' \ 'less then 1!' % (self._get_joined_map_str(invalid_dil_factor)) self.add_error(msg)
def _create_planned_sample_dilution(self, **kw): if not 'volume' in kw: kw['volume'] = 0.000020 if not 'target_position' in kw: kw['target_position'] = self._get_entity(IRackPosition) if not 'diluent_info' in kw: kw['diluent_info'] = 'generic_buffer' return PlannedSampleDilution.get_entity(**kw)
def __create_buffer_worklist(self, sector_layout, buffer_volume, label): # Creates the buffer dilution worklist for a particular quadrant # and adds it to the worklist series. volume = buffer_volume / VOLUME_CONVERSION_FACTOR ptfs = [] for rack_pos_96 in sector_layout.get_positions(): planned_transfer = PlannedSampleDilution.get_entity(volume, self.DILUTION_INFO, rack_pos_96) ptfs.append(planned_transfer) worklist = PlannedWorklist( label, TRANSFER_TYPES.SAMPLE_DILUTION, get_pipetting_specs_biomek(), planned_liquid_transfers=ptfs ) self.__worklist_series.add_worklist(self.__last_worklist_index, worklist) self.__last_worklist_index += 1
def _create_planned_liquid_transfers(self): """ Generates the planned container dilution for the worklist. """ self.add_debug('Generate planned container dilutions ...') for rack_pos, tf_pos in self.transfection_layout.iterpositions(): if tf_pos.is_empty: continue volume = self.__determine_volume(tf_pos) / VOLUME_CONVERSION_FACTOR target_position = rack_pos psd = PlannedSampleDilution.get_entity(volume=volume, target_position=target_position, diluent_info=self.DILUENT_INFO) self._add_planned_transfer(psd)
def _create_planned_liquid_transfers(self): """ Generates the planned container dilution for the worklist. """ self.add_debug('Generate planned container dilutions ...') for rack_pos, tf_pos in self.transfection_layout.iterpositions(): if tf_pos.is_empty: continue volume = self.__determine_volume(tf_pos) / VOLUME_CONVERSION_FACTOR target_position = rack_pos psd = PlannedSampleDilution.get_entity( volume=volume, target_position=target_position, diluent_info=self.DILUENT_INFO) self._add_planned_transfer(psd)
def _create_planned_liquid_transfers(self): """ Generates the planned container dilutions for the worklist. """ self.add_debug('Generate planned container dilutions ...') volume = TransfectionParameters.TRANSFER_VOLUME * \ (TransfectionParameters.CELL_DILUTION_FACTOR - 1) \ / VOLUME_CONVERSION_FACTOR for tf_pos in self.transfection_layout.working_positions(): if tf_pos.is_empty: continue for target_pos in tf_pos.cell_plate_positions: psd = PlannedSampleDilution.get_entity(volume=volume, target_position=target_pos, diluent_info=self.DILUENT_INFO) self._add_planned_transfer(psd)
def _create_planned_liquid_transfers(self): """ Generates the planned container dilutions for the worklist. """ self.add_debug('Generate planned container dilutions ...') volume = TransfectionParameters.TRANSFER_VOLUME * \ (TransfectionParameters.CELL_DILUTION_FACTOR - 1) \ / VOLUME_CONVERSION_FACTOR for tf_pos in self.transfection_layout.working_positions(): if tf_pos.is_empty: continue for target_pos in tf_pos.cell_plate_positions: psd = PlannedSampleDilution.get_entity( volume=volume, target_position=target_pos, diluent_info=self.DILUENT_INFO) self._add_planned_transfer(psd)
def __create_buffer_worklist(self, sector_layout, buffer_volume, label): # Creates the buffer dilution worklist for a particular quadrant # and adds it to the worklist series. volume = buffer_volume / VOLUME_CONVERSION_FACTOR ptfs = [] for rack_pos_96 in sector_layout.get_positions(): planned_transfer = PlannedSampleDilution.get_entity( volume, self.DILUTION_INFO, rack_pos_96) ptfs.append(planned_transfer) worklist = PlannedWorklist(label, TRANSFER_TYPES.SAMPLE_DILUTION, get_pipetting_specs_biomek(), planned_liquid_transfers=ptfs) self.__worklist_series.add_worklist(self.__last_worklist_index, worklist) self.__last_worklist_index += 1
def __create_transfers(self): # Creates a :class:`PlannedSampleDilution` for each rack position # in a 8x12 rack shape. self.add_debug('Create transfers ...') self._run_and_record_error(self.volume_calculator.calculate, 'Error when trying to determine buffer volume: ', ValueError) buffer_volume = self.volume_calculator.get_buffer_volume() if buffer_volume is not None: volume = buffer_volume / VOLUME_CONVERSION_FACTOR wl_label = LABELS.create_buffer_worklist_label( self.iso_request_label) wl = PlannedWorklist(wl_label, TRANSFER_TYPES.SAMPLE_DILUTION, get_pipetting_specs_cybio()) for rack_pos in get_positions_for_shape(RACK_SHAPE_NAMES.SHAPE_96): psd = PlannedSampleDilution.get_entity(volume=volume, target_position=rack_pos, diluent_info=DILUENT_INFO) wl.planned_liquid_transfers.append(psd) self.__worklist_series.add_worklist(self.BUFFER_WORKLIST_INDEX, wl)
def __create_transfers(self): # Creates a :class:`PlannedSampleDilution` for each rack position # in a 8x12 rack shape. self.add_debug('Create transfers ...') self._run_and_record_error( self.volume_calculator.calculate, 'Error when trying to determine buffer volume: ', ValueError) buffer_volume = self.volume_calculator.get_buffer_volume() if buffer_volume is not None: volume = buffer_volume / VOLUME_CONVERSION_FACTOR wl_label = LABELS.create_buffer_worklist_label( self.iso_request_label) wl = PlannedWorklist(wl_label, TRANSFER_TYPES.SAMPLE_DILUTION, get_pipetting_specs_cybio()) for rack_pos in get_positions_for_shape(RACK_SHAPE_NAMES.SHAPE_96): psd = PlannedSampleDilution.get_entity( volume=volume, target_position=rack_pos, diluent_info=DILUENT_INFO) wl.planned_liquid_transfers.append(psd) self.__worklist_series.add_worklist(self.BUFFER_WORKLIST_INDEX, wl)
def __create_buffer_worklist(self, quadrant_layout, buffer_volume, label, sector_index): # Creates buffer dilutions worklist for a particular quadrant # and adds it to the worklist series. volume = buffer_volume / VOLUME_CONVERSION_FACTOR planned_transfers = [] translator = RackSectorTranslator( number_sectors=NUMBER_SECTORS, source_sector_index=sector_index, target_sector_index=0, enforce_type=RackSectorTranslator.ONE_TO_MANY) for rack_pos_384 in quadrant_layout.get_positions(): rack_pos_96 = translator.translate(rack_pos_384) planned_transfer = PlannedSampleDilution.get_entity( volume, self.DILUTION_INFO, rack_pos_96) planned_transfers.append(planned_transfer) worklist = PlannedWorklist(label=label, planned_transfers=planned_transfers) self.__last_worklist_index += 1 self.__worklist_series.add_worklist(self.__last_worklist_index, worklist)