예제 #1
0
def get_observed_stmts(target_agent, observed_agent_forms, fold_change):
    stmts = []
    for obsf in observed_agent_forms:
        obs_agent = Agent(obsf.name, db_refs=obsf.db_refs)
        # If the agent has a modification then we make Modification
        # statements to check
        if obsf.mods:
            for mod in obsf.mods:
                # Create a Phosphorylation statement corresponding to
                # this drug/Ab pair
                if fold_change < 1:
                    stmt = Phosphorylation(target_agent, obs_agent,
                                           mod.residue, mod.position)
                else:
                    stmt = Dephosphorylation(target_agent, obs_agent,
                                             mod.residue, mod.position)
        # Otherwise the observed change is in protein amounts so we make
        # RegulateAmount statements
        else:
            if fold_change < 1:
                stmt = IncreaseAmount(target_agent, obs_agent)
            else:
                stmt = DecreaseAmount(target_agent, obs_agent)
        stmts.append(stmt)
    return stmts
예제 #2
0
def test_find_contradicts():
    st1 = Inhibition(Agent('a'), Agent('b'))
    st2 = Activation(Agent('a'), Agent('b'))
    st3 = IncreaseAmount(Agent('a'), Agent('b'))
    st4 = DecreaseAmount(Agent('a'), Agent('b'))
    pa = Preassembler(hierarchies, [st1, st2, st3, st4])
    contradicts = pa.find_contradicts()
    assert len(contradicts) == 2
    for s1, s2 in contradicts:
        assert {s1.uuid, s2.uuid} in ({st1.uuid,
                                       st2.uuid}, {st3.uuid, st4.uuid})
예제 #3
0
def test_find_contradicts():
    st1 = Inhibition(Agent('a'), Agent('b'))
    st2 = Activation(Agent('a'), Agent('b'))
    st3 = IncreaseAmount(Agent('a'), Agent('b'))
    st4 = DecreaseAmount(Agent('a'), Agent('b'))
    st5 = ActiveForm(
        Agent('a', mods=[ModCondition('phosphorylation', None, None, True)]),
        'kinase', True)
    st6 = ActiveForm(
        Agent('a', mods=[ModCondition('phosphorylation', None, None, True)]),
        'kinase', False)
    pa = Preassembler(hierarchies, [st1, st2, st3, st4, st5, st6])
    contradicts = pa.find_contradicts()
    assert len(contradicts) == 3
    for s1, s2 in contradicts:
        assert {s1.uuid,
                s2.uuid} in ({st1.uuid,
                              st2.uuid}, {st3.uuid,
                                          st4.uuid}, {st5.uuid, st6.uuid})
예제 #4
0
    def process_decrease_expression_amount(self):
        """Looks for Negative_Regulation events with a specified Cause
        and a Gene_Expression theme, and processes them into INDRA statements.
        """
        statements = []

        pwcs = self.find_event_parent_with_event_child('Negative_regulation',
                                                       'Gene_expression')
        for pair in pwcs:
            pos_reg = pair[0]
            expression = pair[1]

            cause = self.get_entity_text_for_relation(pos_reg, 'Cause')
            target = self.get_entity_text_for_relation(expression, 'Theme')

            if cause is not None and target is not None:
                theme_node = self.get_related_node(expression, 'Theme')
                assert (theme_node is not None)
                evidence = self.node_to_evidence(theme_node, is_direct=False)

                statements.append(
                    DecreaseAmount(s2a(cause), s2a(target), evidence=evidence))
        return statements
예제 #5
0
    else:
        demo_idx = int(sys.argv[1])

    if demo_idx in (1, 2):
        # The content of the two independent models described in natural language
        model_txts = [
            'rainfall causes floods',
            'floods cause displacement, and displacement reduces access to food'
        ]
        # Read with Eidos and extract INDRA Statements for each NL model
        stmts = [text_to_stmts(t) for t in model_txts]
        # It makes sense to assume that floods go away naturally and that
        # displacement is also decreased naturally over time. These are not
        # really needed for the demo but are conceptually interesting to think
        # about in terms of information missing from the original descriptions.
        stmts[0].append(DecreaseAmount(None, Concept('flood')))
        stmts[1].append(DecreaseAmount(None, Concept('displacement')))
        # We now create the variable mappings and the assumed "root" variables
        # for each demo case. In Demo 1, "rainfall" is assumed to be a root
        # variable that is assumed to be fixed. In demo 2, "rainfall" is mapped
        # to a corresponding Topoflow variable.
    elif demo_idx == 3:
        stmts = [eval_model.stmts]
    bmi_models = []
    if demo_idx == 1:
        out_name_maps = [{}, {}]
        input_vars = [[], ['flood']]
    elif demo_idx == 2:
        out_name_maps = [{
            'atmosphere_water__rainfall_volume_flux': 'rainfall'
        }, {}]