def __calculate_single_stock_transfer_volume(self): # Determines the volume that has to be transferred from a single design # stock tube to a future pool stock tube (for the given volume, # concentration, and number of designs). The target volume might # be increased if the resulting single design transfer volume has # more than 1 decimal place. # :raises ValueErrors: if something the values are not compatible target_single_conc = float(self.__target_concentration) \ / self.__number_designs if target_single_conc > self.__stock_concentration: msg = 'The requested target concentration (%i nM) cannot be ' \ 'achieved since it would require a concentration of %s nM ' \ 'for each single design in the pool. However, the stock ' \ 'concentration for this design type is only %s nM.' \ % (self.__target_concentration, get_trimmed_string(target_single_conc), get_trimmed_string(self.__stock_concentration)) raise ValueError(msg) dil_factor = self.__stock_concentration / target_single_conc min_target_volume = round_up(dil_factor * self.__min_cybio_transfer_vol) if (min_target_volume > self.__target_volume): msg = 'The target volume you have requested (%i ul) is too low ' \ 'for the required dilution (1:%s) since the CyBio cannot ' \ 'pipet less than %.1f ul per transfer. The volume that has ' \ 'to be taken from the stock for each single molecule ' \ 'design would be lower that that. Increase the target ' \ 'volume to %.1f ul or increase the target concentration.' \ % (self.__target_volume, get_trimmed_string(dil_factor), self.__min_cybio_transfer_vol, round_up(min_target_volume, 0)) raise ValueError(msg) self.__stock_transfer_vol = round_up(self.__target_volume / dil_factor) self.__adjusted_target_vol = round( self.__stock_transfer_vol * dil_factor, 1) # must be at least 1 ul according to the last check total_transfer_vol = self.__stock_transfer_vol * self.__number_designs if total_transfer_vol > self.__target_volume: msg = 'The target volume you have requested (%i ul) is too low ' \ 'for the concentration you have ordered (%i uM) since it ' \ 'would require already %s ul per molecule design (%s ul in ' \ 'total) to achieve the requested concentration. Increase ' \ 'the volume or lower the concentration, please.' \ % (self.__target_volume, self.__target_concentration, get_trimmed_string(self.__stock_transfer_vol), get_trimmed_string(total_transfer_vol)) raise ValueError(msg)
def __store_line_value(self, dil_info, total_vol, pos_label): """ Stores the values for one line. """ dil_info = dil_info.strip() info_tokens = dil_info.split(' (') final_dil_factor = float(info_tokens[1][:-1]) initial_dil_factor = TransfectionParameters.\ calculate_initial_reagent_dilution(final_dil_factor) reagent_vol = round_up((total_vol / initial_dil_factor)) total_vol = reagent_vol * initial_dil_factor total_vol = round(total_vol, 1) diluent_vol = total_vol - reagent_vol initial_dil_factor = round(initial_dil_factor, 1) self.__position_values.append(pos_label) self.__name_values.append(info_tokens[0]) self.__final_dil_factor_values.append( get_trimmed_string(final_dil_factor)) self.__ini_dil_factor_values.append( get_trimmed_string(initial_dil_factor)) self.__total_volume_values.append(get_trimmed_string(total_vol)) self.__reagent_volume_values.append(get_trimmed_string(reagent_vol)) self.__diluent_volume_values.append(get_trimmed_string(diluent_vol))
def get_source_plate_transfer_volume(): """ Returns the volume that is transferred from a pool stock rack to a library source (preparation) plate in ul. """ dilution_factor = float(POOL_STOCK_RACK_CONCENTRATION) \ / PREPARATION_PLATE_CONCENTRATION vol = PREPARATION_PLATE_VOLUME / dilution_factor return round_up(vol)
def __split_into_transferable_amounts(self, planned_transfer): # Checks whether the volume is larger than the allowed maximum # transfer volume and splits it into transferable amounts. volume = round(planned_transfer.volume * VOLUME_CONVERSION_FACTOR, 1) if volume <= self._max_transfer_volume: return [volume] self.__has_split_volumes = True no_volumes = ceil(volume / self._max_transfer_volume) amounts = [] partial_vol = round_up((volume / no_volumes), 1) while volume > 0: if volume < partial_vol: amounts.append(volume) volume = 0 else: amounts.append(partial_vol) volume = volume - partial_vol amounts.sort() return amounts
def calculate_iso_volume(cls, number_target_wells, number_replicates, iso_reservoir_spec, optimem_dil_factor, pipetting_specs): """ Calculates the ISO volume required to fill the given number of target wells (assuming the given number of interplate replicates). :param number_target_wells: The number of target wells in all design racks of an experiment design. :type number_target_wells: :class:`int` :param number_replicates: The number of replicates. :type number_replicates: :class:`int` :param optimem_dil_factor: The optimem dilution factor depends on molecule type or final concentration. :type optimem_dil_factor: positive number :param iso_reservoir_spec: The reservoir specs to be assumed. :type iso_reservoir_spec: :class:`thelma.entities.liquidtransfer.ReservoirSpecs` :return: The ISO volume that should be ordered in the ISO to generate an sufficient amount of mastermix solution. :param pipetting_specs: Defines whether to use a static dead volume or a dynamic (represents Biomek-transfer). :type pipetting_specs: :class:`PipettingSpecs` """ required_volume = cls.\ calculate_mastermix_volume_from_target_well_number( number_target_wells, number_replicates, iso_reservoir_spec, pipetting_specs) iso_volume = required_volume / (cls.REAGENT_MM_DILUTION_FACTOR \ * optimem_dil_factor) min_volume = get_min_transfer_volume(pipetting_specs) if iso_volume < min_volume: iso_volume = min_volume return round_up(iso_volume)