Exemplo n.º 1
0
    def test_non_empty_hierarchy(self):
        """."""
        model = KamiCorpus("test")

        plcg1_pY1253 = Protoform("P19174",
                                 synonyms=["PLCG1"],
                                 residues=[
                                     Residue("Y",
                                             1253,
                                             state=State(
                                                 "phosphorylation", True))
                                 ])
        sh2 = Region(name="SH2")
        abl1 = Protoform("P00519", synonyms=["ABL1"])
        abl1_sh2 = RegionActor(abl1, sh2)
        bnd = Binding(plcg1_pY1253, abl1_sh2)

        model.add_interactions([bnd], model)
        assert (model.empty() is False)

        model.export_json("test_non_empty_hierarchy.json")
        new_model = KamiCorpus.load_json("test",
                                         "test_non_empty_hierarchy.json")
        assert (isinstance(new_model, KamiCorpus))
        assert (("test_action_graph", "meta_model")
                in new_model._hierarchy.edges())
Exemplo n.º 2
0
    def test_empty_hierarchy(self):
        """Test getters for various model components."""
        model = KamiCorpus("test")
        assert (model.action_graph is not None)
        assert (len(model.nuggets()) == 0)
        assert (model.empty())

        model.export_json("test_empty_hierarchy.json")
        new_model = KamiCorpus.load_json("test", "test_empty_hierarchy.json")
        assert (isinstance(new_model, KamiCorpus))
        # assert(new_model._hierarchy == model._hierarchy)

        assert (model.mod_template is
                model._hierarchy.get_graph("mod_template"))
        assert (model.bnd_template is
                model._hierarchy.get_graph("bnd_template"))
        assert (model.semantic_action_graph is
                model._hierarchy.get_graph("semantic_action_graph"))