Change the number format of distance in a phytree

1 view (last 30 days)
Raffael
Raffael on 21 Feb 2017
Edited: Jan on 21 Feb 2017
Hi I'm trying to edit the struct behind a tree to change to number format of the distance to "not scientific", that a number like 1.23E-3 is writen 0.00123
The Nexus file contains 3 line of code per tree
#NEXUS
BEGIN TREES;
tree 16413__AsnC__family__transcri.._alignment__tree=(bulgaricus_2038:0.0,(((((((((((('bulgaricus_Lb1-WT':0.0,'bulgaricus_Lb1-GS-1':0.0)58:0.0,lactis_LBVIB44:0.0)58:0.0,'bulgaricus_CNCM_I-1632':0.0)58:0.0,bulgaricus_CFL1:0.0)58:0.0,'bulgaricus_ATCC-BAA-365':0.0)58:0.002065547239119807,'bulgaricus_MN-BM-F01')43:2.9787232799438016E-6,lactis_LBVIB27)38:1.7872339679663677E-6,bulgaricus_LBB.B5)37:1.1170212299788443E-6,bulgaricus_DSM20081)34:7.446808199858962E-7,'bulgaricus_CNCM_I-1519')30:5.585106149894221E-7,bulgaricus_ATCC11842)29:5.585106149889885E-7,(((((((((((((lactis_LBCNRZ700:0.0041801278513057365,lactis_LBCNRZ333)76:2.7901034280301135E-5,lactis_LBCNRZ327)71:1.4557061363636506E-5,'lactis_DSM20072-2')71:7.609372985535254E-6,'lactis_DSM20072-1')71:0.002042588907737973,lactis_LBCNRZ226:0.004157939758607235)38:1.4822907493146006E-5,('jakobsenii_ZN7a-9':0.0,jakobsenii_DSM26046:0.0)61:0.0020480963330320678)58:3.56234847531077E-5,bulgaricus_ND02)43:2.114662696129678E-5,delbrueckii_KACC13439)44:1.1195273097158037E-5,delbrueckii_DSM20074)71:0.0021006965141564353,'bulgaricus_PB2003_004-T3-4')82:0.0021158914091347156,lactis_CRL581)93:0.002296976245062407,sunkii_JCM17838:0.010178789688001719)87:0.01061543561584109,(indicus_JCM15610:0.0,indicus_DSM15996:0.0)100:0.01255370058840782)99:0.01042579616695825):0.0):0.0;
As you can see after the item name there are 1 or sometimes 2 numbers after a ":". For example: lactis_LBVIB27)38:1.7872339679663677E-6
item name=lactis_LBVIB27
node number = 38 (not necessary for each object)
distance = 1.7872339679663677E-6
If I import the Nexus-file into Matlab its imported as a phytree with:
A=get(Tree); %Creates a struct
I can enter the data behind the Tree.
A =
NumLeaves: 29
NumBranches: 28
NumNodes: 57
Pointers: [28x2 double]
Distances: [57x1 double]
LeafNames: {29x1 cell}
BranchNames: {28x1 cell}
NodeNames: {57x1 cell}
With A.Distances I can also enter the Distance Matrix. My question is how can I change the number format in A.Distances and the create a Tree from A.
Hope this is more clear now
Thanks Raffael

Answers (1)

Jan
Jan on 21 Feb 2017
Edited: Jan on 21 Feb 2017
What does "some distances are displayed" exactly mean? In the command window? Then there is no problem at all, because this is really only the display in the command window and does not matter the values of the variables. See the command doc format.
If you have another problem, please explain what "The programm I use afterwards does not support scientific values" means. Do you get an error message? How are the data provided?
  2 Comments
Raffael
Raffael on 21 Feb 2017
Sorry this was a bit unclear. The Nexus file contains 3 line of code per tree
#NEXUS
BEGIN TREES;
tree 16413__AsnC__family__transcri.._alignment__tree=(bulgaricus_2038:0.0,(((((((((((('bulgaricus_Lb1-WT':0.0,'bulgaricus_Lb1-GS-1':0.0)58:0.0,lactis_LBVIB44:0.0)58:0.0,'bulgaricus_CNCM_I-1632':0.0)58:0.0,bulgaricus_CFL1:0.0)58:0.0,'bulgaricus_ATCC-BAA-365':0.0)58:0.002065547239119807,'bulgaricus_MN-BM-F01')43:2.9787232799438016E-6,lactis_LBVIB27)38:1.7872339679663677E-6,bulgaricus_LBB.B5)37:1.1170212299788443E-6,bulgaricus_DSM20081)34:7.446808199858962E-7,'bulgaricus_CNCM_I-1519')30:5.585106149894221E-7,bulgaricus_ATCC11842)29:5.585106149889885E-7,(((((((((((((lactis_LBCNRZ700:0.0041801278513057365,lactis_LBCNRZ333)76:2.7901034280301135E-5,lactis_LBCNRZ327)71:1.4557061363636506E-5,'lactis_DSM20072-2')71:7.609372985535254E-6,'lactis_DSM20072-1')71:0.002042588907737973,lactis_LBCNRZ226:0.004157939758607235)38:1.4822907493146006E-5,('jakobsenii_ZN7a-9':0.0,jakobsenii_DSM26046:0.0)61:0.0020480963330320678)58:3.56234847531077E-5,bulgaricus_ND02)43:2.114662696129678E-5,delbrueckii_KACC13439)44:1.1195273097158037E-5,delbrueckii_DSM20074)71:0.0021006965141564353,'bulgaricus_PB2003_004-T3-4')82:0.0021158914091347156,lactis_CRL581)93:0.002296976245062407,sunkii_JCM17838:0.010178789688001719)87:0.01061543561584109,(indicus_JCM15610:0.0,indicus_DSM15996:0.0)100:0.01255370058840782)99:0.01042579616695825):0.0):0.0;
As you can see after the item name there are 1 or sometimes 2 numbers after a ":". For example: lactis_LBVIB27)38:1.7872339679663677E-6
item name=lactis_LBVIB27
node number = 38 (not necessary for each object)
distance = 1.7872339679663677E-6
If I import the Nexus-file into Matlab its imported as a phytree with:
A=get(Tree); %Creates a struct
I can enter the data behind the Tree.
A =
NumLeaves: 29
NumBranches: 28
NumNodes: 57
Pointers: [28x2 double]
Distances: [57x1 double]
LeafNames: {29x1 cell}
BranchNames: {28x1 cell}
NodeNames: {57x1 cell}
With A.Distances I can also enter the Distance Matrix. My question is how can I change the number format in A.Distances and the create a Tree from A.
Hope this is more clear now
Thanks Raffael
Jan
Jan on 21 Feb 2017
Edited: Jan on 21 Feb 2017
The numbers in A.Distance are store as doubles in the standard IEEE754 format. The "x.yE-z" notation appears in the command window only, but this does not affect the internal data representation. Therefore I assume, that there is no problem with the number format.
For the second part of the question: I do not know anything about phytree, but the documentation looks, like it requires integer values. I cannot imagine how this might work with the Distance values, because the number of branchs and distances seem to be two completely different information. Sorry. Can you give a small example with e.g. 4 Distance values and what you expect as output for the tree?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!