cocoatree.visualization.update_tree_ete3_and_return_style

cocoatree.visualization.update_tree_ete3_and_return_style(tree_ete3, df_annot, sector_id=None, sector_seq=None, meta_data=None, show_leaf_name=True, fig_title='', linewidth=1, linecolor='#000000', bootstrap_style={}, tree_scale=200, metadata_colors=None, t_sector_seq=False, t_sector_heatmap=False, colormap='inferno')[source]

Update ete3 tree with sector info and attributes and return tree_style for further visualization.

Parameters

tree_ete3ete3’s tree object,

as imported by io.load_tree_ete3()

annot_file : pandas dataframe of the annotation file

sector_idlist of sector identifiers, as imported by io.load_msa()

the ids must match with the tree’s leaves id

sector_seqcorresponding list of sector sequences to display,

as imported by io.load_msa()

meta_datatuple of annotations to display

(from annotation file’s header)

show_leaf_nameboolean, optional, default: True

whether to show leaf names.

linewidthint, optional, default: 1

width of the lines in the tree

linecolorstr, optional, default: “#000000”

color of the lines

bootstrap_styledict, optional,

fgcolor: color of the bootstrap node, default: “darkred” size: size of the bootstrap node, default: 10 support: int between 0 and 100, minimum support level for display

tree_scaleint, optional, default: 200

sets the scale of the tree in ETE3: the higher, the larger the tree will be (in width)

metadata_colorsdict, str, or None, optional, default: None
colors for the metadata:
  • None: generates automatically the colors

  • str: uses a Matplotlib colormap to generate the colors

  • dict: specifies colors for each matadata entry

    {key: color}

fig_title : figure title (str)

t_sector_seqboolean,

whether to show the sequences of the sector

t_sector_heatmapboolean,

whether to add a heatmap of the identity matrix between sector sequences

Returns

tree_style : TreeStyle class from ete3

column_endint, the number of columns after the tree. If you want to

plot anything else alongside the tree, the column number should be equal to this value.

Examples using cocoatree.visualization.update_tree_ete3_and_return_style

Simple tree visualization with metadata

Simple tree visualization with metadata

Plot sector together with (phylogenetic) tree and metadata

Plot sector together with (phylogenetic) tree and metadata

Specifying metadata’s colors

Specifying metadata's colors