コード例 #1
0
def test_dynamic_property_to_english():
    agent = Agent('EGFR', mods=[ModCondition('phosphorylation')],
                  db_refs={'HGNC': '3236'})
    query = DynamicProperty(agent, 'always_value', 'low', 'qualitative')
    assert query.to_english() == 'Phosphorylated EGFR is always low.'
    query.pattern_type = 'eventual_value'
    assert query.to_english() == 'Phosphorylated EGFR is eventually low.'
コード例 #2
0
def test_dynamic_property_to_json():
    agent = Agent('EGFR', mods=[ModCondition('phosphorylation')],
                  db_refs={'HGNC': '3236'})
    query = DynamicProperty(agent, 'always_value', 'low', 'qualitative')
    json = query.to_json()
    assert json.get('type') == 'dynamic_property'
    entity = json.get('entity')
    assert entity.get('name') == 'EGFR'
    assert entity.get('db_refs') == {"HGNC": "3236"}
    assert json.get('pattern_type') == 'always_value'
    quantity = json.get('quantity')
    assert quantity.get('type') == 'qualitative'
    assert quantity.get('value') == 'low'
コード例 #3
0
def test_stringify_dynamic_property():
    agent = Agent('EGFR', mods=[ModCondition('phosphorylation')],
                  db_refs={'HGNC': '3236'})
    query = DynamicProperty(agent, 'always_value', 'low', 'qualitative')
    query_str = str(query)
    assert query_str == ("DynamicPropertyQuery(entity=EGFR(mods: "
                         "(phosphorylation)), pattern=always_value, "
                         "molecular quantity=('qualitative', 'low'))")
コード例 #4
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
コード例 #5
0
            }
        },
        '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 = {
    'type': 'simple_intervention_property',