Problems with discrete phylogeographic analysis in beast2: asymmetry and turning off BitFlip operators for the rate indicators.

251 views
Skip to first unread message

georgeshirreff

unread,
Apr 20, 2015, 7:07:58 AM4/20/15
to beast...@googlegroups.com, Remco Bouckaert
Dear beast-users,


I am trying to set up a discrete phylogeographic analysis in beast2 (2.1.2) in which A) migration is asymmetric, and B) some of the potential directions of migration are just turned off. I'm not sure how to implement these two aspects. 

A. I have four different locations, so with asymmetric migration there should be 12 potential rates. However, I tried just setting the dimensions of the rateIndicators (booleans which indicate that this migration rate is non-zero) and relativeGeoRates (the magnitude of the non-zero rates) to 12 instead of 6:
        <stateNode dimension="12" id="rateIndicator.s:type" spec="parameter.BooleanParameter">true true true false false false false false false false false false</stateNode>        
        <parameter dimension="12" id="relativeGeoRates.s:type" name="stateNode">1.0</parameter>

And I get this error:

validate and intialize error: Dimension of input 'rates' is 12 but a rate matrix of dimension 4x3/2=6 was expected


Do I need to set a flag somewhere to show that this is asymmetric? 


B. The second part is, I just want to set these rate indicators at the beginning rather than infer them, so the best way seems to be to comment out the operators that change them. However, it looks like there are actually two operators which do the same thing:

    <operator id="indicatorFlip.s:type" parameter="@rateIndicator.s:type" spec="BitFlipOperator" weight="30.0"/>

    <operator id="BSSVSoperator.c:type" indicator="@rateIndicator.s:type" mu="@traitClockRate.c:type" spec="BitFlipBSSVSOperator" weight="30.0"/>


Are these operators actually the same, and should I therefore comment them both out if I want my rate indicators to stay as I initialised them?

Thank you,
George

Remco Bouckaert

unread,
Apr 20, 2015, 4:02:24 PM4/20/15
to georgeshirreff, beast...@googlegroups.com
Hi George,

Yes, you should change the dimension of rates and indicator parameters, though the dimension of rates and indicators is adjusted automatically if the dimension of rates is not set up correctly. 
I assume that the error was thrown when initAndValidate was called on the SVSGeneralSubstitutionModel class. As you already guessed, to use asymmetric rates, you should set the symmetric flag to false on the SVSGeneralSubstitutionModel. 

The BitFlipOperator only changes the rateIndocator parameter, while the BitFlipBSSVSOperator also scales the mutation rate, so you want to keep both of them.

Cheers,

Remco

Tim Vaughan

unread,
Apr 20, 2015, 5:12:45 PM4/20/15
to beast...@googlegroups.com, Remco Bouckaert
Hi George,

You might also want to have a peek at the MultiTypeTree package which
uses a structured coalescent model to perform similar inference. The
project home page is http://compevol.github.io/MultiTypeTree, but you
can install the latest version directly via BEAUti's package manager.
There's also a tutorial online at
https://github.com/CompEvol/MultiTypeTree/wiki/Beginner%27s-Tutorial
which walks through using BEAUti to set up this analysis.

Regarding having zeros in your migration matrix, MultiTypeTree does
let you do this in principle but in my experience this occasionally
leads to numerical instabilities in MTT's proposal mechanism, so YMMV.

Let me know if you decide to give MTT a try and have any problems.

All the best,
Tim
> --
> You received this message because you are subscribed to the Google Groups
> "beast-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beast-users...@googlegroups.com.
> To post to this group, send email to beast...@googlegroups.com.
> Visit this group at http://groups.google.com/group/beast-users.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages