#!/usr/bin/python '''Exercises the tree improve service. Uses nexus file -filename arg pair to get the matrix and starting tree from a NEXUS file.''' from PIPRes.util.client_import import * if __name__ == '__main__': _LOG = cipresGetLogger('pipres.service_impl.client.tree_improve') registryWrapper, mat, startingTree = cipresClientInit(sys.argv, returnMatrix = True, returnTree = True) if not (mat and startingTree): sys.exit('must specify a NEXUS file with a data matrix and tree using -filename arguments') treeEvaluateObjRef = registryWrapper.getServiceOrExit(CipresIDL_api1.TreeEvaluate) try: _LOG.debug('about to set matrix') treeEvaluateObjRef.setMatrix(mat) _LOG.debug('startingTree = %s' % startingTree) treeEvaluateObjRef.setTree(startingTree) #cmd = 'default hs swap = nni;' #_LOG.debug('configuration command = "%s"' % cmd) #treeEvaluateObjRef.execute(cmd) _LOG.debug('about to evaluateTree') returnedTree = treeEvaluateObjRef.evaluateTree(CORBA.Object._nil) score = 'score = %s' % str(returnedTree.m_score) _LOG.debug(score) print score finally: treeEvaluateObjRef.remove()