<beast version='2.0'
       namespace='beastfx.app.beauti:beastfx.app.inputeditor:beast.pkgmgmt:beast.base.core:beast.base.inference:beast.base.evolution.branchratemodel:beast.base.evolution.speciation:beast.base.evolution.tree.coalescent:beast.base.util:beast.base.math:beast.evolution.nuc:beast.base.evolution.operator:beast.base.inference.operator:beast.base.evolution.sitemodel:beast.base.evolution.substitutionmodel:beast.base.evolution.likelihood:beast.evolution:beast.base.inference.distribution'
	templateinfo='template for standard phylogenetic analysis,&lt;br> supporting tip-date analysis and calibrations'>

<map name='connect' reserved='true'>beastfx.app.inputeditor.BeautiConnector</map>
<map name='subtemplate' reserved='true'>beastfx.app.inputeditor.BeautiSubTemplate</map>
<map name='Uniform'>beast.base.inference.distribution.Uniform</map>
<map name='Normal'>beast.base.inference.distribution.Normal</map>
<map name='OneOnX'>beast.base.inference.distribution.OneOnX</map>
<map name='LogNormal'>beast.base.inference.distribution.LogNormalDistributionModel</map>
<map name='Exponential'>beast.base.inference.distribution.Exponential</map>
<map name='Gamma'>beast.base.inference.distribution.Gamma</map>
<map name='Beta'>beast.base.inference.distribution.Beta</map>
<map name='LaplaceDistribution'>beast.base.inference.distribution.LaplaceDistribution</map>
<map name='InverseGamma'>beast.base.inference.distribution.InverseGamma</map>
<map name='prior'>beast.base.inference.distribution.Prior</map>

    <beauticonfig spec='BeautiConfig'
        inputLabelMap='beast.base.inference.MCMC.operator=Operators,
	        beast.base.inference.MCMC.logger=Loggers,
			beast.base.evolution.sitemodel.SiteModel.mutationRate =Substitution Rate,
			beast.base.evolution.speciation.YuleModel.birthDiffRate=Birth Rate'
        inlinePlugins ='beast.base.inference.MCMC.distribution,
            beast.base.evolution.sitemodel.SiteModel.substModel,
            beast.base.evolution.tree.coalescent.ExponentialGrowth,
            beast.base.evolution.tree.coalescent.ConstantPopulation,
            beast.base.evolution.tree.coalescent.Coalescent,
            beast.base.inference.State.stateNode'
        collapsedPlugins ='beast.base.inference.MCMC.logger'
        suppressPlugins = 'beast.base.inference.MCMC.operator,
    		beast.base.inference.MCMC.operatorschedule,
    		beast.base.inference.OperatorSchedule.subschedule,
    		beast.base.inference.OperatorSchedule.operatorPattern,
			beast.base.inference.OperatorSchedule.operator,
	        beast.base.evolution.tree.coalescent.Coalescent.treeIntervals,
	        beast.base.evolution.tree.coalescent.Coalescent.tree,
	        beast.base.inference.MCMC.state,
	        beast.base.inference.MCMC.distribution,
	        beast.base.inference.MCMC.init,
	        beast.base.evolution.speciation.BirthDeathGernhard08Model.treeIntervals,
	        beast.base.evolution.speciation.BirthDeathGernhard08Model.tree,
	        beast.base.evolution.speciation.BirthDeathGernhard08Model.sampleProbability,
			beast.base.evolution.speciation.YuleModel.treeIntervals,
			beast.base.evolution.speciation.YuleModel.useTipDates,
			beast.base.evolution.speciation.YuleModel.tree,
	        beast.base.evolution.tree.Tree,
	        beast.base.evolution.tree.Tree.trait,
	        beast.base.evolution.tree.Tree.taxa,
	        beast.base.evolution.tree.Tree.taxonset,
	        beast.base.evolution.tree.Tree.nodetype,
	        beast.base.evolution.tree.coalescent.RandomTree.trait,
	        beast.base.evolution.tree.coalescent.RandomTree.initial,
	        beast.base.evolution.tree.coalescent.RandomTree.taxa,
	        beast.base.evolution.tree.coalescent.RandomTree.taxonset,
	        beast.base.evolution.tree.coalescent.RandomTree.estimate,
	        beast.base.evolution.tree.coalescent.RandomTree.nodetype,
	        beast.base.evolution.tree.TreeParser.initial,
	        beast.base.evolution.tree.TreeParser.taxa,
	        beast.base.evolution.tree.TreeParser.taxonset,
	        beast.base.evolution.tree.TreeParser.trait,
	        beast.base.evolution.tree.TreeParser.estimate,
	        beast.base.evolution.tree.TreeParser.nodetype,
	        beast.base.evolution.tree.ClusterTree.initial,
	        beast.base.evolution.tree.ClusterTree.taxa,
	        beast.base.evolution.tree.ClusterTree.taxonset,
	        beast.base.evolution.tree.ClusterTree.trait,
	        beast.base.evolution.tree.ClusterTree.estimate,
	        beast.base.evolution.tree.ClusterTree.nodetype,
	        beast.base.evolution.tree.ClusterTree.distance,
	        beast.base.evolution.substitutionmodel.WAG.rates,
	        beast.base.evolution.substitutionmodel.WAG.frequencies,
	        beast.base.evolution.substitutionmodel.JTT.rates,
	        beast.base.evolution.substitutionmodel.JTT.frequencies,
	        beast.base.evolution.substitutionmodel.Blosum62.rates,
	        beast.base.evolution.substitutionmodel.Blosum62.frequencies,
	        beast.base.evolution.substitutionmodel.Dayhoff.rates,
	        beast.base.evolution.substitutionmodel.Dayhoff.frequencies,
	        beast.base.evolution.substitutionmodel.CPREV.rates,
	        beast.base.evolution.substitutionmodel.CPREV.frequencies,
	        beast.base.evolution.substitutionmodel.MTREV.rates,
	        beast.base.evolution.substitutionmodel.MTREV.frequencies,
	        beast.base.evolution.substitutionmodel.GTR.rates,
	        beast.base.evolution.substitutionmodel.JukesCantor.frequencies,
            beast.base.inference.distribution.Prior.x,
            beast.base.evolution.tree.MRCAPrior.tree,
            beast.base.evolution.tree.MRCAPrior.monophyletic,
            beast.base.evolution.tree.MRCAPrior.taxonset,
            beast.base.evolution.branchratemodel.UCRelaxedClockModel.tree,
            beast.base.evolution.branchratemodel.UCRelaxedClockModel.rateCategories,
			beast.base.evolution.branchratemodel.UCRelaxedClockModel.distr,
            beast.base.evolution.branchratemodel.RandomLocalClockModel.tree,
            beast.base.evolution.branchratemodel.RandomLocalClockModel.meanRate,
            beast.base.evolution.branchratemodel.RandomLocalClockModel.indicators,
            beast.base.evolution.operator.ScaleOperator.indicator,
	        beast.base.inference.Operator.weight,
            beast.base.inference.Logger.model,
            beast.base.evolution.tree.coalescent.BayesianSkyline.treeIntervals,
            beast.base.evolution.tree.coalescent.BayesianSkyline.groupSizes,
            beast.base.evolution.tree.coalescent.BayesianSkyline.popSizes,
            beast.base.evolution.speciation.YuleModel.originHeight,
            beast.base.inference.parameter.RealParameter.keys,
            beast.base.inference.parameter.BooleanParameter.keys,
            beast.base.inference.parameter.IntegerParameter.keys,
            beast.base.inference.parameter.CompoundRealParameter.keys
            '
        hmc='BirthDeath/index/,
RandomTree/rootHeight/,
RandomTree/adjustTreeNodeHeights/,
StrictClock/clock.rate/,
FrequenciesExchanger/weightvector/,
FrequenciesExchanger/delta/,
FrequenciesExchanger/integer/,
FrequenciesExchanger/weight/,
FrequenciesExchanger/autoOptimize/,
BayesianSkyline/index/,
ConstantPopulation0/popSize/,
mcmc/numInitializationAttempts/,
mcmc/preBurnin/,
mcmc/storeEvery/,
mcmc/operatorschedule/,
mcmc/chainLength/,
mcmc/sampleFromPrior/,
tracelog/fileName/,
tracelog/sort/,
tracelog/sanitiseHeaders/,
tracelog/logEvery/,
tracelog/mode/,
ExtendedBayesianSkyline/index/,
CalibratedYuleModel/index/,
treeLikelihood/siteModel/,
treeLikelihood/branchRateModel/,
OperatorSchedule/detailedRejection/,
OperatorSchedule/autoOptimizeDelay/,
OperatorSchedule/transform/,
OperatorSchedule/weight/,
OperatorSchedule/weightIsPercentage/,
OperatorSchedule/autoOptimize/,
screenlog/fileName/,
screenlog/sort/,
screenlog/sanitiseHeaders/,
screenlog/logEvery/,
screenlog/mode/,
CoalescentExponential/index/,
NewickTree/adjustTipHeights/,
NewickTree/newick/,
NewickTree/IsLabelledNewick/,
NewickTree/adjustTreeNodeHeights/,
NewickTree/offset/,
NewickTree/threshold/,
NewickTree/scale/,
NewickTree/binarizeMultifurcations/,
NewickTree/singlechild/,
MarkovChainedPopSizes/reverse/,
MarkovChainedPopSizes/parameter/,
MarkovChainedPopSizes/uselog/,
MarkovChainedPopSizes/jeffreys/,
MarkovChainedPopSizes/shape/,
MarkovChainedPopSizes/initialMean/,
MarkovChainedPopSizes/useLogNormal/,
Standard/Operators/,
Standard/Priors/,
Standard/Clock_Model/,
Standard/MCMC/,
Standard/Partitions/,
Standard/Tip_Dates/,
Standard/Site_Model/,
Standard/Initialization/,
Standard/Starting_tree/,
birthRate/estimate/,
birthRate/dimension/,
birthRate/lower/,
birthRate/minordimension/,
birthRate/keys/,
birthRate/upper/,
treelog/fileName/,
treelog/sort/,
treelog/sanitiseHeaders/,
treelog/logEvery/,
treelog/mode/,
CoalescentConstant/index/,
YuleModel/index/,
ClusterTree/clock.rate/,
ClusterTree/adjustTreeNodeHeights/,
ClusterTree/clusterType/,
'
        buttonLabelMap='beastfx.app.beauti.BeautiInitDlg.&gt;&gt; details=Edit parameters'
    >
        <!--disableMenus='Mode'-->

        <panel spec='BeautiPanelConfig' panelname="Partitions" tiptext="Data Partitions"
            path='distribution/distribution[id="likelihood"]/distribution/data'
            hasPartitions="none" icon='2220.png.x' forceExpansion='FALSE'
            type='beast.base.evolution.alignment.Alignment'
        />
		<mergepoint id='aux-partitions-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Tip Dates" tiptext="Allows to specify data that a taxon was sampled"
            path='tree'
            hasPartitions="Tree" icon='2.png.x' forceExpansion='TRUE'
            isVisible='true'
        />
		<mergepoint id='aux-tipdates-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Site Model" tiptext="Site model and substitution model specifications"
            path='siteModel'
            hasPartitions="SiteModel" icon='3.png.x' forceExpansion='TRUE'
        />
		<mergepoint id='aux-sitemodel-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Clock Model" tiptext="Clock model"
            path='branchRateModel'
            hasPartitions="ClockModel" icon='4.png.x' forceExpansion='TRUE'
        />
		<mergepoint id='aux-clockmodel-panels'/>
		<panel spec='BeautiPanelConfig' panelname="Initialization" tiptext="Initial state"
            path='state/stateNode'
            hasPartitions="none" icon='6.png.x' forceExpansion='TRUE_START_COLLAPSED'
            isVisible='false'
        />
		<mergepoint id='aux-initilisation-panels'/>
		<panel spec='BeautiPanelConfig' panelname="Starting tree" tiptext="Starting tree"
            path='init'
            hasPartitions="none" icon='6.png.x' forceExpansion='TRUE'
            isVisible='false'
        />

		<panel spec='BeautiPanelConfig' panelname="Priors" tiptext="Other priors"
            path='distribution/distribution[id="prior"]/distribution'
            hasPartitions="none" icon='7.png.x' forceExpansion='TRUE_START_COLLAPSED'
            type='beast.base.inference.Distribution'
        />
		<mergepoint id='aux-priors-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Operators" tiptext="MCMC Operator details"
            path='operator'
            hasPartitions="none" icon='8.png.x' forceExpansion='TRUE_START_COLLAPSED'
            isVisible='false' buttonStatus='ADD_ONLY'
        />
		<mergepoint id='aux-operators-panels'/>

		<panel spec='BeautiPanelConfig' panelname="MCMC" tiptext="MCMC parameters"
            path=''
            hasPartitions="none" icon='9.png.x' forceExpansion='TRUE'
        />
		<mergepoint id='aux-panels'/>

		<alignmentProvider id="Import Alignment" spec='BeautiAlignmentProvider' template='@StandardPartitionTemplate'/>


        <partitiontemplate id='StandardPartitionTemplate' spec='BeautiSubTemplate' class='beast.base.evolution.likelihood.ThreadedTreeLikelihood' mainid='mcmc'>
<![CDATA[
            <!-- site model                                                              -->
            <plugin spec='SiteModel' id="SiteModel.s:$(n)" gammaCategoryCount='0'>
                <!--substModel will be automatically detected /-->
                <proportionInvariant spec='parameter.RealParameter' id='proportionInvariant.s:$(n)' value='0.0' lower='0' upper='1' estimate='false'/>
                <mutationRate        spec='parameter.RealParameter' id='mutationRate.s:$(n)' value='1.0' lower="0.0" estimate='false'/>
                <shape               spec='parameter.RealParameter' id='gammaShape.s:$(n)' value='1.0' lower='0.1' estimate='false'/>
            </plugin>

            <plugin spec='ThreadedTreeLikelihood' id="treeLikelihood.$(n)">
                <data idref="data"/>
                <tree idref="Tree.t:$(n)"/>
                <siteModel idref="SiteModel.s:$(n)"/>
                <branchRateModel spec='StrictClockModel' id='StrictClock.c:$(n)'>
                    <clock.rate id='clockRate.c:$(n)' spec='parameter.RealParameter' lower="0.0" value='1.0' estimate='false'/>
                </branchRateModel>
            </plugin>

	        <prior id='ClockPrior.c:$(n)' x='@clockRate.c:$(n)'><distr spec="beast.base.inference.distribution.Uniform" upper='Infinity'/></prior>
	        <prior id='MutationRatePrior.s:$(n)' x='@mutationRate.s:$(n)'><distr spec="OneOnX"/></prior>

            <!-- tree and its properties -->
            <taxonset id='TaxonSet.$(n)' spec='beast.base.evolution.alignment.TaxonSet' alignment='@$(n)' />
            <plugin spec='beast.base.evolution.tree.Tree' id='Tree.t:$(n)' taxonset='@TaxonSet.$(n)'/>

            <!--plugin spec='beast.base.evolution.tree.coalescent.RandomTree' id='RandomTree.t:$(n)' estimate='false' trait='@datetrait.$(n)' initial='@Tree.t:$(n)'-->
            <plugin spec='beast.base.evolution.tree.coalescent.RandomTree' id='RandomTree.t:$(n)' estimate='false' initial='@Tree.t:$(n)'>
                <taxa idref='data'/>
                <populationModel id='ConstantPopulation0.t:$(n)' spec='ConstantPopulation'>
            		<popSize id='randomPopSize.t:$(n)' spec='parameter.RealParameter' value='1'/>
	            </populationModel>
            </plugin>

            <!-- default tree prior -->
            <plugin spec='YuleModel' id="YuleModel.t:$(n)" tree='@Tree.t:$(n)'>
                <parameter name='birthDiffRate' id="birthRate.t:$(n)" lower="0.0" value='1.0' estimate='true'/>
            </plugin>

            <plugin id='TreeHeight.t:$(n)' spec='beast.base.evolution.tree.TreeStatLogger' tree='@Tree.t:$(n)'/>

            <logger id='treelog.t:$(n)' spec='beast.base.inference.Logger' logEvery="1000" fileName="$(filebase)-$(tree).trees" mode='tree'>
	            <log id='TreeWithMetaDataLogger.t:$(n)' spec='beast.base.evolution.TreeWithMetaDataLogger' tree='@Tree.t:$(n)'>
	            </log>
            </logger>

            <operator id='allTipDatesRandomWalker.t:$(n)' spec='TipDatesRandomWalker' windowSize="1" weight="0" tree="@Tree.t:$(n)"/>

 		    <operator id="YuleModelBICEPSEpochTop.t:$(n)" spec="beast.base.evolution.operator.EpochFlexOperator" tree="@Tree.t:$(n)" weight="2.0" scaleFactor="0.1"/>
            <operator id="YuleModelBICEPSEpochAll.t:$(n)" spec="beast.base.evolution.operator.EpochFlexOperator" tree="@Tree.t:$(n)" weight="2.0" scaleFactor="0.1" fromOldestTipOnly="false"/>      
            <operator id="YuleModelBICEPSTreeFlex.t:$(n)" spec="beast.base.evolution.operator.TreeStretchOperator" scaleFactor="0.01" tree="@Tree.t:$(n)" weight="2.0"/>
            <operator id='YuleModelTreeRootScaler.t:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="3" tree="@Tree.t:$(n)" rootOnly='true'/>
            <operator id='YuleModelUniformOperator.t:$(n)' spec='kernel.BactrianNodeOperator' weight="30" tree="@Tree.t:$(n)"/>
            <operator id='YuleModelSubtreeSlide.t:$(n)' spec='kernel.BactrianSubtreeSlide' weight="15" size="1.0" tree="@Tree.t:$(n)"/>
            <operator id='YuleModelNarrow.t:$(n)' spec='Exchange' isNarrow='true' weight="15" tree="@Tree.t:$(n)"/>
            <operator id='YuleModelWide.t:$(n)' spec='Exchange' isNarrow='false' weight="3" tree="@Tree.t:$(n)"/>
            <operator id='YuleModelWilsonBalding.t:$(n)' spec='WilsonBalding' weight="3" tree="@Tree.t:$(n)"/>


            <prior id='YuleBirthRatePrior.t:$(n)' x='@birthRate.t:$(n)'><distr spec="beast.base.inference.distribution.Uniform" lower='0' upper='Infinity'/></prior>
            <prior id='GammaShapePrior.s:$(n)' x='@gammaShape.s:$(n)'><distr spec="beast.base.inference.distribution.Exponential"><mean spec="parameter.RealParameter" estimate="false" value="1.0"/></distr></prior>
            <prior id='PropInvariantPrior.s:$(n)' x='@proportionInvariant.s:$(n)'><distr spec="beast.base.inference.distribution.Uniform" lower='0' upper='1'/></prior>
  		    <operator id='YuleBirthRateScaler.t:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.75" weight="3" parameter="@birthRate.t:$(n)"/>



			<operator id="AVMNOperator.$(n)" spec="beast.base.evolution.operator.kernel.AdaptableVarianceMultivariateNormalOperator" weight="0.1" 
                coefficient="1.0"
                scaleFactor="1"
                beta="0.05"
                initial="800"
                burnin="400"
                every="1" allowNonsense="true">
            	<transformations id="AVMNSumTransform.$(n)" spec="beast.base.inference.operator.kernel.Transform$LogConstrainedSumTransform" sum="1.0">
            		<!-- frequencies -->
            	</transformations>
            	<transformations id="AVMNLogTransform.$(n)" spec="beast.base.inference.operator.kernel.Transform$LogTransform">
             		<!-- site and substitution model parameters -->
            	</transformations>
            	<transformations id="AVMNNoTransform.$(n)" spec="beast.base.inference.operator.kernel.Transform$NoTransform">
             		<!-- tree -->
            	</transformations>
            </operator>

	        <operator id="StrictClockRateScaler.c:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="1.5">
                <parameter idref="clockRate.c:$(n)"/>
    	        <operator idref="AVMNOperator.$(n)"/>
        	    <operator id='StrictClockRateScalerX.c:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.75" weight="3" parameter='@clockRate.c:$(n)'/>
	        </operator>

        	<operator id="strictClockUpDownOperator.c:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="1.5">
                <parameter idref="clockRate.c:$(n)"/>
                <tree idref="Tree.t:$(n)"/>
	            <operator idref="AVMNOperator.$(n)"/>
				<operator id='strictClockUpDownOperatorX.c:$(n)' spec='kernel.BactrianUpDownOperator' scaleFactor="0.75" weight="3">
					<up idref="clockRate.c:$(n)"/>
					<down idref="Tree.t:$(n)"/>
				</operator>
    	    </operator>

        	<operator id="proportionInvariantScaler.s:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="0.05">
                <parameter idref="proportionInvariant.s:$(n)"/>
            	<operator idref="AVMNOperator.$(n)"/>
            	<operator id='proportionInvariantScalerX.s:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@proportionInvariant.s:$(n)"/>
        	</operator>

        	<operator id="mutationRateScaler.s:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="0.05">
                <parameter idref="mutationRate.s:$(n)"/>
            	<operator idref="AVMNOperator.$(n)"/>
	            <operator id='mutationRateScalerX.s:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@mutationRate.s:$(n)"/>
        	</operator>

        	<operator id="gammaShapeScaler.s:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="0.05">
                <parameter idref="gammaShape.s:$(n)"/>
            	<operator idref="AVMNOperator.$(n)"/>
	            <operator id='gammaShapeScalerX.s:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@gammaShape.s:$(n)"/>
        	</operator>



]]>
            <connect srcID='treeLikelihood.$(n)'            targetID='likelihood' inputName='distribution' if="isInitializing"/>
            <connect srcID='YuleModel.t:$(n)'               targetID='prior' inputName='distribution' if="isInitializing"/>
			<connect method="beastfx.app.inputeditor.SiteModelInputEditor.customConnector"/>
			
			<!-- for deciding whether to connect the mean clock rate to the AVMN operator -->
			<connect method="beastfx.app.inputeditor.SiteModelInputEditor.avmnConnector"/>

            <connect srcID='treelog.t:$(n)'                 targetID='mcmc' inputName='logger' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='RandomTree.t:$(n)'                targetID='mcmc' inputName='init'   if='isInitializing'/>
			<connect method="beastfx.app.beauti.StateNodeInitialiserListInputEditor.customConnector"/>

            <connect srcID='ClockPrior.c:$(n)'                targetID='prior' inputName='distribution' if='inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>
<!-- when FixMeanMutationRatesOperator, the prior is uniform due to the operator -->
            <connect srcID='MutationRatePrior.s:$(n)'         targetID='prior' inputName='distribution' if='nooperator(FixMeanMutationRatesOperator) and inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>

            <connect srcID='Tree.t:$(n)'                      targetID='state' inputName='stateNode' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='proportionInvariant.s:$(n)'       targetID='state' inputName='stateNode' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRate.s:$(n)'              targetID='state' inputName='stateNode' if='inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShape.s:$(n)'                targetID='state' inputName='stateNode' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>
            <connect srcID='clockRate.c:$(n)'                 targetID='state' inputName='stateNode' if='inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>
            <connect srcID='birthRate.t:$(n)'                 targetID='state' inputName='stateNode' if='inposterior(YuleModel.t:$(n)) and inposterior(Tree.t:$(n)) and birthRate.t:$(n)/estimate=true'/>

            <connect srcID='Tree.t:$(n)'                      targetID='AVMNNoTransform.$(n)' inputName='f' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='proportionInvariant.s:$(n)'       targetID='AVMNLogTransform.$(n)' inputName='f' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRate.s:$(n)'              targetID='AVMNLogTransform.$(n)' inputName='f' if='nooperator(FixMeanMutationRatesOperator) and inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShape.s:$(n)'                targetID='AVMNLogTransform.$(n)' inputName='f' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>


            <connect srcID='proportionInvariantScaler.s:$(n)' targetID='mcmc' inputName='operator' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'>Scales proportion of invariant sites parameter of partition $(n)</connect>
            <connect srcID='mutationRateScaler.s:$(n)'        targetID='mcmc' inputName='operator' if='nooperator(FixMeanMutationRatesOperator) and inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'>Scales mutation rate of partition s:$(n)</connect>
            <connect srcID='gammaShapeScaler.s:$(n)'          targetID='mcmc' inputName='operator' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'>Scales gamma shape parameter of partition s:$(n)</connect>
            <connect srcID='StrictClockRateScaler.c:$(n)'     targetID='mcmc' inputName='operator' if='inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'>Scale clock rate of partition c:$(n)</connect>
            <connect srcID='YuleBirthRateScaler.t:$(n)'       targetID='mcmc' inputName='operator' if='inposterior(birthRate.t:$(n)) and birthRate.t:$(n)/estimate=true'>Scales birth rate of Yule prior for partition t:$(n)</connect>
            <connect srcID='strictClockUpDownOperator.c:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(clockRate.c:$(n)) and inlikelihood(Tree.t:$(n)) and Tree.t:$(n)/estimate=true and clockRate.c:$(n)/estimate=true'>
                Scale up substitution rate c:$(n) and scale down tree t:($n)
            </connect>

            <connect srcID='allTipDatesRandomWalker.t:$(n)'   targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true and allTipDatesRandomWalker.t:$(n)/weight!=0.0'>Estimates tip dates for tree t:$(n)</connect>

            <connect srcID="YuleModelTreeScaler.t:$(n)"       targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Scales all internal nodes for tree t:$(n)</connect>
            <connect srcID="YuleModelTreeRootScaler.t:$(n)"   targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Scales root node for tree t:$(n)</connect>
            <connect srcID="YuleModelUniformOperator.t:$(n)"  targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Draws new internal node heights uniformally for tree t:$(n)</connect>
            <connect srcID="YuleModelSubtreeSlide.t:$(n)"     targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Performs subtree slide rearrangement of tree t:$(n)</connect>
            <connect srcID="YuleModelNarrow.t:$(n)"           targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Narrow exchange performs local rearrangement of tree t:$(n)</connect>
            <connect srcID="YuleModelWide.t:$(n)"             targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Wide exchange performs global rearrangement of tree t:$(n)</connect>
            <connect srcID="YuleModelWilsonBalding.t:$(n)"    targetID="mcmc" inputName="operator" if="inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true" >Performs Wilson-Balding global rearrangement of tree t:$(n)</connect>
            <connect srcID='YuleModelBICEPSEpochTop.t:$(n)'   targetID='mcmc' inputName='operator' if='inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true'>Epoch operator that only scale internal nodes above least recent node for tree t:$(n)</connect>
            <connect srcID='YuleModelBICEPSEpochAll.t:$(n)'   targetID='mcmc' inputName='operator' if='inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true'>Epoch operator that scales all internal nodes for tree t:$(n)</connect>
            <connect srcID='YuleModelBICEPSTreeFlex.t:$(n)'   targetID='mcmc' inputName='operator' if='inposterior(YuleModel.t:$(n)) and Tree.t:$(n)/estimate=true'>Flex operators for all internal nodes for tree t:$(n)</connect>

            <connect srcID='treeLikelihood.$(n)'              targetID='tracelog' inputName='log' if='inlikelihood(treeLikelihood.$(n))'/>
            <connect srcID='TreeHeight.t:$(n)'                targetID='tracelog' inputName='log' if='inposterior(Tree.t:$(n))  and Tree.t:$(n)/estimate=true'/>
            <connect srcID='proportionInvariant.s:$(n)'       targetID='tracelog' inputName='log' if='inposterior(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRate.s:$(n)'              targetID='tracelog' inputName='log' if='inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShape.s:$(n)'                targetID='tracelog' inputName='log' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>
            <connect srcID='clockRate.c:$(n)'                 targetID='tracelog' inputName='log' if='inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>
            <connect srcID='YuleModel.t:$(n)'                 targetID='tracelog' inputName='log' if='inposterior(YuleModel.t:$(n)) and inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='birthRate.t:$(n)'                 targetID='tracelog' inputName='log' if='inposterior(YuleModel.t:$(n)) and birthRate.t:$(n)/estimate=true'/>

            <connect srcID='GammaShapePrior.s:$(n)'           targetID='prior' inputName='distribution' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'>Prior on gamma shape for partition s:$(n)</connect>
            <connect srcID='PropInvariantPrior.s:$(n)'        targetID='prior' inputName='distribution' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'>Prior on proportion invariant for partition s:$(n)</connect>
            <connect srcID='YuleBirthRatePrior.t:$(n)'        targetID='prior' inputName='distribution' if='inposterior(YuleModel.t:$(n)) and inposterior(Tree.t:$(n)) and birthRate.t:$(n)/estimate=true'>Prior on Yule birth rate for partition s:$(n)</connect>

			<mergepoint id='aux-partitiontemplate'/>
        </partitiontemplate>

		<mergepoint id='substModelTemplates'/>
		<mergepoint id='clockModelTemplates'/>
		<mergepoint id='treePriorTemplates'/>
        <mergepoint id='parametricDistributions'/>

<!-- Tree initialisation -->
<!-- Random tree -->

        <subtemplate id='RandomTree' class='beast.base.evolution.tree.coalescent.RandomTree' mainid='RandomTree.t:$(n)'>
<![CDATA[
            <tree spec='beast.base.evolution.tree.coalescent.RandomTree' id='RandomTree.t:$(n)' estimate='false' initial="@Tree.t:$(n)">
                <taxa idref='data'/>
                <populationModel id='ConstantPopulation0.t:$(n)' spec='ConstantPopulation'>
            		<popSize id='randomPopSize.t:$(n)' spec='parameter.RealParameter' value='1'/>
	            </populationModel>
            </tree>
]]>
        </subtemplate>

<!-- Cluster tree (defaults to UPGMA) -->

        <subtemplate id='ClusterTree' class='beast.base.evolution.tree.ClusterTree' mainid='ClusterTree.t:$(n)'>
<![CDATA[
        <tree spec='beast.base.evolution.tree.ClusterTree' id='ClusterTree.t:$(n)' initial="@Tree.t:$(n)" clusterType='upgma' estimate='false' taxa='@$(n)'/>
]]>
        </subtemplate>

<!-- Newick tree -->
        <subtemplate id='NewickTree' class='beast.base.evolution.tree.TreeParser' mainid='NewickTree.t:$(n)'>
<![CDATA[
        <tree_ spec='beast.base.evolution.tree.TreeParser' id='NewickTree.t:$(n)' initial="@Tree.t:$(n)" estimate='false' taxa='@$(n)' newick=""/>
]]>
        </subtemplate>


        <subtemplate id='DefaultOperatorSchedule' class='beast.base.inference.OperatorSchedule' mainid='OperatorSchedule'
        	>
<![CDATA[
        <operatorschedule id="OperatorSchedule" spec="beast.base.inference.OperatorSchedule"/>
]]>
        </subtemplate>
		

    </beauticonfig>


	<mergepoint id='misc'/>

    
<!-- framework for main model -->

    <run spec="MCMC" id="mcmc" chainLength="10000000">
		<operatorschedule id="OperatorSchedule" spec="OperatorSchedule"/>
        <state storeEvery='5000' id='state'>
        </state>

        <distribution spec="CompoundDistribution" id="posterior">
            <distribution spec="CompoundDistribution" id="prior">
				<mergepoint id='aux-priors'/>
            </distribution>
            <distribution spec="CompoundDistribution" id="likelihood" useThreads="true">
				<mergepoint id='aux-likelihoods'/>
            </distribution>
        </distribution>

        <logger id='tracelog' logEvery="1000" fileName="$(filebase).log" sort="smart" sanitiseHeaders='true'>
	        <model idref='posterior'/>
            <log idref="posterior"/>
            <log idref="likelihood"/>
            <log idref="prior"/>
        </logger>

        <logger id='screenlog' logEvery="1000">
	        <!--model idref='posterior'/-->
            <log idref="posterior"/>
            <!--this ESS is computed solely based on the current BEAST run (not the chain)-->
      	    <!--<ESS spec='ESS' name='log' arg="@posterior"/>-->
            <log idref="likelihood"/>
            <log idref="prior"/>
        </logger>
    </run>

</beast>

