def __init__(self, lab_iso_plate, for_job, lab_iso_layout=None, parent=None): """ Constructor. :param lab_iso_plate: The lab ISO plate to be checked. :type lab_iso_plate: :class:`IsoPlate` or :class:`IsoJobPreparationPlate` :param for_job: Do we check the job processing (*True*) or the ISO? :type for_job: :class:`bool` :param lab_iso_layout: The layout containing the molecule design data. Must not be None for :class:`IsoAliquotPlate` or :class:`LibraryPlate` objects. :type lab_iso_layout: :class:`LabIsoLayout` """ BaseRackVerifier.__init__(self, reference_layout=lab_iso_layout, parent=parent) #: The lab ISO plate to be checked. self.lab_iso_plate = lab_iso_plate #: Do we check the job processing (*True*) or the ISO (*False*)? self.for_job = for_job #: In aliquot and (for controls positions) preparation plates, #: we can ignore positions that are derived from another position #: at the same plate because the intraplate transfers might be #: part of the processing of the second entity. self.__ignore_positions = None #: This is kind of a hack. We cannot make safe statement about ignored #: positions, for this reason, the comparison for ignored positions #: is temporarily disabled (until the next position). self.__disable_comparison = None
def _check_input(self): BaseRackVerifier._check_input(self) if not isinstance(self.lab_iso_plate, (IsoPlate, LibraryPlate, IsoJobPreparationPlate)): msg = 'The lab ISO plate must be an %s, %s or an %s ' \ '(obtained: %s).' % (IsoPlate.__name__, LibraryPlate.__name__, IsoJobPreparationPlate.__name__, self.lab_iso_plate.__class__.__name__) self.add_error(msg) self._check_input_class('"for job" flag', self.for_job, bool)
def __init__(self, stock_rack, stock_rack_layout=None, parent=None): """ Constructor. :param stock_rack: The stock rack to be checked. :type stock_rack: :class:`thelma.entities.iso.StockRack` :param stock_rack_layout: The layout containing the molecule design and volume data. Can be set here or derived during the run. :type stock_rack_layout: :class:`StockRackLayout` """ BaseRackVerifier.__init__(self, reference_layout=stock_rack_layout, parent=parent) #: The stock rack to be checked. self.stock_rack = stock_rack
def _get_ids_for_pool(self, md_pool): """ If a floating placeholder occurs for the first time we have dictionary instead of a pool. """ if isinstance(md_pool, dict): id_map = dict() for iso_label, pool in md_pool.iteritems(): ids = BaseRackVerifier._get_ids_for_pool(self, pool) id_map[iso_label] = ids return id_map else: return BaseRackVerifier._get_ids_for_pool(self, md_pool)
def _are_matching_molecule_designs(self, rack_mds, exp_mds): """ Checks whether the molecule designs for the positions match. The method will also try to determine the ISO if this has not been happened so far. """ if exp_mds is None or isinstance(exp_mds, list): return BaseRackVerifier._are_matching_molecule_designs( self, rack_mds, exp_mds) # In case of floating position and unknown ISO ... for iso_label, iso_mds in exp_mds.iteritems(): if BaseRackVerifier._are_matching_molecule_designs( self, rack_mds, iso_mds): self._used_iso = iso_label return True return False
def _are_matching_molecule_designs(self, rack_mds, exp_mds): """ Checks whether the molecule designs for the positions match. The method will also try to determine the ISO if this has not been happened so far. """ if exp_mds is None or isinstance(exp_mds, list): return BaseRackVerifier._are_matching_molecule_designs(self, rack_mds, exp_mds) # In case of floating position and unknown ISO ... for iso_label, iso_mds in exp_mds.iteritems(): if BaseRackVerifier._are_matching_molecule_designs(self, rack_mds, iso_mds): self._used_iso = iso_label return True return False
def __init__(self, source_plate, iso_request, parent=None): """ Constructor. :param iso_request: The ISO request the plate must represent. :type iso_request: :class:`thelma.entities.iso.isoRequest` :param source_plate: The plate to be checked. :type source_plate: :class:`thelma.entities.rack.Plate` """ BaseRackVerifier.__init__(self, parent=parent) #: The ISO request the plate must represent. self.iso_request = iso_request #: The plate to be checked. self.source_plate = source_plate #: Maps floating maps (molecule design pools for placeholders) onto ISO #: label - is only used when there are floating positions in the ISO #: layout. self._iso_map = dict() #: The name of the ISO the source rack represents. self._used_iso = None
def _are_matching_molecule_designs(self, rack_mds, exp_mds): """ If comparison is disabled (because the current position is ignored) we always return *True*. In any case, comparison is enabled again. """ if self.__disable_comparison: self.__disable_comparison = False return True return BaseRackVerifier._are_matching_molecule_designs( self, rack_mds, exp_mds)
def _are_matching_molecule_designs(self, rack_mds, exp_mds): """ If comparison is disabled (because the current position is ignored) we always return *True*. In any case, comparison is enabled again. """ if self.__disable_comparison: self.__disable_comparison = False return True return BaseRackVerifier._are_matching_molecule_designs(self, rack_mds, exp_mds)
def _check_input(self): BaseRackVerifier._check_input(self) self._check_input_class('ISO request', self.iso_request, LabIsoRequest)
def reset(self): BaseRackVerifier.reset(self) self.__ignore_positions = None self.__disable_comparison = False
def reset(self): BaseRackVerifier.reset(self) self._iso_map = None self._used_iso = None
def _check_input(self): BaseRackVerifier._check_input(self) self._check_input_class("stock rack", self.stock_rack, StockRack)
def _check_input(self): BaseRackVerifier._check_input(self) self._check_input_class('stock rack', self.stock_rack, StockRack)