def test_export_model(): st = Phosphorylation(Agent('MAP2K1'), Agent('MAPK3')) pa = PysbAssembler([st]) pa.make_model() exp_str = pa.export_model('kappa') assert exp_str exp_str = pa.export_model('bngl') assert exp_str exp_str = pa.export_model('sbml', file_name='/dev/null') assert exp_str
def test_export_model(): st = Phosphorylation(Agent('MAP2K1'), Agent('MAPK3')) pa = PysbAssembler([st]) pa.make_model() exp_str = pa.export_model('kappa') assert exp_str exp_str = pa.export_model('bngl') assert exp_str exp_str = pa.export_model('sbml', file_name='/dev/null') assert exp_str
def test_kappa_cm_export(): stmts = [Complex([Agent('a'), Agent('b')])] pa = PysbAssembler(stmts) pa.make_model() graph = pa.export_model('kappa_cm', '/dev/null') assert len(graph.nodes()) == 2 assert len(graph.edges()) == 1
def test_kappa_cm_export(): stmts = [Complex([Agent('a'), Agent('b')])] pa = PysbAssembler(stmts) pa.make_model() graph = pa.export_model('kappa_cm', '/dev/null') assert len(graph.nodes()) == 2 assert len(graph.edges()) == 1
def test_kappa_im_export(): stmts = [Activation(Agent('a'), Agent('b')), Activation(Agent('b', activity=ActivityCondition('activity', True)), Agent('c'))] pa = PysbAssembler(stmts) pa.make_model() graph = pa.export_model('kappa_im', '/dev/null') assert len(graph.nodes) == 2 assert len(graph.edges) == 1
def test_kappa_im_export(): stmts = [Activation(Agent('a'), Agent('b')), Activation(Agent('b', activity=ActivityCondition('activity', True)), Agent('c'))] pa = PysbAssembler(stmts) pa.make_model() graph = pa.export_model('kappa_im', '/dev/null') assert len(graph.nodes) == 2 assert len(graph.edges) == 1
def test_assemble_export_sbgn(): # Add various statements to test their assembly st = Phosphorylation(Agent('BRAF'), Agent('MAP2K1')) mc = ModCondition('phosphorylation', None, None, True) st2 = Activation(Agent('MAP2K1', mods=[mc]), Agent('MAPK1')) st3 = Complex([Agent('MAPK1'), Agent('DUSP6')]) st4 = DecreaseAmount(None, Agent('DUSP6')) pa = PysbAssembler([st, st2, st3, st4]) pa.make_model() # Export to SBGN model = pa.export_model('sbgn') assert model is not None # Test that the right elements are there in the result et = ET.fromstring(model) sbgn_ns = {'s': 'http://sbgn.org/libsbgn/pd/0.1'} glyphs = et.findall('s:map/s:glyph', namespaces=sbgn_ns) glyph_classes = [g.attrib.get('class') for g in glyphs] assert glyph_classes.count('macromolecule') == 6 assert glyph_classes.count('complex') == 2 assert glyph_classes.count('process') == 10 return pa
def test_assemble_export_sbgn(): # Add various statements to test their assembly st = Phosphorylation(Agent('BRAF'), Agent('MAP2K1')) mc = ModCondition('phosphorylation', None, None, True) st2 = Activation(Agent('MAP2K1', mods=[mc]), Agent('MAPK1')) st3 = Complex([Agent('MAPK1'), Agent('DUSP6')]) st4 = DecreaseAmount(None, Agent('DUSP6')) pa = PysbAssembler([st, st2, st3, st4]) pa.make_model() # Export to SBGN model = pa.export_model('sbgn') assert model is not None # Test that the right elements are there in the result et = ET.fromstring(model) from indra.assemblers.sbgn.assembler import sbgn_ns sbgn_nss = {'s': sbgn_ns} glyphs = et.findall('s:map/s:glyph', namespaces=sbgn_nss) glyph_classes = [g.attrib.get('class') for g in glyphs] assert glyph_classes.count('macromolecule') == 6 assert glyph_classes.count('complex') == 2 assert glyph_classes.count('process') == 10 return pa