import toytree
#rtre.drop_tips(contemp).draw();
import toyplot
toyplot.color.Palette("Set3")
colors = toyplot.color.brewer.palette("Set2")
css = [toyplot.color.to_css(i) for i in colors]
data = "/home/deren/Desktop/RAxML_bootstrap.rax_139samp_fixed"
tre = toytree.tree(data)
contemp = [i for i in tre.get_tip_labels() if "contem" in i]
tre = tre.drop_tips(contemp)
rtre = tre.root("quinoa")
colors = ['black'] * len(rtre)
for i in range(0, 50):
colors[i] = toytree.colors[1]
for i in range(50, 61):
colors[i] = toytree.colors[0]
for i in range(61, 68):
colors[i] = toytree.colors[3]
for i in range(68, 76):
colors[i] = toytree.colors[4]
for i in range(76, 91):
colors[i] = toytree.colors[2]
for i in range(91, 93):
colors[i] = toytree.colors[6]
# make tree
canvas, axes = rtre.draw(
use_edge_lengths=False,
tip_labels_style={"font-size": "10px"},
tip_labels=[i.split("_")[0].split("-")[0] for i in rtre.get_tip_labels()],
tip_labels_colors=colors,
);
# i
import toyplot.svg
toyplot.svg.render(canvas, "/home/deren/websites/eaton-lab/slides/data-svg/Amaranth-full.svg")
canvas
data = "/home/deren/Desktop/RAxML_bipartitions.PSII"
tre = toytree.tree(data)
contemp = [i for i in tre.get_tip_labels() if "contem" in i]
tre = tre.drop_tips(contemp)
rtre = tre.root("quinoa").collapse_nodes(min_support=70)
canvas, axes = rtre.draw(
use_edge_lengths=False,
tip_labels_style={"font-size": "10px"},
tip_labels=[i.split("_")[0].split("-")[0] for i in rtre.get_tip_labels()],
tip_labels_colors=colors,
#node_labels="support",
);
import toyplot.svg
toyplot.svg.render(
canvas,
"/home/deren/websites/eaton-lab/slides/data-svg/Amaranth-poly-PSII.svg",
)
canvas
data = "/home/deren/Desktop/RAxML_bestTree.PSII"
tre = toytree.tree(data)
contemp = [i for i in tre.get_tip_labels() if "contem" in i]
tre = tre.drop_tips(contemp)
rtre = tre.root("quinoa")
colors = ['black'] * len(rtre)
for i in range(0, 43):
colors[i] = toytree.colors[1]
for i in range(43, 45):
colors[i] = toytree.colors[6]
for i in range(45, 56):
colors[i] = toytree.colors[2]
for i in range(56, 63):
colors[i] = toytree.colors[1]
for i in range(63, 67):
colors[i] = toytree.colors[2]
for i in range(67, 75):
colors[i] = toytree.colors[4]
for i in range(75, 86):
colors[i] = toytree.colors[0]
for i in range(86, 93):
colors[i] = toytree.colors[3]
# make tree
canvas, axes = rtre.draw(
use_edge_lengths=False,
tip_labels_style={"font-size": "10px"},
tip_labels=[i.split("_")[0].split("-")[0] for i in rtre.get_tip_labels()],
tip_labels_colors=colors,
);
# i
import toyplot.svg
toyplot.svg.render(
canvas,
"/home/deren/websites/eaton-lab/slides/data-svg/Amaranth-PSII.svg",
)
canvas