예제 #1
0
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 = {