Exemplo n.º 1
0
    def test_apply_style_from_network_wrong_types(self):
        mynet = NiceCXNetwork()

        try:
            mynet.apply_style_from_network(None)
            self.fail('Expected TypeError')
        except TypeError as e:
            self.assertEqual('Object passed in is None', str(e))

        try:
            mynet.apply_style_from_network(str('hi'))
            self.fail('Expected TypeError')
        except TypeError as e:
            self.assertEqual('Object passed in is not NiceCXNetwork', str(e))
Exemplo n.º 2
0
    # cx_network.add_node_attribute(property_of=cx_node, name="Y", values=min_y)
    cx_network.add_node_attribute(property_of=cx_node,
                                  name="WIDTH",
                                  values=width)
    cx_network.add_node_attribute(property_of=cx_node,
                                  name="HEIGHT",
                                  values=height)

# TODO: need to handle defaults. The following doesn't appear to work.
# node_properties = [
#    {"properties_of": "nodes:default", "properties": {"NODE_SHAPE": "RECTANGLE"}}
# ]
# set_visual_properties_aspect(cx_network, node_properties)

style_network = ndex2.create_nice_cx_from_file("./WP4571.cx.json")
cx_network.apply_style_from_network(style_network)

set_cartesian_layout_aspect(cx_network, cartesianLayout)

cx_network.print_summary()

mycx = cx_network.to_cx()
# print(mycx)
pprint.pprint(mycx, depth=4)

# result = cx_network.upload_to(
#    server="http://test.ndexbio.org", username=NDEX_USER, password=NDEX_PWD
# )

result = cx_network.update_to(
    server="http://test.ndexbio.org",