Пример #1
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = '\n'.join(get_tikz_lines(fs))
    tikzpicture = tikz.get_picture(tikz_body, 'auto')
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #2
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = "\n".join(get_tikz_lines(fs))
    tikzpicture = tikz.get_picture(tikz_body, "auto")
    return tikz.get_response(tikzpicture, fs.tikzformat, tikz.get_w_color_package_set(), tikz.get_w_color_preamble())
Пример #3
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = '\n'.join(get_tikz_lines(fs))
    tikzpicture = tikz.get_picture(tikz_body, 'auto')
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #4
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = get_tikz_body(fs)
    tikzpicture = tikz.get_picture(tikz_body, "auto")
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #5
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = get_tikzpicture_body(fs.ncurves, fs.nsegs, fs.morph)
    tikzpicture = tikz.get_picture(tikz_body, 'auto')
    return tikz.get_response(
            tikzpicture, fs.tikzformat,
            tikz.get_w_color_package_set(), tikz.get_w_color_preamble())
Пример #6
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = get_tikz_body(fs)
    tikzpicture = tikz.get_picture(tikz_body, 'auto')
    tikzlibraries = ['decorations.pathreplacing']
    return tikz.get_response(
            tikzpicture, fs.tikzformat, tikzlibraries=tikzlibraries)
Пример #7
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = get_tikz_body(fs)
    tikzpicture = tikz.get_picture(tikz_body, 'auto')
    tikzlibraries = ['decorations.pathreplacing']
    return tikz.get_response(tikzpicture,
                             fs.tikzformat,
                             tikzlibraries=tikzlibraries)
Пример #8
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body_lines = TreeProjection.get_tikz_lines(fs.tree,
                                                    fs.eigenvector_index,
                                                    fs.yaw, fs.pitch)
    tikz_body = '\n'.join(tikz_body_lines)
    options = {'x': '1em', 'y': '1em', 'inner sep': '0pt'}
    tikzpicture = tikz.get_picture(tikz_body, **options)
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #9
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = "\n".join(get_tikz_lines())
    tikzpicture = tikz.get_picture(tikz_body, "auto")
    packages = ["color"]
    preamble_lines = []
    preamble_lines.append(tikz.get_w_color_preamble())
    preamble_lines.extend(get_tikz_style_definitions())
    preamble = "\n".join(preamble_lines)
    return tikz.get_response(tikzpicture, fs.tikzformat, packages, preamble)
Пример #10
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body = '\n'.join(get_tikz_lines())
    tikzpicture = tikz.get_picture(tikz_body, 'auto')
    packages = ['color']
    preamble_lines = []
    preamble_lines.append(tikz.get_w_color_preamble())
    preamble_lines.extend(get_tikz_style_definitions())
    preamble = '\n'.join(preamble_lines)
    return tikz.get_response(tikzpicture, fs.tikzformat, packages, preamble)
Пример #11
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    tikz_body_lines = TreeProjection.get_tikz_lines(
            fs.tree, fs.eigenvector_index, fs.yaw, fs.pitch)
    tikz_body = '\n'.join(tikz_body_lines)
    options = {
            'x' : '1em',
            'y' : '1em',
            'inner sep': '0pt'}
    tikzpicture = tikz.get_picture(tikz_body, **options)
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #12
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    T, B, N = FtreeIO.newick_to_TBN(fs.tree_string)
    # sanitize taxon labels if requested
    if fs.sanitization:
        for v in N:
            N[v] = latexutil.sanitize(N[v])
    # scale branch lengths so the diameter is 1
    diameter = np.max(Ftree.TB_to_D(T, B, Ftree.T_to_leaves(T)))
    # scale the branch lengths
    for u_edge in T:
        B[u_edge] /= diameter
    info = FigureInfo(T, B, N, fs.label_mode)
    # get the texts
    tikz_bodies = [
            info.get_tikz_tree(fs.tree_layout),
            info.get_tikz_MDS_full(),
            info.get_tikz_MDS_partial(),
            info.get_tikz_MDS_harmonic(),
            ]
    tikz_pictures = []
    for b in tikz_bodies:
        tikzpicture = tikz.get_picture(b, 'auto', scale=fs.scaling_factor)
        tikz_pictures.append(tikzpicture)
    figure_body = '\n'.join([
        '\\subfloat[]{',
        tikz_pictures[0],
        '}',
        '\\subfloat[]{',
        tikz_pictures[1],
        '} \\\\',
        '\\subfloat[]{',
        tikz_pictures[2],
        '}',
        '\\subfloat[]{',
        tikz_pictures[3],
        '}',
        ])
    packages = ['tikz', 'subfig']
    preamble = ''
    figure_caption = None
    figure_label = None
    return latexutil.get_centered_figure_response(
            figure_body, fs.latexformat, figure_caption, figure_label,
            packages, preamble)
Пример #13
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    # decide which hardcoded tree to use
    if fs.six_leaves:
        layout = SixLeafLayout()
    elif fs.seven_leaves:
        layout = SevenLeafLayout()
    # decide which subtrees to show
    show_full_tree = False
    show_pruned_trees = False
    if fs.full_tree_only:
        show_full_tree = True
    if fs.pruned_trees_only:
        show_pruned_trees = True
    if fs.all_trees:
        show_full_tree = True
        show_pruned_trees = True
    # get the texts
    tikz_body = layout.get_tikz_contents(show_full_tree, show_pruned_trees)
    tikzpicture = tikz.get_picture(tikz_body, 'auto', scale=fs.scaling_factor)
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #14
0
def get_response_content(fs):
    """
    @param fs: a FieldStorage object containing the cgi arguments
    @return: the response
    """
    # decide which hardcoded tree to use
    if fs.six_leaves:
        layout = SixLeafLayout()
    elif fs.seven_leaves:
        layout = SevenLeafLayout()
    # decide which subtrees to show
    show_full_tree = False
    show_pruned_trees = False
    if fs.full_tree_only:
        show_full_tree = True
    if fs.pruned_trees_only:
        show_pruned_trees = True
    if fs.all_trees:
        show_full_tree = True
        show_pruned_trees = True
    # get the texts
    tikz_body = layout.get_tikz_contents(show_full_tree, show_pruned_trees)
    tikzpicture = tikz.get_picture(tikz_body, 'auto', scale=fs.scaling_factor)
    return tikz.get_response(tikzpicture, fs.tikzformat)
Пример #15
0
def get_tikz_text(newick, scaling_factor):
    options = {'inner sep': '0pt', 'scale': scaling_factor}
    tikz_body = '\n'.join(get_tikz_lines(newick))
    return tikz.get_picture(tikz_body, **options)
Пример #16
0
def get_tikz_text(tikz_body):
    return tikz.get_picture(tikz_body, scale='0.8')
Пример #17
0
def get_tikz_text(newick, scaling_factor):
    options = {"inner sep": "0pt", "scale": scaling_factor}
    tikz_body = "\n".join(get_tikz_lines(newick))
    return tikz.get_picture(tikz_body, **options)
Пример #18
0
def get_tikz_text(tikz_body):
    return tikz.get_picture(tikz_body, scale='0.8')