eaton-lab / toytree

A minimalist tree plotting library using toyplot graphs
http://eaton-lab.org/toytree
BSD 3-Clause "New" or "Revised" License
169 stars 28 forks source link

Randomtree `random_names` isn't working #39

Closed isaacovercast closed 4 years ago

isaacovercast commented 4 years ago

Looks like all the random tree functions got a random_names parameter, but it doesn't appear to be doing anything.

        nidx = list(range(tre.ntips))
        if random_names:
            random.shuffle(nidx)
        for idx, node in tre.idx_dict.items():
            if node.is_leaf():
                node.name = "r{}".format(nidx[idx])

The nidx list does get randomized, but it's never used to construct the names. You probably are aware of this already ;)

eaton-lab commented 4 years ago

Fixed: https://github.com/eaton-lab/toytree/blob/master/sandbox/39-randomtrees-randomnames.ipynb