def check_statement(self, stmt, max_paths=1, max_path_length=5):
        """Check a single Statement against the model.

        Parameters
        ----------
        stmt : indra.statements.Statement
            The Statement to check.
        max_paths : Optional[int]
            The maximum number of specific paths to return for each Statement
            to be explained. Default: 1
        max_path_length : Optional[int]
            The maximum length of specific paths to return. Default: 5

        Returns
        -------
        boolean
            True if the model satisfies the Statement.
        """
        # Make sure the influence map is initialized
        self.get_im()
        # Check if this is one of the statement types that we can check
        if not isinstance(stmt, (Modification, RegulateAmount,
                                 RegulateActivity, Influence)):
            return PathResult(False, 'STATEMENT_TYPE_NOT_HANDLED',
                              max_paths, max_path_length)
        # Get the polarity for the statement
        if isinstance(stmt, Modification):
            target_polarity = -1 if isinstance(stmt, RemoveModification) else 1
        elif isinstance(stmt, RegulateActivity):
            target_polarity = 1 if stmt.is_activation else -1
        elif isinstance(stmt, RegulateAmount):
            target_polarity = -1 if isinstance(stmt, DecreaseAmount) else 1
        elif isinstance(stmt, Influence):
            target_polarity = -1 if stmt.overall_polarity() == -1 else 1
        # Get the subject and object (works also for Modifications)
        subj, obj = stmt.agent_list()
        # Get a list of monomer patterns matching the subject FIXME Currently
        # this will match rules with the corresponding monomer pattern on it.
        # In future, this statement should (possibly) also match rules in which
        # 1) the agent is in its active form, or 2) the agent is tagged as the
        # enzyme in a rule of the appropriate activity (e.g., a phosphorylation
        # rule) FIXME
        if subj is not None:
            subj_mps = list(pa.grounded_monomer_patterns(self.model, subj,
                                                    ignore_activities=True))
            if not subj_mps:
                logger.debug('No monomers found corresponding to agent %s' %
                             subj)
                return PathResult(False, 'SUBJECT_MONOMERS_NOT_FOUND',
                                  max_paths, max_path_length)
        else:
            subj_mps = [None]
        # Observables may not be found for an activation since there may be no
        # rule in the model activating the object, and the object may not have
        # an "active" site of the appropriate type
        obs_names = self.stmt_to_obs[stmt]
        if not obs_names:
            logger.debug("No observables for stmt %s, returning False" % stmt)
            return PathResult(False, 'OBSERVABLES_NOT_FOUND',
                              max_paths, max_path_length)
        for subj_mp, obs_name in itertools.product(subj_mps, obs_names):
            # NOTE: Returns on the path found for the first enz_mp/obs combo
            result = self._find_im_paths(subj_mp, obs_name, target_polarity,
                                         max_paths, max_path_length)
            # If a path was found, then we return it; otherwise, that means
            # there was no path for this observable, so we have to try the next
            # one
            if result.path_found:
                return result
        # If we got here, then there was no path for any observable
        return PathResult(False, 'NO_PATHS_FOUND',
                          max_paths, max_path_length)
def check_statement ( self , stmt , max_paths = 1 , max_path_length = 5 ) : self . get_im ( ) if not isinstance ( stmt , ( Modification , RegulateAmount , RegulateActivity , Influence ) ) : return PathResult ( False , 'STATEMENT_TYPE_NOT_HANDLED' , max_paths , max_path_length ) if isinstance ( stmt , Modification ) : target_polarity = - 1 if isinstance ( stmt , RemoveModification ) else 1 elif isinstance ( stmt , RegulateActivity ) : target_polarity = 1 if stmt . is_activation else - 1 elif isinstance ( stmt , RegulateAmount ) : target_polarity = - 1 if isinstance ( stmt , DecreaseAmount ) else 1 elif isinstance ( stmt , Influence ) : target_polarity = - 1 if stmt . overall_polarity ( ) == - 1 else 1 subj , obj = stmt . agent_list ( ) if subj is not None : subj_mps = list ( pa . grounded_monomer_patterns ( self . model , subj , ignore_activities = True ) ) if not subj_mps : logger . debug ( 'No monomers found corresponding to agent %s' % subj ) return PathResult ( False , 'SUBJECT_MONOMERS_NOT_FOUND' , max_paths , max_path_length ) else : subj_mps = [ None ] obs_names = self . stmt_to_obs [ stmt ] if not obs_names : logger . debug ( "No observables for stmt %s, returning False" % stmt ) return PathResult ( False , 'OBSERVABLES_NOT_FOUND' , max_paths , max_path_length ) for subj_mp , obs_name in itertools . product ( subj_mps , obs_names ) : result = self . _find_im_paths ( subj_mp , obs_name , target_polarity , max_paths , max_path_length ) if result . path_found : return result return PathResult ( False , 'NO_PATHS_FOUND' , max_paths , max_path_length )
Check a single Statement against the model.

        Parameters
        ----------
        stmt : indra.statements.Statement
            The Statement to check.
        max_paths : Optional[int]
            The maximum number of specific paths to return for each Statement
            to be explained. Default: 1
        max_path_length : Optional[int]
            The maximum length of specific paths to return. Default: 5

        Returns
        -------
        boolean
            True if the model satisfies the Statement.