This file is indexed.

/usr/share/beast-mcmc2/templates/StarBeast.xml is in beast2-mcmc 2.4.4+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<beast version='2.0'
       namespace='beast.app.beauti:beast.core:beast.evolution.branchratemodel:beast.evolution.speciation:beast.evolution.tree.coalescent:beast.core.util:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel:beast.evolution.substitutionmodel:beast.evolution.likelihood:beast.evolution:beast.math.distributions'
	templateinfo='*BEAST species tree reconstruction from multiple-genes&lt;br>(calibrations supported, but tip-dates are not)'>


<map name='connect' reserved='true'>beast.app.beauti.BeautiConnector</map>
<map name='subtemplate' reserved='true'>beast.app.beauti.BeautiSubTemplate</map>
<map name='Uniform'>beast.math.distributions.Uniform</map>
<map name='Normal'>beast.math.distributions.Normal</map>
<map name='OneOnX'>beast.math.distributions.OneOnX</map>
<map name='LogNormal'>beast.math.distributions.LogNormalDistributionModel</map>
<map name='Exponential'>beast.math.distributions.Exponential</map>
<map name='Gamma'>beast.math.distributions.Gamma</map>
<map name='Beta'>beast.math.distributions.Beta</map>
<map name='LaplaceDistribution'>beast.math.distributions.LaplaceDistribution</map>
<map name='InverseGamma'>beast.math.distributions.InverseGamma</map>
<map name='prior'>beast.math.distributions.Prior</map>

    <beauticonfig spec='BeautiConfig'
        inputLabelMap='beast.core.MCMC.operator=Operators,
	        beast.core.MCMC.logger=Loggers,
			beast.evolution.sitemodel.SiteModel.mutationRate =Substitution Rate,
			beast.evolution.speciation.SpeciesTreePrior.gammaParameter=Population Mean'
        inlinePlugins ='beast.core.MCMC.distribution,
            beast.evolution.sitemodel.SiteModel.substModel,
            beast.evolution.tree.coalescent.ExponentialGrowth,
            beast.evolution.tree.coalescent.ConstantPopulation,
            beast.evolution.tree.coalescent.Coalescent,
            beast.core.State.stateNode'
        collapsedPlugins ='beast.core.MCMC.logger'
        suppressPlugins = 'beast.core.MCMC.operator,
		beast.core.MCMC.operatorschedule,
	        beast.evolution.tree.coalescent.Coalescent.treeIntervals,
	        beast.evolution.tree.coalescent.Coalescent.tree,
	        beast.core.MCMC.state,
	        beast.core.MCMC.distribution,
	        beast.core.MCMC.init,
	        beast.evolution.speciation.BirthDeathGernhard08Model.relativeDeathRate,
	        beast.evolution.speciation.BirthDeathGernhard08Model.treeIntervals,
	        beast.evolution.speciation.BirthDeathGernhard08Model.type,
	        beast.evolution.speciation.BirthDeathGernhard08Model.sampleProbability,
	        beast.evolution.speciation.BirthDeathGernhard08Model.tree,
	        beast.evolution.tree.Tree,
	        beast.evolution.tree.Tree.trait,
	        beast.evolution.tree.Tree.taxa,
	        beast.evolution.tree.Tree.taxonset,
	        beast.evolution.tree.RandomTree.trait,
	        beast.evolution.tree.RandomTree.initial,
	        beast.evolution.tree.RandomTree.taxa,
	        beast.evolution.tree.RandomTree.taxonset,
	        beast.evolution.tree.RandomTree.estimate,
	        beast.util.TreeParser.initial,
	        beast.util.TreeParser.taxa,
	        beast.util.TreeParser.taxonset,
	        beast.util.TreeParser.trait,
	        beast.util.TreeParser.estimate,
	        beast.util.ClusterTree.initial,
	        beast.util.ClusterTree.taxa,
	        beast.util.ClusterTree.taxonset,
	        beast.util.ClusterTree.trait,
	        beast.util.ClusterTree.estimate,
	        beast.evolution.substitutionmodel.WAG.rates,
	        beast.evolution.substitutionmodel.WAG.frequencies,
	        beast.evolution.substitutionmodel.JTT.rates,
	        beast.evolution.substitutionmodel.JTT.frequencies,
	        beast.evolution.substitutionmodel.Blosum62.rates,
	        beast.evolution.substitutionmodel.Blosum62.frequencies,
	        beast.evolution.substitutionmodel.Dayhoff.rates,
	        beast.evolution.substitutionmodel.Dayhoff.frequencies,
	        beast.evolution.substitutionmodel.CPREV.rates,
	        beast.evolution.substitutionmodel.CPREV.frequencies,
	        beast.evolution.substitutionmodel.MTREV.rates,
	        beast.evolution.substitutionmodel.MTREV.frequencies,
	        beast.evolution.substitutionmodel.GTR.rates,
	        beast.evolution.substitutionmodel.JukesCantor.frequencies,
            beast.math.distributions.Prior.x,
            beast.math.distributions.MRCAPrior.tree,
            beast.math.distributions.MRCAPrior.monophyletic,
            beast.math.distributions.MRCAPrior.taxonset,
            beast.evolution.branchratemodel.UCRelaxedClockModel.tree,
            beast.evolution.branchratemodel.UCRelaxedClockModel.rateCategories,
            beast.evolution.branchratemodel.RandomLocalClockModel.tree,
            beast.evolution.branchratemodel.RandomLocalClockModel.meanRate,
            beast.evolution.branchratemodel.RandomLocalClockModel.indicators,
            beast.evolution.operators.ScaleOperator.indicator,
	        beast.core.Operator.weight,
			beast.evolution.speciation.GeneTreeForSpeciesTreeDistribution.speciesTree,
			beast.evolution.speciation.GeneTreeForSpeciesTreeDistribution.speciesTreePrior,
			beast.evolution.speciation.GeneTreeForSpeciesTreeDistribution.treetop,
			beast.evolution.speciation.GeneTreeForSpeciesTreeDistribution.tree,
			beast.evolution.speciation.GeneTreeForSpeciesTreeDistribution.treeIntervals,
			beast.evolution.speciation.SpeciesTreePrior.bottomPopSize,
			beast.evolution.speciation.SpeciesTreePrior.topPopSize,
			beast.evolution.speciation.SpeciesTreePrior.taxonset,
			beast.evolution.speciation.SpeciesTreePrior.tree,
			beast.evolution.speciation.SpeciesTreePrior.treeIntervals,
			beast.evolution.speciation.YuleModel.treeIntervals,
			beast.evolution.speciation.YuleModel.useTipDates,
			beast.evolution.speciation.YuleModel.tree,
            beast.core.Logger.model
            '
        buttonLabelMap='beast.app.beauti.BeautiInitDlg.&gt;&gt; details=Edit parameters'
    >


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

		<panel spec='BeautiPanelConfig' panelname="Taxon sets" tiptext="Specify taxon sets that make up species"
            path='distribution/distribution[id="speciescoalescent"]/distribution[id="SpeciesTreePopSize.Species"]/taxonset'
            hasPartitions="none" icon='1.pngx' forceExpansion='TRUE'
        />
		<panel spec='BeautiPanelConfig' panelname="Site Model" tiptext="Site model and substitution model specifications"
            path='siteModel'
            hasPartitions="SiteModel" icon='3.pngx' forceExpansion='TRUE'
        />
		<mergepoint id='aux-sitemodel-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Clock Model" tiptext="Clock model"
            path='branchRateModel'
            hasPartitions="ClockModel" icon='4.pngx' forceExpansion='TRUE'
        />
		<mergepoint id='aux-clockmodel-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Initialization" tiptext="Initial state"
            path='state/stateNode'
            hasPartitions="none" icon='6.pngx' forceExpansion='TRUE_START_COLLAPSED'
            isVisible='false'
        />
		<mergepoint id='aux-initilisation-panels'/>

		<panel spec='BeautiPanelConfig' panelname="Multi Species Coalescent" tiptext="Multi Species Coalescent specific settings"
            path='distribution/distribution[id="speciescoalescent"]/distribution'
            hasPartitions="none" icon='2.pngx' forceExpansion='TRUE'
        />

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

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

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

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


        <partitiontemplate id='StarBEASTPartitionTemplate' spec='BeautiSubTemplate' class='beast.evolution.likelihood.ThreadedTreeLikelihood' mainid='mcmc'>
<![CDATA[

		    <distribution id='treePrior.t:$(n)' spec='GeneTreeForSpeciesTreeDistribution' tree='@Tree.t:$(n)' speciesTree='@Tree.t:Species' speciesTreePrior='@SpeciesTreePopSize.Species'/>

            <!-- 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'        estimate='false'/>
                <shape               spec='parameter.RealParameter' id='gammaShape.s:$(n)' value='1.0'         estimate='false'/>
            </plugin>

            <plugin spec='TreeLikelihood' 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' value='1.0' estimate='false'/>
                </branchRateModel>
            </plugin>

	        <prior id='ClockPrior.c:$(n)' x='@clockRate.c:$(n)'><distr spec="beast.math.distributions.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.evolution.alignment.TaxonSet' alignment='@$(n)' />
            <plugin spec='beast.evolution.tree.Tree' id='Tree.t:$(n)' taxonset='@TaxonSet.$(n)'/>

            <!--plugin spec='beast.evolution.tree.RandomTree' id='RandomTree.t:$(n)' estimate='false' trait='@datetrait.$(n)' initial='@Tree.t:$(n)'-->
			<tree spec='RandomGeneTree' id='RandomGeneTree.t:$(n)' initial='@Tree.t:$(n)' speciesTree='@Tree.t:Species' taxa='@$(n)'>
				<populationModel id='RGTPopulationModel.t:$(n)' spec='ConstantPopulation'>
					<popSize id='RGTPopSize.t:$(n)' spec='parameter.RealParameter' value='1'/>
				</populationModel>
			</tree>

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

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

            <operator id='proportionInvariantScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.5" parameter="@proportionInvariant.s:$(n)"/>
            <operator id='mutationRateScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.5" parameter="@mutationRate.s:$(n)"/>
            <operator id='gammaShapeScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.5" parameter="@gammaShape.s:$(n)"/>

            <operator id='treeScaler.t:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="3" tree="@Tree.t:$(n)"/>
            <operator id='treeRootScaler.t:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="3" tree="@Tree.t:$(n)" rootOnly='true'/>
            <operator id='UniformOperator.t:$(n)' spec='Uniform' weight="30" tree="@Tree.t:$(n)"/>
            <operator id='SubtreeSlide.t:$(n)' spec='SubtreeSlide' weight="15" gaussian="true" size="1.0" tree="@Tree.t:$(n)"/>
            <operator id='narrow.t:$(n)' spec='Exchange' isNarrow='true' weight="15" tree="@Tree.t:$(n)"/>
            <operator id='wide.t:$(n)' spec='Exchange' isNarrow='false' weight="3" tree="@Tree.t:$(n)"/>
            <operator id='WilsonBalding.t:$(n)' spec='WilsonBalding' weight="3" tree="@Tree.t:$(n)"/>

            <operator id='updown.$(n)' spec='UpDownOperator' scaleFactor="0.75" weight="3">
                <up idref="clockRate.c:$(n)"/>
                <down idref="Tree.t:$(n)"/>
            </operator>

            <prior id='GammaShapePrior.s:$(n)' x='@gammaShape.s:$(n)'><distr spec="beast.math.distributions.Exponential" mean='1'/></prior>
            <prior id='PropInvariantPrior.t:$(n)' x='@proportionInvariant.s:$(n)'><distr spec="beast.math.distributions.Uniform" lower='0' upper='1'/></prior>
			<operator id='StrictClockRateScaler.c:$(n)' spec='ScaleOperator' scaleFactor="0.75" weight="3" parameter='@clockRate.c:$(n)'/>
			<!-- need updown operator for clockRate?!? Also in SubstModel.xml -->


]]>
            <connect srcID='treeLikelihood.$(n)'         targetID='likelihood' inputName='distribution' if="isInitializing"/>

            <connect srcID='treelog.t:$(n)'              targetID='mcmc' inputName='logger' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>

            <connect srcID='treePrior.t:$(n)'            targetID='speciescoalescent' inputName='distribution' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
<!-- trick to ensure that treePrior.$(n) is always deleted from prior, since it is already part of speciescoalescent -->
            <connect srcID='treePrior.t:$(n)'            targetID='prior' inputName='distribution' if='Tree.t:$(n)/estimate=nonsense'/>

            <connect srcID='ClockPrior.c:$(n)'           targetID='prior' inputName='distribution' if='inposterior(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 inposterior(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='inposterior(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRate.s:$(n)'         targetID='state' inputName='stateNode' if='inposterior(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShape.s:$(n)'           targetID='state' inputName='stateNode' if='inposterior(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>
            <connect srcID='clockRate.s:$(n)'            targetID='state' inputName='stateNode' if='inposterior(clockRate.s:$(n)) and clockRate.s:$(n)/estimate=true'/>

            <connect srcID='proportionInvariantScaler.s:$(n)' targetID='mcmc' inputName='operator' if='inposterior(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRateScaler.s:$(n)'        targetID='mcmc' inputName='operator' if='nooperator(FixMeanMutationRatesOperator) and inposterior(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShapeScaler.s:$(n)'          targetID='mcmc' inputName='operator' if='inposterior(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>
            <connect srcID='StrictClockRateScaler.c:$(n)'     targetID='mcmc' inputName='operator' if='inposterior(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>

            <connect srcID='treeScaler.t:$(n)'                targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='treeRootScaler.t:$(n)'            targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'>Scales root node for tree t:$(n)</connect>
            <connect srcID='UniformOperator.t:$(n)'           targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='SubtreeSlide.t:$(n)'              targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='narrow.t:$(n)'                    targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='wide.t:$(n)'                      targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='WilsonBalding.t:$(n)'             targetID='mcmc' inputName='operator' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='updown.$(n)'                      targetID='mcmc' inputName='operator' if='nooperator(FixMeanRatesOperator) and inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true and inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>

            <connect srcID='treeLikelihood.$(n)'         targetID='tracelog' inputName='log' if='inlikelihood(treeLikelihood.$(n))'/>
            <connect srcID='treePrior.t:$(n)'            targetID='tracelog' inputName='log' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <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='inlikelihood(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='GammaShapePrior.s:$(n)'      targetID='prior' inputName='distribution' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>
            <connect srcID='PropInvariantPrior.s:$(n)'   targetID='prior' inputName='distribution' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='Tree.t:$(n)'        targetID='Reheight.t:Species' inputName='genetree' if='Tree.t:$(n)/estimate=true'/>

	        <connect srcID='Tree.t:$(n)'        targetID='updown.all.Species' inputName='down' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
	        <connect srcID='clockRate.c:$(n)'   targetID='updown.all.Species' inputName='up' if='nooperator(FixMeanRatesOperator) and inlikelihood(clockRate.c:$(n)) and clockRate.c:$(n)/estimate=true'/>

	        <connect srcID='popSizeTop' targetID='updown.all.Species' inputName='down' if='SpeciesTreePopSize.Species/popFunction!=constant'/>

            <connect srcID='popSizeTopScaler.t:Species' targetID='mcmc'  inputName='operator' if='SpeciesTreePopSize.Species/popFunction!=constant'/>
            <connect srcID='popSizeTop'       targetID='state' inputName='stateNode' if='SpeciesTreePopSize.Species/popFunction!=constant'/>
            <connect srcID='popSizeTop'       targetID='SpeciesTreePopSize.Species' inputName='topPopSize' if='SpeciesTreePopSize.Species/popFunction!=constant'/>
            <connect srcID='popSizeTop'       targetID='SpeciesTreeLoggerX' inputName='popSizeTop' if='SpeciesTreePopSize.Species/popFunction!=constant'/>

            <connect srcID='Tree.t:$(n)'      targetID='treeTopFinder' inputName='tree' if='inposterior(Tree.t:$(n)) and Tree.t:$(n)/estimate=true'/>
            <connect srcID='treeTopFinder'    targetID='treePrior.t:$(n)' inputName='treetop' if='SpeciesTreePopSize.Species/popFunction=linear'/>
			<!-- 
			Since 'Species' is treated as a separate partition, we need the following
			hack to get rid of undesirable Tree.t:Species connections 
			-->
            <connect srcID='Tree.t:Species'     targetID='Reheight.t:Species' inputName='genetree' if='Tree.t:$(n)/estimate=XXX'/>
            <connect srcID='Tree.t:Species'     targetID='treeTopFinder' inputName='tree' if='Tree.t:$(n)/estimate=XXX'/>

			<connect srcID='birthRate.t:Species' targetID='updown.all.Species' inputName='up' if='inposterior(birthRate.t:Species)'/>
	

            <!-- initialise species and gene trees: if CalibratedYuleModel is used, 
                use the old initialisation, otherwise use the fancy new SBI -->
			<connect srcID="SBI"                           targetID='mcmc' inputName='init' if='nooperator(CalibratedYuleBirthRateScaler.t:$(n))'/>
			<!-- gene tree initialiser by SBI -->
            <connect srcID='Tree.t:$(n)'                   targetID='SBI' inputName='gene' if='inposterior(Tree.t:$(n))'/>
			<!-- we don't want Tree.t:Species to be treated as gene, so the condition is guaranteed false -->
            <connect srcID='Tree.t:Species'                targetID='SBI' inputName='gene' if='popSize/value=-1'/>
            <connect srcID='Tree.t:Species'                targetID='SBI' inputName='speciesTree' if='inposterior(Tree.t:Species) and nooperator(CalibratedYuleBirthRateScaler.t:$(n))'/>
			<connect srcID="CalibratedYuleModel.t:Species" targetID='SBI' inputName='calibratedYule' if='inposterior(CalibratedYuleModel.t:Species)'/>


			<connect srcID="RandomTree.t:Species"          targetID='mcmc' inputName='init' if='inposterior(CalibratedYuleModel.t:Species)'/>
            <connect srcID='RandomGeneTree.t:$(n)'         targetID='mcmc' inputName='init' if='inposterior(Tree.t:$(n)) and inposterior(CalibratedYuleModel.t:Species)'/>



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

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

    </beauticonfig>

	<mergepoint id='misc'/>

	<taxonset spec='beast.evolution.alignment.TaxonSet' id='taxonsuperset'>
		<!-- 
		need to specify at least one taxon for a TaxonSet, so insert a dummy taxon here
		This one is cleared by the TaxonSetInputEditor 
		-->
		<taxon spec='beast.evolution.alignment.TaxonSet' id='Beauti2DummyTaxonSet'>
			<taxon spec='beast.evolution.alignment.Taxon' id='dummyTaxon'/>
		</taxon>
	</taxonset>

	<tree spec='beast.evolution.tree.Tree' id='Tree.t:Species' taxonset='@taxonsuperset' estimate='true'/>

	<treetop spec='TreeTopFinder' id='treeTopFinder'/>

<!-- framework for main model -->
    <run spec="MCMC" id="mcmc" storeEvery="5000" chainLength="10000000">

        <state storeEvery='5000' id='state'>
	        <stateNode idref='popSize'/> 
	        <stateNode idref='popSizeTop'/> 
	        <stateNode idref='Tree.t:Species'/> 
	        <stateNode idref='birthRate.t:Species'/> 
	        <stateNode idref='popMean'/> 
        </state>

        <distribution spec="CompoundDistribution" id="posterior">
            <distribution spec="CompoundDistribution" id="speciescoalescent">
				<distribution id='SpeciesTreePopSize.Species' spec='SpeciesTreePrior' tree='@Tree.t:Species' 
						popFunction='constant' taxonset='@taxonsuperset'>
				    <bottomPopSize spec='parameter.RealParameter' id='popSize' value='1'/> 
			        <topPopSize spec='parameter.RealParameter' id='popSizeTop' value='1'/> 
				    <parameter name='gammaParameter' id='popMean' value='1' estimate="true"/>
				</distribution>
				<mergepoint id='aux-priors'/>
			</distribution>
            <distribution spec="CompoundDistribution" id="prior">
			    <!-- species tree priors -->
		        <distribution id="YuleModel.t:Species" spec="speciation.YuleModel" tree='@Tree.t:Species'>
		            <birthDiffRate spec='parameter.RealParameter' id="birthRate.t:Species" value='1' lower='0' />
		        </distribution>
	            <distribution id='YuleBirthRatePrior.t:Species' spec='beast.math.distributions.Prior' x='@birthRate.t:Species'>
		             <distr spec="beast.math.distributions.OneOnX"/>
		        </distribution>
	            <distribution id='popMean.prior' spec='beast.math.distributions.Prior' x='@popMean'>
		            <distr spec="beast.math.distributions.OneOnX"/>
		        </distribution>
            </distribution>
            <distribution spec="CompoundDistribution" id="likelihood" useThreads="true">
				<mergepoint id='aux-likelihoods'/>
            </distribution>
        </distribution>

	    <operator id="Reheight.t:Species" spec="NodeReheight" tree="@Tree.t:Species" weight="94" taxonset='@taxonsuperset'/>
	    <operator degreesOfFreedom="1" id="popSizeBottomScaler.t:Species" scaleAll="false" scaleAllIndependently="false" scaleFactor="0.5" spec="ScaleOperator" parameter="@popSize" weight="5.0"/>
	    <operator degreesOfFreedom="1" id="popSizeTopScaler.t:Species" scaleAll="false" scaleAllIndependently="false" scaleFactor="0.5" spec="ScaleOperator" parameter="@popSizeTop" weight="5.0"/>
	    <operator id='popMeanScale.t:Species' spec='ScaleOperator' scaleFactor="0.75" weight="3" parameter="@popMean"/>

	    <operator id="updown.all.Species" spec='UpDownOperator' scaleFactor="0.75" weight="20">
	      <up idref="birthRate.t:Species"/>
	      <down idref="popMean"/>
	      <down idref="popSize"/>

	      <down idref="Tree.t:Species"/>
	    </operator>
	
	    <operator id='YuleBirthRateScaler.t:Species' spec='ScaleOperator' scaleFactor="0.75" weight="3" parameter="@birthRate.t:Species"/>

        <logger id='tracelog' logEvery="5000" fileName="beast.log" sort="smart">
	        <model idref='posterior'/>
            <log idref="posterior"/>
            <log idref="likelihood"/>
            <log idref="prior"/>
			<log idref="speciescoalescent"/>
			<log idref="birthRate.t:Species"/>
			<log idref="YuleModel.t:Species"/>
			<log idref="popMean"/>
            <log id='TreeHeight.Species' spec='beast.evolution.tree.TreeHeightLogger' tree='@Tree.t:Species'/>
        </logger>

		<logger fileName="species.trees" id="speciesTreeLogger" logEvery="5000" mode="tree">
		    <log id='SpeciesTreeLoggerX' spec='SpeciesTreeLogger' popSize='@popSize' popSizeTop="@popSizeTop" tree="@Tree.t:Species" speciesTreePrior='@SpeciesTreePopSize.Species' treetop='@treeTopFinder'/>
		</logger>

        <logger id='screenlog' logEvery="5000">
	        <model idref='posterior'/>
            <log idref="posterior"/>
      	    <ESS spec='ESS' name='log' arg="@posterior"/>
            <log idref="likelihood"/>
            <log idref="prior"/>
        </logger>


<!-- use with calibrated yule-->
        <init spec='beast.evolution.tree.RandomTree' id='RandomTree.t:Species' estimate='false' initial='@Tree.t:Species' taxonset='@taxonsuperset'>
            <populationModel id='ConstantPopulation0.Species' spec='ConstantPopulation'>
        		<popSize id='randomPopSize.Species' spec='parameter.RealParameter' value='1'/>
            </populationModel>
        </init>

<!-- use without calibrated yule-->
		<init id="SBI"  spec="beast.evolution.speciation.StarBeastStartState"
		  speciesTree="@Tree.t:Species"
		  speciesTreePrior="@SpeciesTreePopSize.Species"
		  popMean="@popMean"
		  birthRate="@birthRate.t:Species">
		  <!--baseRate idref="clockRate.sb_l0_example03"/-->
		</init>
    </run>

</beast>