Esempio n. 1
0
def botstrap_symbols(node):
    node_style = color_subtypes(node)
    if hasattr(node, "suport_symbol"):
        add_face_to_node(
            face=TextFace(node.suport_symbol),
            node=node,
            column=0,
        )
    node.set_style(node_style)
Esempio n. 2
0
def mylayout(node):
    # If node is a leaf
    if node.is_leaf():
        # And a line profile
        add_face_to_node(profileFace, node, 0, aligned=True)
        node.img_style["size"] = 0
        add_face_to_node(nameFace, node, 1, aligned=True)

    # If node is internal
    else:
        # If silhouette is good, creates a green bubble
        if node.silhouette > 0:
            validationFace = TextFace("Silh=%0.2f" % node.silhouette,
                                      "Verdana", 10, "#056600")
            node.img_style["fgcolor"] = "#056600"
        # Otherwise, use red bubbles
        else:
            validationFace = TextFace("Silh=%0.2f" % node.silhouette,
                                      "Verdana", 10, "#940000")
            node.img_style["fgcolor"] = "#940000"

        # Sets node size proportional to the silhouette value.
        node.img_style["shape"] = "sphere"
        if node.silhouette <= 1 and node.silhouette >= -1:
            node.img_style["size"] = 15 + int((abs(node.silhouette) * 10)**2)

        # If node is very internal, draw also a bar diagram
        # with the average expression of the partition
        add_face_to_node(validationFace, node, 0)
        if len(node) > 100:
            add_face_to_node(cbarsFace, node, 1)
Esempio n. 3
0
def mylayout(node):
    profileFace  = ProfileFace(matrix_max, matrix_min, matrix_avg, \
                                         200, 14, "heatmap")
    cbarsFace = ProfileFace(matrix_max,matrix_min,matrix_avg,200,70,"cbars")

    # If node is a leaf
    if node.is_leaf():
        # And a line profile
        add_face_to_node(profileFace, node, 0, aligned=True)
        node.img_style["size"]=0
        add_face_to_node(nameFace, node, 1, aligned=True)

    # If node is internal
    else:
        # If silhouette is good, creates a green bubble
        if node.silhouette>0:
            validationFace = TextFace("Silh=%0.2f" %node.silhouette,
                                      "Verdana", 10, "#056600")
            node.img_style["fgcolor"]="#056600"
        # Otherwise, use red bubbles
        else:
            validationFace = TextFace("Silh=%0.2f" %node.silhouette,
                                      "Verdana", 10, "#940000")
            node.img_style["fgcolor"]="#940000"

        # Sets node size proportional to the silhouette value.
        node.img_style["shape"]="sphere"
        if node.silhouette<=1 and node.silhouette>=-1:
            node.img_style["size"]= 15+int((abs(node.silhouette)*10)**2)

        # If node is very internal, draw also a bar diagram
        # with the average expression of the partition
        add_face_to_node(validationFace, node, 0)
        if len(node)>100:
            add_face_to_node(cbarsFace, node, 1)
Esempio n. 4
0
    def sel_mylayout(node):
        node.set_style(my_node_style)

        if node.is_leaf():
            # add names in larger font + italics
            species_name = AttrFace("name", fsize=12, fstyle="italic")
            add_face_to_node(species_name,
                             node,
                             column=0,
                             position="branch-right")
            # add absence/presence matrix
            for i, value in enumerate(getattr(node, "profile", [])):
                if value > 0:
                    color = "#FF0000"
                else:
                    color = "#EEEEEE"
                my_face = CircleFace(8, color, style="circle")
                my_face.margin_right = 3
                my_face.margin_bottom = 3
                add_face_to_node(my_face, node, position="aligned", column=i)
Esempio n. 5
0
    def diamond_layout(node):
        # Run the layout passed in first before
        # filling in the heatmap
        layout(node)

        N = AttrFace("name", fsize=label_size, fgcolor=labelcolor)

        # background colors
        c, found = _get_node_color(bgcolors, node, "")
        if found:
            nst = NodeStyle()
            nst["bgcolor"] = c
            node.set_style(nst)

        if node.name in collapsed_nodes:
            # scaling factor for approximating subtree depth
            depth = node.get_farthest_leaf(topology_only=True)
            w = depth[1] * depth_scaling
            # scaling factor for approximating for subtree width
            h = len(node) * breadth_scaling
            c, _ = _get_node_color(cladecolors, node, "#0000FF")

            C = CollapsedDiamondFace(width=w, height=h, color=c)
            node.img_style['draw_descendants'] = False

            # And place as a float face over the tree
            faces.add_face_to_node(C, node, 0, position="float")
            faces.add_face_to_node(N, node, 1, position="float")
        else:
            faces.add_face_to_node(N, node, 0)
Esempio n. 6
0
 def mylayout(node):
     # If node is a leaf
     if node.is_leaf():
         # And a line profile
         add_face_to_node(profileFace, node, 0, aligned=True)
         node.img_style["size"]=2