Beispiel #1
0
def test_seq_hyp_test():
    stmts = [Activation(Agent('BRAF'), Agent('KRAS'))]
    model = tra_module.assemble_model(stmts)
    entity = Agent('KRAS', activity=ActivityCondition('activity', True))
    quantity = tra.MolecularQuantityReference('total', entity)
    quant = tra.MolecularQuantity('qualitative', 'high')
    pattern = tra.TemporalPattern('sometime_value', [entity],
                                  None,
                                  value=quant)
    t = tra.TRA()
    from bioagents.tra.model_checker import HypothesisTester
    ht = HypothesisTester(alpha=0.1, beta=0.1, delta=0.05, prob=0.8)
    res = t.check_property(model,
                           pattern,
                           conditions=None,
                           max_time=20000,
                           num_times=100,
                           hypothesis_tester=ht)
    sat_rate, num_sim, kpat, pat_obj, fig_path = res
    assert sat_rate == 1.0
    assert num_sim == 18
Beispiel #2
0
def get_temporal_pattern(lst: KQMLList) -> tra.TemporalPattern:
    pattern_type = lst.gets('type')
    entities_lst = lst.get('entities')
    entities = []
    if entities_lst is None:
        entities_lst = []
    for e in entities_lst:
        entity = get_molecular_entity(e)
        entities.append(entity)
    time_limit_lst = lst.get('time-limit')
    if time_limit_lst is None:
        time_limit = None
    else:
        time_limit = get_time_interval(time_limit_lst)
    # TODO: handle more pattern-specific extra arguments
    value_lst = lst.get('value')
    if value_lst is not None:
        value = get_molecular_quantity(value_lst)
    else:
        value = None
    tp = tra.TemporalPattern(pattern_type, entities, time_limit, value=value)
    return tp