How to edit name/ID in a newick tree format
3
0
Entering edit mode
5.2 years ago
imda ▴ 10

Hi there,

I am trying to edit a newick tree. This is my tree

(Solanumtuberosum_stu4396:0.10246,(Solanumtuberosum_stu4462:0.0388307,(Solanumtuberosum_stu4373:0.134577,Solanumtuberosum_stu4418:0.0203854)n2:0.0314355)n1:0. 10246)n0;

And, I would like to remove the first part of the Ids "Solanumtuberosum" and just leave the "stu4396" ID. For instance, I would like to have this:

(stu4396:0.10246,(stu4462:0.0388307,(stu4373:0.134577,stu4418:0.0203854)n2:0.0314355)n1:0. 10246)n0;

Thank you very much.

Best

Ivan

newick format • 1.4k views
ADD COMMENT
2
Entering edit mode
5.2 years ago
$ echo '(Solanumtuberosum_stu4373:0.134577,Solanumtuberosum_stu4418:0.0203854)n2:0.0314355)n1:0. 10246)n0;' |\
sed 's/\([(,]\)[A-Za-z]*_/\1/g'

(stu4373:0.134577,stu4418:0.0203854)n2:0.0314355)n1:0. 10246)n0;
ADD COMMENT
0
Entering edit mode
5.2 years ago
imda ▴ 10

Thank you very much, this worked well!

ADD COMMENT
0
Entering edit mode
5.2 years ago
imda ▴ 10

Sorry, I another tree, I already have realized that some IDS did not change. In particular "DaturastramoniumTeo1_date29029" and "DaturastramoniumTic23_dati18250" Do you know why?

(pin9322:0.0604111,((nta31317:0.0366408,nta31450:0.0580446)n2:0.0713836,((stu15449:0.0100372,(sly17389:5e-09,spim16755:5e-09)n6:0.020268)n4:0.0302766,(cam27073:0.0527933,(DaturastramoniumTeo1_date29029:0.0559328,DaturastramoniumTic23_dati18250:5e-09)n7:0.0279078)n5:0.0175644)n3:0.0283923)n1:0.0604111)n0;

Best

ADD COMMENT

Login before adding your answer.

Traffic: 2682 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