This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Biopython newick treeio removes comments

I have a biopython program that uses newick NHX extensions to pass information to the "R" tree plotting program ggtree. I am certain this used to work, but with the current version of biopython, it does not seem possible to write arbitrary comments in newick output.

(1) Am I confused, has BioPython phylo.write('newick') never supported NHX comments? (2) is there an option for phylo.write() to write out the comment string?

biopython phylo.write

1 answer

This is occurring because of a typo in the BioPython Phylo/NewickIO.py code (line 87), where the word "comment" is mis-spelled "coment". Fixing the typo fixes the problem. I have opened an issue on GitHub.

Log in to answer this question.