Source code for schrodinger.application.dendrogram.proteinDendrogram
import sys
from schrodinger.Qt.QtWidgets import QApplication
from schrodinger.ui.qt.dendrogram import Dendrogram
[docs]def initializeLabels(tree, node):
    label = node.getNode().getLabel()
    if not label:
        label = str(len(node.getLeafIndices()))
    node.setLabel(label) 
if __name__ == '__main__':
    app = QApplication(sys.argv)
    string = '((3KIN_A:0.03587,4UXT_C:0.05426):0.02721,1MKJ_A:0.08100,(3ZFC_A:0.30808,3B6U_A:0.30536):0.22831);'
    try:
        filename = sys.argv[1]
        with open(filename, "r") as myfile:
            string = myfile.read().replace('\n', '')
    except:
        print("could not read file. Falling back on default string")
    dendro = Dendrogram()
    dendro.loadTreeFromNewick(string)
    view = dendro.showTree(initializeLabels)
    view.show()
    dendro.showLeaves(6)
    options = dendro.getoptionsGUI()
    sys.exit(app.exec_())