Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expected collapse branch to outline instead of traingle #666

Open
dengzq1234 opened this issue Jan 23, 2023 · 0 comments
Open

expected collapse branch to outline instead of traingle #666

dengzq1234 opened this issue Jan 23, 2023 · 0 comments
Assignees

Comments

@dengzq1234
Copy link
Contributor

I tried to design a layout that collapse target branch(taxonomic rank) to a outline instead of a traingle clade, unfortunately I wasn't able to do so. I wonder if I execute the correct parameters

image

example tree
gtdb_annotated.nw.txt

example code

from ete4 import Tree
# from staple_layouts import LayoutBarplot
# from conditional_layouts import LayoutBinary
from ete4.smartview import TreeStyle, NodeStyle, TreeLayout
from ete4.smartview  import RectFace, CircleFace, SeqMotifFace, TextFace, OutlineFace, LegendFace



TREEFILE = './gtdb_annotated.nw.txt'

popup_prop_keys = ['name', 'dist', 'support', 'rank', 'sci_name', 
                    'taxid', 'lineage', 'named_lineage']

t = Tree(TREEFILE, format=1)
level = 2 

def collapse_order():
    def layout_fn(node):
        color="green"
        if not node.is_root() and  node.props.get('rank') == 'order':
            #face_name = TextFace(node.props.get('sci_name'), color=color)
            face_name = OutlineFace(node.props.get('sci_name'), color=color, collapsing_height= float("inf"))
            node.sm_style["draw_descendants"] = False
            node.sm_style["outline_color"] = color
            node.add_face(face_name, column = 8,  position = 'aligned', collapsed_only=True)
    layout_fn.name = "level4_order"
    return layout_fn
    return 

layouts = [
    TreeLayout(name='order', ns=collapse_order())

]

t.explore(tree_name='example',layouts=layouts, \
            popup_prop_keys=popup_prop_keys)
@jordibc jordibc removed their assignment Jan 23, 2023
@dengzq1234 dengzq1234 changed the title collapse branch to outline instead of traingle expected collapse branch to outline instead of traingle Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants