コード例 #1
0
ファイル: test_queries.py プロジェクト: johnbachman/emmaa
def test_agent_from_trips():
    ag = get_agent_from_trips('MAP2K1')
    assert isinstance(ag, Agent)
    assert ag.name == 'MAP2K1'
    assert not ag.mods
    ag_phos = get_agent_from_trips('the phosphorylated MAP2K1')
    assert ag_phos.mods
コード例 #2
0
ファイル: api.py プロジェクト: kolusask/emmaa
def _make_query(query_dict):
    if 'typeSelection' in query_dict.keys():
        stmt_type = query_dict['typeSelection']
        stmt_class = get_statement_by_name(stmt_type)
        subj = get_agent_from_text(query_dict['subjectSelection'])
        obj = get_agent_from_text(query_dict['objectSelection'])
        stmt = stmt_class(subj, obj)
        query = PathProperty(path_stmt=stmt)
        tab = 'static'
    elif 'agentSelection' in query_dict.keys():
        agent = get_agent_from_trips(query_dict['agentSelection'])
        value = query_dict['valueSelection']
        if not value:
            value = None
        pattern = query_dict['patternSelection']
        query = DynamicProperty(agent, pattern, value)
        tab = 'dynamic'
    return query, tab
コード例 #3
0
                'HGNC': '1097'
            }
        },
        'obj': {
            'type': 'Agent',
            'name': 'MAPK1',
            'db_refs': {
                'HGNC': '6871'
            }
        },
        'obj_activity': 'activity'
    }
}
simple_query = 'BRAF activates MAPK1.'
query_object = Query._from_json(test_query)
dyn_ag = get_agent_from_trips('active MAP2K1')
dyn_query = DynamicProperty(dyn_ag, 'eventual_value', 'high')
open_qj = {
    'type': 'open_search_query',
    'entity': {
        'type': 'Agent',
        'name': 'BRAF',
        'db_refs': {
            'HGNC': '1097'
        }
    },
    'entity_role': 'subject',
    'stmt_type': 'Activation'
}
open_query = Query._from_json(open_qj)
interv_qj = {