ete icon indicating copy to clipboard operation
ete copied to clipboard

rename tip label by a mapping table for multiphylo tree

Open neptuneyt opened this issue 3 years ago • 1 comments

Dear ete3 team, Thanks for your such amazing work. My issue is that, Suppose I have a newick file A, and a list of old and new names mapping table B, how do I replace these names at once and keep remains still?

  • A.newick
(a:0.2,b,c,d);
(a:0.3,b,c,d);
  • B.csv
old,new
a,A
c,C
d,D

The result should be like:

(A:0.2,b,C,D);
(A:0.3,b,C,D);

Thanks a lot!

neptuneyt avatar May 14 '22 13:05 neptuneyt

Something like:

for leaf in tree: if leaf.name != 'b': leaf.name = leaf.name.upper()

On Sat, 14 May 2022 at 15:37, neptuneyt @.***> wrote:

Dear ete3 team, Thanks for your such amazing work. My issue is that, Suppose I have a newick file A, and a list of old and new names mapping table B, how do I replace these names at once and keep remains still?

  • A.newick

(a:0.2,b,c,d); (a:0.3,b,c,d);

  • B.csv

old,new a,A c,C d,D

The result should be like:

(A:0.2,b,C,D); (A:0.3,b,C,D);

Thanks a lot!

— Reply to this email directly, view it on GitHub https://github.com/etetoolkit/ete/issues/630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABH6STAE43VCZLEGJMJRFDVJ6UA5ANCNFSM5V5ST4MA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jhcepas avatar May 17 '22 15:05 jhcepas