Example #1
0
    def test_with_sbnw_c_api(self):
        sbml_model = sbnw.loadSBMLFile(self.sbml_fname)
        layout_info = sbnw.processLayout(sbml_model)
        sbnw.randomizeLayout(layout_info)
        network = sbnw.getNetworkp(layout_info)

        _layout_alg_options = sbnw.FrAlgOptions(
            20.0,  # k
            1,      #boundary
            100,  # magnatism
            5.0,  # grav, has to be > 5 for effect
            500.0,  # baryx
            500.0,  # baryy
            1,  # autobary
            0,  #enable compartments
            1,  #pre-randomize
            20.0  # padding
        )

        comp = sbnw.nw_getCompartmentp(network, 0)
        comp_height_before = sbnw.compartment_getHeight(comp)
        print('comp_height_before', comp_height_before)
        sbnw.doLayoutAlgorithm(_layout_alg_options, layout_info)
        sbnw.doLayoutAlgorithm(_layout_alg_options, layout_info)
        sbnw.doLayoutAlgorithm(_layout_alg_options, layout_info)
        sbnw.doLayoutAlgorithm(_layout_alg_options, layout_info)
        # sbnw.doLayoutAlgorithm(_layout_alg_options, layout_info)
        comp_height_after = sbnw.compartment_getHeight(comp)
        print('comp_height_after', comp_height_after)

        # print(sbnw.getSBMLwithLayoutStr(sbml_model, layout_info))
        print(sbnw.writeSBMLwithLayout(self.sbml_with_layout, sbml_model, layout_info))
Example #2
0
 def setUp(self) -> None:
     self.sbml_fname = os.path.join(os.path.dirname(__file__),
                                    'teusink2000.xml')
     self.sbml_with_layout = os.path.join(
         os.path.dirname(__file__), 'teusink2000WithLayoutFromPython.xml')
     self.sbml_model = sbnw.loadSBMLString(teusink2000)
     self.layout_info = sbnw.processLayout(self.sbml_model)
Example #3
0
    def test(self):
        h_model = sbnw.loadSBMLString(self.sbml)

        # returns a layout_info object which has only a `contents` attribute
        layout_info = sbnw.processLayout(h_model)
        network = sbnw.getNetworkp(layout_info)

        print(h_model)
        print(layout_info)
        print(layout_info.contents)
        print(network)
Example #4
0
    def test_with_sbnw_c_api2(self):
        sbml_model = sbnw.loadSBMLFile(self.sbml_fname)
        layout_info = sbnw.processLayout(sbml_model)
        sbnw.randomizeLayout(layout_info)
        network = sbnw.getNetworkp(layout_info)

        _layout_alg_options = sbnw.FrAlgOptions(
            20.0,  # k
            1,      #boundary
            100,  # magnatism
            0.0,  # grav, has to be > 5 for effect
            500.0,  # baryx
            500.0,  # baryy
            1,  # autobary
            0,  #enable compartments
            1,  #pre-randomize
            20.0  # padding
        )
Example #5
0
 def test_processLayout(self):
     actual = sbnw.processLayout(self.h_model)
     self.eval_type_via_class_name('LP_LayoutInfo')
Example #6
0
 def setUp(self) -> None:
     self.sbml = compartment_model
     self.h_model = sbnw.loadSBMLString(self.sbml)
     self.h_layout_info = sbnw.processLayout(self.h_model)
     self.h_network = sbnw.getNetworkp(self.h_layout_info)
     self.h_canvas = sbnw.getCanvasp(self.h_layout_info)