Hello,
I'm working on gain/loss gene events and for that I'm using a tool that gives as an output a gene tree in Graphviz format (dot language) like this:
digraph G {
0[label=Series];
1[label=Parallel];
2[label=Series];
3[label=v2];
4[label=v5];
5[label=v8];
6[label=Series];
7[label=v0];
8[label=v3];
9[label=v6];
10[label=v1];
11[label=v4];
12[label=v7];
0->1 ;
1->2 ;
2->3 ;
2->4 ;
2->5 ;
1->6 ;
6->7 ;
6->8 ;
6->9 ;
0->10 ;
0->11 ;
0->12 ;
}
It represents the tree as a directed graph in direction from the root to the leaves. Then it enumerates the nodes and each node has a label. The last part is the edges of the tree.
I would like to convert this output to Newick format. However I don't know much about programming so I was wondering if you can help me with this :)
I don't know of an easy solution short of writing a converter yourself. You could explore converting to another intermediate graph format and see if there is any tool that can then do the conversion from there to Newick (I don't know of any from the top of my head). I think your best bet would be to convert your dot file to a distance matrix from which you rebuild the tree with a phylogeny software that can read distance matrices. Also do you have to work with dot files ? The format is not suited to phylogenetic data, it's mostly designed for drawing graphs.