treefix tree output format conversion
2
0
Entering edit mode
8.2 years ago

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 • 2.3k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
1
Entering edit mode
8.2 years ago
Brice Sarver ★ 3.8k

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

ADD COMMENT
0
Entering edit mode

I forgot to mention that, there are ~12k files !

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
8.2 years ago
dago ★ 2.8k

Did you give it a try here?

ADD COMMENT

Login before adding your answer.

Traffic: 1616 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6