Esempio n. 1
0
def get_response_content(fs):
    # get a properly formatted newick tree with branch lengths
    tree = Newick.parse(fs.tree, SpatialTree.SpatialTree)
    # get the vertex valuations
    id_to_v1 = Harmonic.get_harmonic_valuations(tree, fs.eig_idx1)
    id_to_v2 = Harmonic.get_harmonic_valuations(tree, fs.eig_idx2)
    # do the layout
    try:
        layout = FastDaylightLayout.StraightBranchLayout()
        layout.do_layout(tree)
    except RuntimeError as e:
        pass
    # draw the image
    try:
        ext = Form.g_imageformat_to_ext[fs.imageformat]
        return DrawEigenLacing.get_single_tree_image(
                tree, (640, 480), ext, id_to_v1, id_to_v2)
    except CairoUtil.CairoUtilError as e:
        raise HandlingError(e)
Esempio n. 2
0
def get_response_content(fs):
    # get a properly formatted newick tree with branch lengths
    tree = Newick.parse(fs.tree, SpatialTree.SpatialTree)
    # get the vertex valuations
    id_to_v1 = Harmonic.get_harmonic_valuations(tree, fs.eig_idx1)
    id_to_v2 = Harmonic.get_harmonic_valuations(tree, fs.eig_idx2)
    # do the layout
    try:
        layout = FastDaylightLayout.StraightBranchLayout()
        layout.do_layout(tree)
    except RuntimeError as e:
        pass
    # draw the image
    try:
        ext = Form.g_imageformat_to_ext[fs.imageformat]
        return DrawEigenLacing.get_single_tree_image(tree, (640, 480), ext,
                                                     id_to_v1, id_to_v2)
    except CairoUtil.CairoUtilError as e:
        raise HandlingError(e)