This is a test version of Biostars. For the public version, visit https://www.biostars.org.
treefix tree output format conversion

Hello,

I have trees from treefix. The format in tree is a kind of stacked version of newick format. Like this:

                        (
                          Taxon_A,
                          Taxon_B
                         );

How to convert this into normal newick format ? (Taxon_A,Taxon_B);. Is there any existing method?

Thanks in Advance,

AP

newick tree-format

ete3 can read newick files even if there are new lines and spaces in it. use tree.write() to export back in a clean newick string.

2 answers

This is simple: replace all newlines with nothing. Something like this using sed.

Not a problem! Loop, remove newlines, and combine with >>.

Did you give it a try here?

Log in to answer this question.