3

I have a fasta file of aligned sequences that I want to create a phylogenetic tree for. I can create a normal branched tree like this... Normal branched phylogenetic tree

but would like to convert it so it looks something like this...Circular phylogenetic tree

The code I have used so far is below (the out_file is a filepath to the aligned fasta file)


from Bio import AlignIO
from Bio import Phylo
from Bio.Phylo.TreeConstruction import DistanceTreeConstructor
import matplotlib
import matplotlib.pyplot as plt

align = AlignIO.read(out_file, "fasta")
# print(align)

from Bio.Phylo.TreeConstruction import DistanceCalculator
calculator = DistanceCalculator('identity')
dm = calculator.get_distance(align)


constructor = DistanceTreeConstructor()
tree = constructor.upgma(dm)


Phylo.draw_ascii(tree)
fullerpj
  • 31
  • 1
  • I suggest manually editing a tree file with https://icytree.org. Generally good idea to use a responsive editor for large/complicated trees. – Ghoti May 27 '21 at 23:08
  • I'm a developer of [pyCircos](https://github.com/ponnhide/pyCircos) which provides the function to draw circular phylogenetic tree visualization. If you are still interested in this issue, pyCircos would help to solve it. – Hideto Apr 10 '22 at 19:12

1 Answers1

1

One possibility is using ete3:

import matplotlib.pyplot as plt
from ete3 import Tree, TreeStyle
t = Tree("(((A,B),(C,D)),(E,F,G));")
circular_style = TreeStyle()
circular_style.mode = "c"
circular_style.scale = 20
t.render(figdir + "test_tree.png", w=183, units="mm", tree_style=circular_style)

enter image description here

Roger Vadim
  • 373
  • 2
  • 12