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
    valuations = [Harmonic.get_harmonic_valuations(
        tree, i) for i in range(fs.first_index, fs.last_index+1)]
    # 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]
        physical_size = (fs.width, fs.height)
        return DrawEigenLacing.get_forest_image_revised(
                tree, physical_size, ext, valuations,
                fs.draw_background, fs.draw_labels,
                fs.inner_margin, fs.outer_margin, fs.reflect_trees)
    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
    valuations = [
        Harmonic.get_harmonic_valuations(tree, i)
        for i in range(fs.first_index, fs.last_index + 1)
    ]
    # 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]
        physical_size = (fs.width, fs.height)
        return DrawEigenLacing.get_forest_image_revised(
            tree, physical_size, ext, valuations, fs.draw_background,
            fs.draw_labels, fs.inner_margin, fs.outer_margin, fs.reflect_trees)
    except CairoUtil.CairoUtilError as e:
        raise HandlingError(e)