In [1]:
import toytree

In [23]:
#rtre.drop_tips(contemp).draw();

In [74]:
import toyplot

toyplot.color.Palette("Set3")
colors = toyplot.color.brewer.palette("Set2") 
css = [toyplot.color.to_css(i) for i in colors]

In [102]:
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


Out[102]:
retroflexusretroflexusretroflexuswrightiiwrightiipowelliipowelliipowelliiacutilobusacutilobuscruentuscruentuscruentuscruentuscruentushybridushybridushybridushypochondriacushypochondriacushypochondriacushypochondriacushypochondriacushypochondriacusreferencehybridushybriduscaudatusquitensisquitensiscaudatuscaudatuscaudatuscaudatusquitensispalmeripalmeripalmeripalmeripalmeriwatsoniipalmerispinosusspinosusspinosusspinosusspinosusdubiusdubiusdubiustricolortricolortricolortricolorasplundiigraecizansgraecizansgraecizansblitumblitumblitumviridisviridisdeflexusdeflexusdeflexusmuricatusstandleyanusalbusalbusalbuscalifornicusblitoidesblitoidescrassipescrassipestuberculatustuberculatustuberculatusarenicolatuberculatustuberculatusfloridanusgreggiigreggiiarenicolaacanthochitoncannabinuscannabinusaustralisaustralisfimbriatusfimbriatusquinoa

In [112]:
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


Out[112]:
referencehypochondriacushybridushypochondriacushypochondriacushypochondriacushypochondriacushypochondriacuscruentuscruentuscruentuscruentuscruentushybridushybridushybridushybridusquitensisquitensiscaudatusquitensiscaudatuscaudatuscaudatuscaudatusspinosusspinosusspinosusspinosusspinosusdubiusdubiusdubiusacutilobusacutilobusretroflexusretroflexusretroflexuswrightiiwrightiipowelliipowelliipowelliifimbriatusfimbriatusgreggiigreggiiarenicolaacanthochitontuberculatustuberculatusfloridanustuberculatustuberculatusarenicolatuberculatuspalmeripalmeripalmeripalmeripalmeriwatsoniipalmericannabinuscannabinusaustralisaustralisalbusalbusalbuscalifornicusblitoidesblitoidescrassipescrassipestricolortricolortricolortricolorasplundiigraecizansgraecizansgraecizansblitumblitumblitumstandleyanusdeflexusdeflexusmuricatusviridisdeflexusviridisquinoa

In [109]:
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


Out[109]:
hypochondriacusreferencehybridushypochondriacushypochondriacushypochondriacushypochondriacushypochondriacuscruentuscruentuscruentuscruentuscruentushybridushybridushybridushybridusquitensisquitensiscaudatusquitensiscaudatuscaudatuscaudatuscaudatusspinosusspinosusspinosusspinosusspinosusdubiusdubiusdubiusacutilobusacutilobusretroflexusretroflexusretroflexuswrightiiwrightiipowelliipowelliipowelliifimbriatusfimbriatustuberculatustuberculatusfloridanustuberculatustuberculatusarenicolatuberculatusgreggiigreggiiarenicolaacanthochitonpalmeripalmeripalmeripalmeripalmeriwatsoniipalmericannabinuscannabinusaustralisaustralisalbusalbusalbuscalifornicusblitoidesblitoidescrassipescrassipestricolortricolortricolortricolorasplundiigraecizansgraecizansgraecizansblitumblitumblitumstandleyanusviridisdeflexusviridisdeflexusdeflexusmuricatusquinoa

In [ ]: