NBISweden / MrBayes

MrBayes is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. For documentation and downloading the program, please see the home page:
http://NBISweden.github.io/MrBayes/
GNU General Public License v3.0
232 stars 79 forks source link

MrBayes ignoring hard constraints even when treeagepr and prset topologypr=constraints in place #233

Open Emtroyer opened 3 years ago

Emtroyer commented 3 years ago

I have a large dataset with both molecular and morphological data that I ran using MrBayes 3.2.7a on a supercomputer cluster. I had placed hard constraints into my submission file based on dates in the fossil record. But, for some reason, MrBayes is ignoring those hard constraints. For instance, the root age was set around 95 million years and for some reason my trees are getting pushed farther back in time than they are supposed to be. For example, in the consensus tree file, my tree is showing a root node age of ~50 million years farther back than it should be. I attached a screenshot of my .con.tre file. Tree_screenshot

I ran a total of 5 different subsets, each with slightly different molecular data input, and for each one, the trees have all been pushed way back, some with the root age as far as 180 million years.

Here is my the part of my input file showing the MrBayes Block with the settings I used:

begin mrbayes;

CHARSET Exons_1st = 1-18726\3; CHARSET Exons_2nd = 2-18726\3; CHARSET Exons_3rd = 3-18726\3; CHARSET Santini_Tyler_2003 = 18727-18936;

[outgroup, taxon sets and constraints] outgroup Cyttus_novaezelandiae;

[need to define monophyly of ingroup, otherwise the tree won't be rooted]

partition all = 4: Exons_1st, Exons_2nd, Exons_3rd, Santini_Tyler_2003; set partition=all;

lset applyto = (1,2,3) nucmodel=4by4 nst=6 rates=gamma covarion=no; [GTR+G] lset applyto = (4) coding=variable rates=gamma; [morphology] unlink statefreq=(all) revmat=(all) shape=(all) pinvar=(all); prset applyto=(all) ratepr=variable;

constraint root = 1-246; constraint Percomorpha = 2-246; constraint Lophiiformes = 3-7; constraint Tetraodontiformes_all = 8-246; constraint Tetraodontiformes_exclude_Plectocretacicoidea = 8-242; constraint Aracanidae = 8-15; constraint Balistidae = 16-50; constraint Diodontidae = 51-66; constraint Molidae = 67-71; constraint Monacanthidae = 72-123; constraint Ostraciidae = 124-141; constraint Tetraodontidae = 142-205; constraint Triacanthidae = 206-216; constraint Triacanthodidae = 217-230; constraint Triodontidae = 231-233; constraint Plectocretacicoidea = 243-246;

calibrate FF_Acanthopleurus_collettei=unif(28.4,33.9)
FF_Acanthopleurus_serratus=unif(28.4,33.9)
FF_Acanthopleurus_trispinosus=unif(23.3,33.9)
FF_Archaeotetraodon_jamestyleri=unif(15,16.5)
FF_Archaeotetraodon_winterbottomi=unif(32.3,33.9)
FF_Balistomorphus_orbiculatus=unif(28.4,33.9)
FF_Balistomorphus_ovalis=unif(28.4,33.9)
FF_Balistomorphus_spinosus=unif(28.4,33.9)
FF_Balkaria_histiopterygia=fixed(55.8)
FF_Bolcabalistes_varii=unif(48.5,50.5)
FF_Carpathospinosus_propheticus=unif(28,29)
FF_Cretatriacanthus_guidottii=unif(70,76.5)
FF_Cryptobalistes_brevis=unif(28.4,33.9)
FF_Eolactoria_sorbinii=unif(48.5,50.5)
FF_Eomola_bimaxillaria=unif(41.0,42)
FF_Eoplectus_bloti=unif(48.5,50.5)
FF_Eospinus_daniltshenkoi=unif(48.6,55.8)
FF_Eotetraodon_pygmaeus=unif(48.5,50.5)
FF_Heptadiodon_echinus=unif(48.5,50.5)
FF_Moclaybalistes_danekrus=unif(59,65.5)
FF_Oligolactoria_bubiki=unif(28.4,33.9)
FF_Plectocretacicus_clarae=unif(95,96.9)
FF_Proaracana_dubia=unif(48.5,50.5)
FF_Prodiodon_erinaceus=unif(48.5,50.5)
FF_Prodiodon_tenuispinus=unif(48.5,50.5)
FF_Prohollardia_avita=unif(24,27)
FF_Protacanthodes_nimesensis=unif(48.5,50.5)
FF_Protacanthodes_ombonii=unif(48.5,50.5)
FF_Protobalistum_imperialis=unif(48.5,50.5)
FF_Protriacanthus_gortanii=unif(93,95.5)
FF_Pshekhadiodon_parini=unif(41,42)
FF_Sphoeroides_hyperostosus=unif(3.6,5.3)
FF_Spinacanthus_cuneiformis=unif(48.5,50.5)
FF_Triodon_antiquus=unif(33.9,55.8)
FF_Zignodon_fornasieroae=unif(48.5,50.5)
FF_Zignoichthys_oblongus=unif(48.5,50.5)
FF_Oligobalistes_robustus=unif(32.2,33.9) FF_Alutera_shigensis=unif(13.1,13.6) FF_Archaeotetraodon_bannikovi=unif(9,11) FF_Archaeotetraodon_cerrinaferoni=unif(6.0,70) FF_Archaeotetraodon_dicarloi=unif(12.6,13.3) FF_Archaeotetraodon_zafaranai=unif(6.0,7.0) FF_Austromola_angerhoferi=fixed(22.0) FF_Ctenoplectus_williamsi=fixed(53.0) FF_Eotetraodon_gornylutshensis=unif(41.0,42.0) FF_Eotetraodon_tavernei=fixed(50.0) FF_Frigocanthus_margaritatus=unif(1.3,3.1) FF_Frigocanthus_stroppanobili=unif(1.3,3.1) FF_Gornylistes_prodigiosus=unif(41.0,42.0) FF_Iraniplectus_bakhtiari=fixed(29) FF_Leithaodon_sandroi=unif(13.5,14.0) FF_Slovenitriacanthus_saksidae=unif(82.0,84.0) ;

prset brlenspr=clock:fossilization; prset speciationpr=exp(20); prset extinctionpr=beta(1,1); prset fossilizationpr=beta(1,1); prset sampleprob=0.1; prset samplestrat=diversity [random]; prset treeagepr=offsetexp(95,107.9); prset topologypr=constraints(root, Percomorpha, Lophiiformes, Tetraodontiformes_all, Tetraodontiformes_exclude_Plectocretacicoidea, Aracanidae, Balistidae, Diodontidae, Molidae, Monacanthidae, Ostraciidae, Tetraodontidae, Triacanthidae, Triacanthodidae, Triodontidae, Plectocretacicoidea);

prset nodeagepr=calibrated;

prset clockvarpr=igr; prset igrvarpr=exp(37); prset clockratepr=lognorm(-7.1,0.6);

[mcmc settings] [set usebeagle=yes beagledevice=CPU beagleprecision=double beaglescaling=always beaglesse=no beagleopenmp=no;]

[set usebeagle=yes;]

[mcmc ngen= 40000000 temp=0.1 nchain=4 samplefreq=1000 printfr=1000 nruns=8 savebrlens=yes;]
mcmc ngen= 40000000 nchains=4  nruns=8 temp=0.1 samplefreq=10000 printfr=10000 diagnfr=50000 checkpoint=yes checkfreq=20000 savebrlens=yes;

[checkpoints]

[ mcmc append=yes ngen=300000000 nchains=4  nruns=8 temp=0.1 samplefreq=10000 printfr=10000 diagnfr=50000 checkpoint=yes checkfreq=20000 savebrlens=yes;]

[mcmcp data=no] [to run without data]

sumt filename=MrBayes_Subset1_updated BurninFrac=0.1 Nruns=8 contype=allcompat conformat=Figtree;

calibrate root=offsetexp(95,107.9); calibrate Percomorpha=offsetexp(59,107.9);

end;

What is the current observed behaviour?

Currently it looks like everything is submitted correctly, and even in the output file (attached) it shows the root constraints look like they were read correctly by the program, but when I examine my .con.tre file, the node ages look all wrong.

MrBayes1_output.txt

What is the expected/wanted behaviour?

I would like the root constraints and the other constraints to be correct and within the limits I identified using the constraints in the input file.

How may we reproduce this bug?

Here is the complete input file that I submitted to my cluster to run.

MrBayes_Subset1_input.txt

Would you be able to compile and run MrBayes to test fixes to this bug?

What is the environment that you run MrBayes in?

I was running the parallel version of MrBayes 3.2.7a on my university's supercomputing cluster.

Other information that may be of use to us in resolving this issue

Emtroyer commented 3 years ago

I've been doing some troubleshooting and it seems I had my root calibrations in the wrong spot. I edited my submission nexus file to put them before the mcmc commands, and now I am getting this error message: ERROR: Calibrated trees require compatible clockrates but they are incompatible for run 1, chain 1.

Emtroyer commented 3 years ago

Just wanted to add another update. I had 2 node calibrations in my dataset, one for the root and one for a node close to the root (Percomorpha). I removed the Percomorpha calibration, and the error message disappears