def test_06_MSMS():
    # test the MSMS node
    net = ed.currentNetwork
    net.runOnNewData.value = True    
    node1 = ReadMolecule(library=molkitlib)
    net.addNode(node1, 20, 20)
    node1.inputPorts[0].widget.set(os.path.abspath("1crn.pdb"))
    # assign radii
    node2 = AssignRadii(library=molkitlib)
    net.addNode(node2, 275, 62)
    net.connectNodes(node1, node2, "MolSets", "molecules")
    node2.toggleNodeExpand_cb()
    # select nodes
    node3 = NodeSelector(library=molkitlib)
    net.addNode(node3, 14, 153)
    net.connectNodes(node2, node3, "molecules", "nodes")
    node3.toggleNodeExpand_cb()
    # msms
    node4 = AtomsAsMSMS(library=molkitlib)
    net.addNode(node4, 263, 267)
    net.connectNodes(node3, node4, "nodes", "atoms")
    net.connectNodes(node2, node4, "radii", "radii")
    pause()
    # check data
    from mslib import MSMS
    assert isinstance(node4.outputPorts[0].data, MSMS),\
           "Expected %s, got %s"%(MSMS, node4.outputPorts[0].data.__class__)
    assert len(node4.outputPorts[0].data.coords) == 327,\
           "Expected 327, got %s"%len(node4.outputPorts[0].data.coords)
    # just for the fun of it, click the united radii checkbutton a couple times
    node2.inputPorts[1].widget.set(1)
    node2.inputPorts[1].widget.set(0)
    node2.inputPorts[1].widget.set(1)
    node2.inputPorts[1].widget.set(0)
Example #2
0
def test_06_MSMS():
    # test the MSMS node
    net = ed.currentNetwork
    net.runOnNewData.value = True
    node1 = ReadMolecule(library=molkitlib)
    net.addNode(node1, 20, 20)
    node1.inputPorts[0].widget.set(os.path.abspath("1crn.pdb"))
    # assign radii
    node2 = AssignRadii(library=molkitlib)
    net.addNode(node2, 275, 62)
    net.connectNodes(node1, node2, "MolSets", "molecules")
    node2.toggleNodeExpand_cb()
    # select nodes
    node3 = NodeSelector(library=molkitlib)
    net.addNode(node3, 14, 153)
    net.connectNodes(node2, node3, "molecules", "nodes")
    node3.toggleNodeExpand_cb()
    # msms
    node4 = AtomsAsMSMS(library=molkitlib)
    net.addNode(node4, 263, 267)
    net.connectNodes(node3, node4, "nodes", "atoms")
    net.connectNodes(node2, node4, "radii", "radii")
    pause()
    # check data
    from mslib import MSMS
    assert isinstance(node4.outputPorts[0].data, MSMS),\
           "Expected %s, got %s"%(MSMS, node4.outputPorts[0].data.__class__)
    assert len(node4.outputPorts[0].data.coords) == 327,\
           "Expected 327, got %s"%len(node4.outputPorts[0].data.coords)
    # just for the fun of it, click the united radii checkbutton a couple times
    node2.inputPorts[1].widget.set(1)
    node2.inputPorts[1].widget.set(0)
    node2.inputPorts[1].widget.set(1)
    node2.inputPorts[1].widget.set(0)
Example #3
0
def test_02_NodeSelector():
    # test the select 'node' node
    net = ed.currentNetwork
    net.runOnNewData.value = True
    node1 = ReadMolecule(library=molkitlib)
    net.addNode(node1, 20, 20)
    node1.inputPorts[0].widget.set(os.path.abspath("1crn.pdb"))
    node2 = NodeSelector(library=molkitlib)
    net.addNode(node2, 30, 100)
    net.connectNodes(node1, node2, "MolSets", "nodes")
    node2.toggleNodeExpand_cb()
    pause()
    # because we run(), upon connecting we pass the data and the output of
    # node2 should have data
    # default node output is AtomSet
    from MolKit.molecule import AtomSet
    data = node2.outputPorts[0].data
    assert isinstance(
        data, AtomSet), "Expected %s, got %s" % (AtomSet, data.__class__)
    # switch to ResidueSet
    from MolKit.protein import ResidueSet
    node2.inputPorts[1].widget.set("Residue")
    data = node2.outputPorts[0].data
    assert isinstance(
        data, ResidueSet), "Expected %s, got %s" % (ResidueSet, data.__class__)
    # switch to Chain
    from MolKit.protein import ChainSet
    node2.inputPorts[1].widget.set("Chain")
    data = node2.outputPorts[0].data
    assert isinstance(
        data, ChainSet), "Expected %s, got %s" % (ChainSet, data.__class__)
    # switch to Molecule
    from MolKit.molecule import MoleculeSet
    node2.inputPorts[1].widget.set("Molecule")
    data = node2.outputPorts[0].data
    assert isinstance(
        data,
        MoleculeSet), "Expected %s, got %s" % (MoleculeSet, data.__class__)
def test_02_NodeSelector():
    # test the select 'node' node
    net = ed.currentNetwork
    net.runOnNewData.value = True    
    node1 = ReadMolecule(library=molkitlib)
    net.addNode(node1, 20, 20)
    node1.inputPorts[0].widget.set(os.path.abspath("1crn.pdb"))
    node2 = NodeSelector(library=molkitlib)
    net.addNode(node2, 30, 100)
    net.connectNodes(node1, node2, "MolSets", "nodes")
    node2.toggleNodeExpand_cb()
    pause()
    # because we run(), upon connecting we pass the data and the output of
    # node2 should have data
    # default node output is AtomSet
    from MolKit.molecule import AtomSet
    data = node2.outputPorts[0].data
    assert isinstance(data, AtomSet), "Expected %s, got %s"%(
        AtomSet, data.__class__)
    # switch to ResidueSet
    from MolKit.protein import ResidueSet
    node2.inputPorts[1].widget.set("Residue")
    data = node2.outputPorts[0].data
    assert isinstance(data, ResidueSet), "Expected %s, got %s"%(
        ResidueSet, data.__class__)
    # switch to Chain
    from MolKit.protein import ChainSet
    node2.inputPorts[1].widget.set("Chain")
    data = node2.outputPorts[0].data
    assert isinstance(data, ChainSet), "Expected %s, got %s"%(
        ChainSet, data.__class__)
    # switch to Molecule
    from MolKit.molecule import MoleculeSet
    node2.inputPorts[1].widget.set("Molecule")
    data = node2.outputPorts[0].data
    assert isinstance(data, MoleculeSet), "Expected %s, got %s"%(
        MoleculeSet, data.__class__)