def get_response_content(fs): """ @param fs: a FieldStorage object containing the cgi arguments @return: the response """ # get a properly formatted newick tree with branch lengths T, B, N = FtreeIO.newick_to_TBN(fs.tree) # get the vertex valuations reflect = False all_valuations = TB_to_harmonic_valuations(T, B, reflect) fiedler_valuations = all_valuations[1] # do the layout v_to_location = FtreeAux.equal_daylight_layout(T, B, 3) # get the vertex list and the initial vertex locations vertices = Ftree.T_to_leaves(T) + Ftree.T_to_internal_vertices(T) X_in = np.array([tuple(v_to_location[v]) for v in vertices]) # fit the tree to the physical size physical_size = (fs.width, fs.height) theta = layout.get_best_angle(X_in, physical_size) X = layout.rotate_2d_centroid(X_in, theta) sz = layout.get_axis_aligned_size(X) sf = layout.get_scaling_factor(sz, physical_size) X *= sf # get the map from id to location for the final tree layout v_to_location = dict((v, tuple(r)) for v, r in zip(vertices, X)) # draw the image context = TikzContext() draw_plain_branches_ftree(T, B, context, v_to_location) draw_ticks_ftree(T, B, context, fiedler_valuations, v_to_location) draw_labels_ftree(T, N, context, v_to_location) context.finish() # get the response tikzpicture = context.get_text() return tikz.get_response(tikzpicture, fs.tikzformat)
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)
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())
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)
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)
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())
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)
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)
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)
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)
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)
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)