def get_activation(self):
        """Extract INDRA Inhibition/Activation Statements from BEL.

        The SPARQL query used to extract Activation Statements looks for
        patterns in which the subject is is an ActivityType
        (of a ProtainAbundance) or an Abundance (of a small molecule).
        The object has to be the ActivityType (typically of a
        ProteinAbundance) which is either increased or decreased.

        Examples:

            abundance(CHEBI:gefitinib) directlyDecreases
            kinaseActivity(proteinAbundance(HGNC:EGFR))

            kinaseActivity(proteinAbundance(HGNC:MAP3K5))
            directlyIncreases kinaseActivity(proteinAbundance(HGNC:MAP2K7))

        This pattern covers the extraction of Gap/Gef and GtpActivation
        Statements, which are recognized by the object activty or the
        subject activity, respectively, being `gtpbound`.

        Examples:

            catalyticActivity(proteinAbundance(HGNC:RASA1))
            directlyDecreases
            gtpBoundActivity(proteinAbundance(PFH:"RAS Family"))

            catalyticActivity(proteinAbundance(HGNC:SOS1))
            directlyIncreases
            gtpBoundActivity(proteinAbundance(HGNC:HRAS))

            gtpBoundActivity(proteinAbundance(HGNC:HRAS))
            directlyIncreases
            catalyticActivity(proteinAbundance(HGNC:TIAM1))
        """
        q_stmts = prefixes + """
            SELECT ?subjName ?subjActType ?rel ?objName ?objActType
                   ?stmt ?subj ?obj
            WHERE {
                ?stmt a belvoc:Statement .
                ?stmt belvoc:hasRelationship ?rel .
                ?stmt belvoc:hasSubject ?subj .
                {?subj belvoc:hasActivityType ?subjActType .
                 ?subj belvoc:hasChild ?subjProt .
                 ?subjProt belvoc:hasConcept ?subjName .}
                UNION
                {?subj a belvoc:Abundance .
                 ?subj belvoc:hasConcept ?subjName .}
                ?stmt belvoc:hasObject ?obj .
                ?obj belvoc:hasActivityType ?objActType .
                ?obj belvoc:hasChild ?objProt .
                ?objProt belvoc:hasConcept ?objName .
                FILTER (?rel = belvoc:DirectlyIncreases ||
                        ?rel = belvoc:DirectlyDecreases)
            }
        """
        res_stmts = self.g.query(q_stmts)

        for stmt in res_stmts:
            evidence = self._get_evidence(stmt[5])
            subj = self._get_agent(stmt[0], stmt[6])
            subj_activity = stmt[1]
            if subj_activity:
                subj_activity = term_from_uri(stmt[1]).lower()
                subj.activity = ActivityCondition(subj_activity, True)
            rel = term_from_uri(stmt[2])
            if rel == 'DirectlyDecreases':
                is_activation = False
            else:
                is_activation = True
            obj = self._get_agent(stmt[3], stmt[7])
            obj_activity = term_from_uri(stmt[4]).lower()
            stmt_str = strip_statement(stmt[5])
            # Mark this as a converted statement
            self.converted_direct_stmts.append(stmt_str)

            # Distinguish the case when the activator is a GTPase
            # (since this may involve unique and stereotyped mechanisms)
            if subj_activity == 'gtpbound':
                if not is_activation:
                    logger.warning('GtpActivation only handles positive '
                                   'activation.')
                    continue
                self.statements.append(
                     GtpActivation(subj, obj, obj_activity, evidence))
            # If the object is a GTPase, and the subject *increases*
            # its GtpBound activity, then the subject is a GEF
            elif obj_activity == 'gtpbound' and rel == 'DirectlyIncreases':
                self.statements.append(
                        Gef(subj, obj, evidence))
            # If the object is a GTPase, and the subject *decreases*
            # its GtpBound activity, then the subject is a GAP
            elif obj_activity == 'gtpbound' and rel == 'DirectlyDecreases':
                self.statements.append(
                        Gap(subj, obj, evidence))
            # Otherwise, create a generic Activity->Activity statement
            else:
                if rel == 'DirectlyDecreases':
                    st = Inhibition(subj, obj, obj_activity, evidence)
                else:
                    st = Activation(subj, obj, obj_activity, evidence)
                self.statements.append(st)
def get_activation ( self ) : q_stmts = prefixes + """
            SELECT ?subjName ?subjActType ?rel ?objName ?objActType
                   ?stmt ?subj ?obj
            WHERE {
                ?stmt a belvoc:Statement .
                ?stmt belvoc:hasRelationship ?rel .
                ?stmt belvoc:hasSubject ?subj .
                {?subj belvoc:hasActivityType ?subjActType .
                 ?subj belvoc:hasChild ?subjProt .
                 ?subjProt belvoc:hasConcept ?subjName .}
                UNION
                {?subj a belvoc:Abundance .
                 ?subj belvoc:hasConcept ?subjName .}
                ?stmt belvoc:hasObject ?obj .
                ?obj belvoc:hasActivityType ?objActType .
                ?obj belvoc:hasChild ?objProt .
                ?objProt belvoc:hasConcept ?objName .
                FILTER (?rel = belvoc:DirectlyIncreases ||
                        ?rel = belvoc:DirectlyDecreases)
            }
        """ res_stmts = self . g . query ( q_stmts ) for stmt in res_stmts : evidence = self . _get_evidence ( stmt [ 5 ] ) subj = self . _get_agent ( stmt [ 0 ] , stmt [ 6 ] ) subj_activity = stmt [ 1 ] if subj_activity : subj_activity = term_from_uri ( stmt [ 1 ] ) . lower ( ) subj . activity = ActivityCondition ( subj_activity , True ) rel = term_from_uri ( stmt [ 2 ] ) if rel == 'DirectlyDecreases' : is_activation = False else : is_activation = True obj = self . _get_agent ( stmt [ 3 ] , stmt [ 7 ] ) obj_activity = term_from_uri ( stmt [ 4 ] ) . lower ( ) stmt_str = strip_statement ( stmt [ 5 ] ) self . converted_direct_stmts . append ( stmt_str ) if subj_activity == 'gtpbound' : if not is_activation : logger . warning ( 'GtpActivation only handles positive ' 'activation.' ) continue self . statements . append ( GtpActivation ( subj , obj , obj_activity , evidence ) ) elif obj_activity == 'gtpbound' and rel == 'DirectlyIncreases' : self . statements . append ( Gef ( subj , obj , evidence ) ) elif obj_activity == 'gtpbound' and rel == 'DirectlyDecreases' : self . statements . append ( Gap ( subj , obj , evidence ) ) else : if rel == 'DirectlyDecreases' : st = Inhibition ( subj , obj , obj_activity , evidence ) else : st = Activation ( subj , obj , obj_activity , evidence ) self . statements . append ( st )
Extract INDRA Inhibition/Activation Statements from BEL.

        The SPARQL query used to extract Activation Statements looks for
        patterns in which the subject is is an ActivityType
        (of a ProtainAbundance) or an Abundance (of a small molecule).
        The object has to be the ActivityType (typically of a
        ProteinAbundance) which is either increased or decreased.

        Examples:

            abundance(CHEBI:gefitinib) directlyDecreases
            kinaseActivity(proteinAbundance(HGNC:EGFR))

            kinaseActivity(proteinAbundance(HGNC:MAP3K5))
            directlyIncreases kinaseActivity(proteinAbundance(HGNC:MAP2K7))

        This pattern covers the extraction of Gap/Gef and GtpActivation
        Statements, which are recognized by the object activty or the
        subject activity, respectively, being `gtpbound`.

        Examples:

            catalyticActivity(proteinAbundance(HGNC:RASA1))
            directlyDecreases
            gtpBoundActivity(proteinAbundance(PFH:"RAS Family"))

            catalyticActivity(proteinAbundance(HGNC:SOS1))
            directlyIncreases
            gtpBoundActivity(proteinAbundance(HGNC:HRAS))

            gtpBoundActivity(proteinAbundance(HGNC:HRAS))
            directlyIncreases
            catalyticActivity(proteinAbundance(HGNC:TIAM1))