# Modules to build the tree from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor from Bio.Phylo import draw from Bio import Phylo, AlignIO import subprocess import matplotlib import matplotlib.pyplot as plt alignment = AlignIO.read('tree_example.fasta', 'fasta') # reading the alignment file calculator = DistanceCalculator('ident') dm = calculator.get_distance(alignment) # distance matrix constructor = DistanceTreeConstructor() tree = constructor.nj(dm) # build with neighbour joining algorithm a tree from dm Phylo.write(tree, 'TreeToCutOff.nwk', 'newick') plt.rc('font', size=1) # controls default text sizes #HERE IS THE SETTING FOR THAT ALLOWS ME TO HIDE THE BRANCH TIP LABELS plt.rc('axes', titlesize=14) # fontsize of the axes title plt.rc('xtick', labelsize=10) # fontsize of the tick labels plt.rc('ytick', labelsize=10) # fontsize of the tick labels plt.rc('figure', titlesize=18) # fontsize of the figure title draw(tree, do_show=False) plt.savefig("Bioinfo_tree.png", format='png', dpi=500) # Modified from https://bioinformatics.stackexchange.com/questions/4337/biopython-phylogenetic-tree-replace-branch-tip-labels-by-sequence-logos