def test_get_molecular_condition_dec(): lst = KQMLList.from_string('(:type "decrease" :quantity (:type "total" ' +\ ':entity (:description "%s")))' % ekb_braf) mc = tra_module.get_molecular_condition(lst) assert mc.condition_type == 'decrease' assert mc.quantity.quant_type == 'total' assert mc.quantity.entity.name == 'BRAF'
def test_apply_condition_multiple(): model = _get_gk_model() lst = KQMLList.from_string('(:type "multiple" :value 2.5 ' + ':quantity (:type "total" ' + ':entity (:description "%s")))' % ekb_map2k1) mc = tra_module.get_molecular_condition(lst) apply_condition(model, mc) assert model.parameters['MAP2K1_0'].value == 250
def test_apply_condition_decrease(): model = _get_gk_model() lst = KQMLList.from_string('(:type "decrease" ' + ':quantity (:type "total" ' + ':entity (:description "%s")))' % ekb_map2k1) mc = tra_module.get_molecular_condition(lst) pold = model.parameters['MAP2K1_0'].value apply_condition(model, mc) assert model.parameters['MAP2K1_0'].value < pold
def test_get_molecular_condition_multiple(): lst = KQMLList.from_string('(:type "multiple" :value 2 ' + ':quantity (:type "total" ' + ':entity (:description "%s")))' % ekb_braf) mc = tra_module.get_molecular_condition(lst) assert mc.condition_type == 'multiple' assert mc.value == 2.0 assert mc.quantity.quant_type == 'total' assert mc.quantity.entity.name == 'BRAF'
def test_get_molecular_condition_exact(): lst = KQMLList.from_string( '(:type "exact" :value (:value 0 :type "number") ' + ':quantity (:type "total" ' + ':entity (:description "%s")))' % ekb_braf) mc = tra_module.get_molecular_condition(lst) assert mc.condition_type == 'exact' assert mc.value.quant_type == 'number' assert mc.quantity.quant_type == 'total' assert mc.quantity.entity.name == 'BRAF'
def test_apply_condition_exact(): model = _get_gk_model() lst = KQMLList.from_string( '(:type "exact" :value (:value 0 :type "number") ' + ':quantity (:type "total" ' + ':entity (:description "%s")))' % ekb_map2k1) mc = tra_module.get_molecular_condition(lst) apply_condition(model, mc) assert model.parameters['MAP2K1_0'].value == 0 mc.value.value = 2000 apply_condition(model, mc) assert model.parameters['MAP2K1_0'].value == 2000
def test_get_molecular_condition_badentity(): lst = KQMLList.from_string('(:type "exact" :value 2 ' + ':quantity (:type "total" ' + ':entity (:description "xyz")))') mc = tra_module.get_molecular_condition(lst)
def test_get_molecular_condition_badvalue(): lst = KQMLList.from_string('(:type "multiple" :value "xyz" ' + ':quantity (:type "total" ' + ':entity (:description "%s")))' % ekb_braf) mc = tra_module.get_molecular_condition(lst)
def test_get_molecular_condition_badvalue2(): lst = KQMLList.from_string('(:type "exact" :value 2 ' + ':quantity (:type "total" ' + ':entity (:description %s)))' % clj_braf) tra_module.get_molecular_condition(lst)