예제 #1
0
 def _add_source_position(self, rack_pos, working_pos):
     """
     Creates a new transfection position and places it onto the given
     position of the source transfection layout.
     """
     src_tf = TransfectionPosition(
         rack_position=rack_pos,
         molecule_design_pool=working_pos.molecule_design_pool,
         reagent_name=working_pos.reagent_name,
         reagent_dil_factor=working_pos.reagent_dil_factor,
         final_concentration=working_pos.final_concentration)
     self._source_layout.add_position(src_tf)
예제 #2
0
    def __check_reagent_name(self, value_maps, label):
        """
        Checks the reagent name for each rack position in a layout
        (if this parameter is an allowed one). The reagent name must have a
        special value for untreated positions and be at least two character
        long for other positions.
        """
        if not TransfectionParameters.REAGENT_NAME \
                                            in self.__forbidden_parameters:

            pool_map = value_maps[TransfectionParameters.MOLECULE_DESIGN_POOL]
            name_map = value_maps[TransfectionParameters.REAGENT_NAME]

            invalid_untreated = []
            invalid_others = []

            for rack_pos, reagent_name in name_map.iteritems():
                if reagent_name is None: continue

                pool = pool_map[rack_pos]
                if TransfectionParameters.is_untreated_type(pool):
                    if not TransfectionPosition.is_valid_untreated_value(
                            reagent_name):
                        invalid_untreated.append(rack_pos.label)
                elif not len(reagent_name) > 1:
                    invalid_others.append(rack_pos.label)

            if len(invalid_untreated):
                msg = 'Untreated position must only have the reagent names ' \
                      '"None", "untreated" or no reagent name at all. The ' \
                      'following untreated positions in design rack "%s" ' \
                      'have invalid reagent names: %s.' \
                       % (label, ', '.join(sorted(invalid_untreated)))
                self.add_error(msg)

            if len(invalid_others):
                msg = 'The reagent name must be at least 2 characters long. ' \
                      'The following positions in design rack "%s" have ' \
                      'invalid reagent names: %s.' \
                       % (label, ', '.join(sorted(invalid_others)))
                self.add_error(msg)
예제 #3
0
    def __check_reagent_name(self, value_maps, label):
        """
        Checks the reagent name for each rack position in a layout
        (if this parameter is an allowed one). The reagent name must have a
        special value for untreated positions and be at least two character
        long for other positions.
        """
        if not TransfectionParameters.REAGENT_NAME \
                                            in self.__forbidden_parameters:

            pool_map = value_maps[TransfectionParameters.MOLECULE_DESIGN_POOL]
            name_map = value_maps[TransfectionParameters.REAGENT_NAME]

            invalid_untreated = []
            invalid_others = []

            for rack_pos, reagent_name in name_map.iteritems():
                if reagent_name is None: continue

                pool = pool_map[rack_pos]
                if TransfectionParameters.is_untreated_type(pool):
                    if not TransfectionPosition.is_valid_untreated_value(
                                                                reagent_name):
                        invalid_untreated.append(rack_pos.label)
                elif not len(reagent_name) > 1:
                    invalid_others.append(rack_pos.label)

            if len(invalid_untreated):
                msg = 'Untreated position must only have the reagent names ' \
                      '"None", "untreated" or no reagent name at all. The ' \
                      'following untreated positions in design rack "%s" ' \
                      'have invalid reagent names: %s.' \
                       % (label, ', '.join(sorted(invalid_untreated)))
                self.add_error(msg)

            if len(invalid_others):
                msg = 'The reagent name must be at least 2 characters long. ' \
                      'The following positions in design rack "%s" have ' \
                      'invalid reagent names: %s.' \
                       % (label, ', '.join(sorted(invalid_others)))
                self.add_error(msg)