3
$\begingroup$

I would like to use the program BayesTraitV4. I have my phylogenetic tree in NEXUS format but the program does not accept it. I checked the example data and while they are also in NEXUS format, they seemed different. I will provide a part of my data and the example data respectively.

My tree:

#NEXUS
begin taxa;
    dimensions ntax=85;
    taxlabels
    LevantinaFC4779
    Assyriella_naegelei
    Ceu_LAG_2
    CeuMist2
    CeuMist1
    Ceu_PAN_2
    Ceu_PAN_1
    Ceu_PAN_3
    Ceu_PAN_4
    CcMath1
    CcNav1
    CcNav2
    Cc_Mal_1
    Cc_KalR2_2
    CcRod1
    CcRod2
    CcRod3
    CcRod4
    CcHr1
    CeST6_1
    CeST6_4
    CeST6_5
    CeAA7_1
    CeST6_3
    CeST6_2
    Cg_MelR7_1
    Cg_MelR3_1
    Cg_MelR6_2
    Cg_MelR7_2
    Cg_MelR6_1
    Cg_MelR7_3
    Cg_MelR5_1
    Cg_MelR4_2
    Cg_MelR1_1
    Cg_MelR2_1
    Cg_MelR4_1
    Cg_MelR7_4
    Cg_MelR5_2
    ChTM4_2
    ChTM5_1
    ChTM4_3
    ChTM4_1
    Ch_MEN_5
    Ch_MEN_13
    Ch_MEN_8
    Ch_LEV_3
    Ch_LEV_5
    Ch_LEV_4
    Ch_MEN_6
    Ch_MEN_10
    Ch_LEV_2
    Ch_MEN_4
    Ch_MEN_14
    Ch_LEV_1
    Ch_MEN_11
    Ch_MEN_3
    Ch_MEN_9
    Ci_MSP_3
    Ci_MSP_2
    Ci_MSP_1
    Ci_DIA_1
    Ci_DIA_2
    CiPLAN1
    CiPLAN3
    CiPLAN2
    Ci_MEN_1
    Ci_MEN_2
    Ci_MEN_12
    CpGravR6_1
    CpGravR3
    CpGravR4
    CpGio_2
    CpGravR5_2
    CpGravR2
    CpGravR7
    CpGio_1
    CpGio_3
    CpGravR1
    CpGravR6_2
    CpGravR5_1
    CpThe_1
    CpSka_1
    Cn_IG_2
    Cn_IG_3
    Cn_IG_1
;
end;

begin trees;
    tree TREE1 = [&R] ((LevantinaFC4779[&rate_range={7.888601174550756E-4,0.2727277039812744},height_95%_HPD={0.0,1.5711876244495215E-12},length_range={0.6843282088933,6.197383612374},height_median=6.004086117172847E-13,length_95%_HPD={1.080900382604,3.875114824373},height=6.614724410322848E-13,rate=0.049900260878735954,height_range={0.0,5.799805080641818E-12},rate_median=0.045084434131968686,length=2.411967820837161,length_median=2.3472043999879997,rate_95%_HPD={0.0108358382756707,0.10141567250363237}]:2.4119678208371664,Assyriella_naegelei[&rate_range={2.4004562386929353E-4,0.19480057878691465},height_95%_HPD={0.0,1.5711876244495215E-12},length_range={0.6843282088933,6.197383612374},height_median=6.004086117172847E-13,length_95%_HPD={1.080900382604,3.875114824373},height=6.614724410322848E-13,rate=0.03027613080757391,height_range={0.0,5.799805080641818E-

Example tree:

#NEXUS
Begin trees;
    translate
        1   Opossum,
        2   Diprotodontian,
        3   Sloth,
        4   Armadillo,
        5   Anteater,
        6   Hedgehog,
        7   Mole,
        8   Shrew,
        9   Tenrecid,
        10  Golden_Mole,
        11  Sirenian,
        12  Hyrax,
        13  Elephant,
        15  Lo_Ear_Ele_shrew,
        17  Sciurid,
        18  Mouse,
        19  Rat,
        20  Hystricid,
        21  Caviomorph,
        22  Rabbit,
        23  Pika,
        24  Flying_Lemur,
        25  Tree_Shrew,
        26  Strepsirrhine,
        28  Phyllostomid,
        29  Free_tailed_bat,
        30  False_vampire_bat,
        31  Flying_Fox,
        32  Rousette_Fruitbat,
        33  Whale,
        35  Hippo,
        36  Llama,
        37  Ruminant,
        38  Pig,
        39  Horse,
        40  Rhino,
        41  Tapir,
        42  Cat,
        43  Caniform,
        44  Pangolin;
        tree tree.164000.208997.409491 = ((1:0.07628,2:0.065151):0.1546885,(((15:0.133631,(9:0.157087,10:0.077841):0.007403):0.005959,(11:0.0406,(12:0.092769,13:0.052284):0.001099):0.01453):0.029813,((4:0.05807,(3:0.054688,5:0.062757):0.008238):0.029441,(((26:0.083487,(24:0.064103,25:0.110063):0.003501):0.000775,((22:0.058663,23:0.116805):0.045375,(17:0.0898,((18:0.039267,19:0.043896):0.125808,(20:0.083297,21:0.089139):0.067194):0.006543):0.011062):0.005229):0.00803,((7:0.090648,(6:0.150383,8:0.133021):0.006503):0.01198,((36:0.062932,(38:0.066525,(37:0.076473,(35:0.039222,33:0.031429):0.00357):0.008228):0.005968):0.026714,((44:0.081521,(42:0.046822,43:0.059428):0.024607):0.004257,((39:0.046001,(40:0.029049,41:0.029533):0.003965):0.022397,((28:0.093611,29:0.050095):0.013432,(30:0.061026,(31:0.018601,32:0.018701):0.036144):0.004989):0.015808):0.001216):0.000872):0.002868):0.009567):0.010713):0.00234):0.1546885);
        tree tree.165000.208997.199794 = ((1:0.07628,2:0.065151):0.1546885,(((15:0.133631,(9:0.157087,10:0.077841):0.007403):0.005959,(11:0.0406,(12:0.092769,13:0.052284):0.000485):0.01453):0.029813,((4:0.05807,(3:0.054688,5:0.062757):0.008238):0.029441,(((26:0.083487,(24:0.064103,25:0.110063):0.002826):0.000775,((22:0.058663,23:0.116805):0.045375,(17:0.0898,((18:0.039267,19:0.043896):0.125808,(20:0.083297,21:0.089139):0.067194):0.006543):0.011062):0.003736):0.00803,((7:0.090648,(6:0.150383,8:0.133021):0.010132):0.01198,((44:0.084486,(42:0.046822,43:0.059428):0.024607):0.004257,((36:0.062932,(38:0.066525,(37:0.076473,(35:0.039222,33:0.031429):0.004674):0.008228):0.005968):0.026714,((39:0.046001,(40:0.029049,41:0.029533):0.003965):0.022397,((28:0.093611,29:0.050095):0.008576,(30:0.061026,(31:0.018601,32:0.018701):0.036144):0.004989):0.015808):0.001216):0.000872):0.002868):0.009567):0.010713):0.00234):0.1546885);
;


end;

Why are these formats different and how can I make my file to look like the example one? Keep in mind the files are not presented in their entirety because I'm limited with the amount of characters.

Edit: I will be providing my tree in this link https://drive.google.com/file/d/1lYmzW9htwaclC_yYs3fQom-Z3zbjk8wH/view?usp=sharing

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Okay ... this will probably work

#NEXUS
begin trees;
    tree TREE1 = [&R] ((LevantinaFC4779:2.411968,Assyriella_naegelei:2.411968):5.752052,((Cn_IG_1:0.126901,(Cn_IG_2:0.075971,Cn_IG_3:0.075971):0.05093):7.4805,(((CpThe_1:0.122189,CpSka_1:0.122189):2.663216,((CpGio_2:0.137489,(CpGravR6_1:0.087156,(CpGravR3:0.038234,CpGravR4:0.038234):0.048922):0.050334):0.257308,(CpGravR5_1:0.28159,((CpGravR7:0.099712,(CpGravR5_2:0.020255,CpGravR2:0.020255):0.079458):0.15617,(CpGravR6_2:0.109222,(CpGio_1:0.068711,(CpGio_3:0.049345,CpGravR1:0.049345):0.019367):0.040511):0.14666):0.025708):0.113207):2.390607):1.772627,(((Ci_MEN_12:0.072368,(Ci_MEN_1:0.022725,Ci_MEN_2:0.022725):0.049643):1.78894,((CiPLAN2:0.253487,(CiPLAN1:0.067509,CiPLAN3:0.067509):0.185978):0.386279,((Ci_MSP_3:0.061614,Ci_MSP_2:0.061614):0.231268,(Ci_MSP_1:0.113777,(Ci_DIA_1:0.047073,Ci_DIA_2:0.047073):0.066704):0.179105):0.346885):1.221542):1.580745,(((Ceu_LAG_2:1.580984,(CeuMist2:0.198982,CeuMist1:0.198982):1.382002):0.341226,((Ceu_PAN_2:0.046898,Ceu_PAN_1:0.046898):0.20368,(Ceu_PAN_3:0.018814,Ceu_PAN_4:0.018814):0.231764):1.671632):1.226475,((CcHr1:1.247104,((CcRod1:0.403751,(CcRod4:0.276104,(CcRod2:0.158977,CcRod3:0.158977):0.117127):0.127647):0.308704,((Cc_Mal_1:0.138232,Cc_KalR2_2:0.138232):0.395435,(CcMath1:0.338389,(CcNav1:0.091762,CcNav2:0.091762):0.246627):0.195278):0.178788):0.534649):1.609976,(((CeST6_5:0.056918,(CeST6_1:0.030107,CeST6_4:0.030107):0.026812):0.733078,((CeST6_2:0.143014,(CeAA7_1:0.097814,CeST6_3:0.097814):0.0452):0.349431,((Cg_MelR7_1:0.136715,(Cg_MelR3_1:0.088065,(Cg_MelR6_2:0.047987,(Cg_MelR7_2:0.019268,Cg_MelR6_1:0.019268):0.028719):0.040078):0.04865):0.074941,(Cg_MelR5_2:0.143401,(Cg_MelR7_3:0.119131,(Cg_MelR5_1:0.090065,((Cg_MelR4_1:0.020938,Cg_MelR7_4:0.020938):0.051613,(Cg_MelR4_2:0.052913,(Cg_MelR1_1:0.021387,Cg_MelR2_1:0.021387):0.031526):0.019639):0.017514):0.029066):0.02427):0.068255):0.280789):0.297551):0.793423,(((ChTM4_2:0.049871,ChTM5_1:0.049871):0.111934,(ChTM4_3:0.023134,ChTM4_1:0.023134):0.138672):0.228306,(Ch_MEN_9:0.174548,((Ch_MEN_11:0.021817,Ch_MEN_3:0.021817):0.10954,((Ch_MEN_8:0.057141,(Ch_MEN_5:0.022973,Ch_MEN_13:0.022973):0.034168):0.053065,((Ch_LEV_3:0.031056,Ch_LEV_5:0.031056):0.061225,((Ch_LEV_4:0.029359,(Ch_MEN_6:0.017456,Ch_MEN_10:0.017456):0.011904):0.034407,((Ch_LEV_2:0.017911,Ch_MEN_4:0.017911):0.040741,(Ch_MEN_14:0.03419,Ch_LEV_1:0.03419):0.024462):0.005114):0.028515):0.017925):0.021151):0.043191):0.215563):1.193307):1.27366):0.291605):0.293368):1.115978):3.04937):0.556619);
end;

Alternatively, I'm not sure about the root, just remove [&R] in the above.

Finally there could be an issue that you haven't obtained the sample directly from the raw Beast output, instead you've summarised it. It might complain about that. Thus it might need all those trees from the raw Beast output. Thats not a format issue it's a data input issue. BayesTraits might be perform the calculation against the total MCMCMC sample minus the burn-in.


from comments

Read it into Rs ape::read.nexus() and then write via phytools::writeNexus(). This should produce your translate table. Biopython recognises this format but doesn't write to it.

The closest Biopython can achieve is a taxablock here

#NEXUS
Begin Taxa;
 Dimensions NTax=85;
 TaxLabels LevantinaFC4779 Assyriella_naegelei Cn_IG_1 Cn_IG_2 Cn_IG_3 CpThe_1 CpSka_1 CpGio_2 CpGravR6_1 CpGravR3 CpGravR4 CpGravR5_1 CpGravR7 CpGravR5_2 CpGravR2 CpGravR6_2 CpGio_1 CpGio_3 CpGravR1 Ci_MEN_12 Ci_MEN_1 Ci_MEN_2 CiPLAN2 CiPLAN1 CiPLAN3 Ci_MSP_3 Ci_MSP_2 Ci_MSP_1 Ci_DIA_1 Ci_DIA_2 Ceu_LAG_2 CeuMist2 CeuMist1 Ceu_PAN_2 Ceu_PAN_1 Ceu_PAN_3 Ceu_PAN_4 CcHr1 CcRod1 CcRod4 CcRod2 CcRod3 Cc_Mal_1 Cc_KalR2_2 CcMath1 CcNav1 CcNav2 CeST6_5 CeST6_1 CeST6_4 CeST6_2 CeAA7_1 CeST6_3 Cg_MelR7_1 Cg_MelR3_1 Cg_MelR6_2 Cg_MelR7_2 Cg_MelR6_1 Cg_MelR5_2 Cg_MelR7_3 Cg_MelR5_1 Cg_MelR4_1 Cg_MelR7_4 Cg_MelR4_2 Cg_MelR1_1 Cg_MelR2_1 ChTM4_2 ChTM5_1 ChTM4_3 ChTM4_1 Ch_MEN_9 Ch_MEN_11 Ch_MEN_3 Ch_MEN_8 Ch_MEN_5 Ch_MEN_13 Ch_LEV_3 Ch_LEV_5 Ch_LEV_4 Ch_MEN_6 Ch_MEN_10 Ch_LEV_2 Ch_MEN_4 Ch_MEN_14 Ch_LEV_1;
End;
Begin Trees;
 Tree tree1=((LevantinaFC4779:2.41197,Assyriella_naegelei:2.41197):5.75205,((Cn_IG_1:0.12690,(Cn_IG_2:0.07597,Cn_IG_3:0.07597):0.05093):7.48050,(((CpThe_1:0.12219,CpSka_1:0.12219):2.66322,((CpGio_2:0.13749,(CpGravR6_1:0.08716,(CpGravR3:0.03823,CpGravR4:0.03823):0.04892):0.05033):0.25731,(CpGravR5_1:0.28159,((CpGravR7:0.09971,(CpGravR5_2:0.02025,CpGravR2:0.02025):0.07946):0.15617,(CpGravR6_2:0.10922,(CpGio_1:0.06871,(CpGio_3:0.04934,CpGravR1:0.04934):0.01937):0.04051):0.14666):0.02571):0.11321):2.39061):1.77263,(((Ci_MEN_12:0.07237,(Ci_MEN_1:0.02272,Ci_MEN_2:0.02272):0.04964):1.78894,((CiPLAN2:0.25349,(CiPLAN1:0.06751,CiPLAN3:0.06751):0.18598):0.38628,((Ci_MSP_3:0.06161,Ci_MSP_2:0.06161):0.23127,(Ci_MSP_1:0.11378,(Ci_DIA_1:0.04707,Ci_DIA_2:0.04707):0.06670):0.17910):0.34688):1.22154):1.58075,(((Ceu_LAG_2:1.58098,(CeuMist2:0.19898,CeuMist1:0.19898):1.38200):0.34123,((Ceu_PAN_2:0.04690,Ceu_PAN_1:0.04690):0.20368,(Ceu_PAN_3:0.01881,Ceu_PAN_4:0.01881):0.23176):1.67163):1.22647,((CcHr1:1.24710,((CcRod1:0.40375,(CcRod4:0.27610,(CcRod2:0.15898,CcRod3:0.15898):0.11713):0.12765):0.30870,((Cc_Mal_1:0.13823,Cc_KalR2_2:0.13823):0.39543,(CcMath1:0.33839,(CcNav1:0.09176,CcNav2:0.09176):0.24663):0.19528):0.17879):0.53465):1.60998,(((CeST6_5:0.05692,(CeST6_1:0.03011,CeST6_4:0.03011):0.02681):0.73308,((CeST6_2:0.14301,(CeAA7_1:0.09781,CeST6_3:0.09781):0.04520):0.34943,((Cg_MelR7_1:0.13672,(Cg_MelR3_1:0.08807,(Cg_MelR6_2:0.04799,(Cg_MelR7_2:0.01927,Cg_MelR6_1:0.01927):0.02872):0.04008):0.04865):0.07494,(Cg_MelR5_2:0.14340,(Cg_MelR7_3:0.11913,(Cg_MelR5_1:0.09007,((Cg_MelR4_1:0.02094,Cg_MelR7_4:0.02094):0.05161,(Cg_MelR4_2:0.05291,(Cg_MelR1_1:0.02139,Cg_MelR2_1:0.02139):0.03153):0.01964):0.01751):0.02907):0.02427):0.06825):0.28079):0.29755):0.79342,(((ChTM4_2:0.04987,ChTM5_1:0.04987):0.11193,(ChTM4_3:0.02313,ChTM4_1:0.02313):0.13867):0.22831,(Ch_MEN_9:0.17455,((Ch_MEN_11:0.02182,Ch_MEN_3:0.02182):0.10954,((Ch_MEN_8:0.05714,(Ch_MEN_5:0.02297,Ch_MEN_13:0.02297):0.03417):0.05307,((Ch_LEV_3:0.03106,Ch_LEV_5:0.03106):0.06123,((Ch_LEV_4:0.02936,(Ch_MEN_6:0.01746,Ch_MEN_10:0.01746):0.01190):0.03441,((Ch_LEV_2:0.01791,Ch_MEN_4:0.01791):0.04074,(Ch_MEN_14:0.03419,Ch_LEV_1:0.03419):0.02446):0.00511):0.02851):0.01792):0.02115):0.04319):0.21556):1.19331):
1.27366):0.29161):0.29337):1.11598):3.04937):0.55662):0.00000;
End;

The solution could be coded from the taxa block if the above doesn't work, but easier to use R ape and phytools

$\endgroup$
1
  • $\begingroup$ I tried using this tree you provided as input and got this message: Err: Does have a translate line. $\endgroup$
    – Nickmofoe
    Oct 11, 2023 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.