Example #1
0
def get_molecular_quantity(lst: KQMLList) -> tra.MolecularQuantity:
    try:
        quant_type = lst.gets('type')
        value = lst.gets('value')
        if quant_type == 'concentration':
            unit = lst.gets('unit')
        else:
            unit = None
        return tra.MolecularQuantity(quant_type, value, unit)
    except Exception as e:
        raise tra.InvalidMolecularQuantityError(e)
Example #2
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