Mk model for multistate morphological data

286 views
Skip to first unread message

ianvc...@gmail.com

unread,
Aug 20, 2014, 9:57:06 AM8/20/14
to beast...@googlegroups.com
Hello all,

I was trying to implement the Mk model of Lewis (2001). It is a standard model of discrete character substitution where equilibrium frequencies and rates of substitution are equal for all states; much like the Binary model already implemented for data that is either 0 or 1, but for multistate characters.

My strategy for doing so in the BEAST 1.8 XML was to manually partition the data between sites with different number of character states, and assign the appropriate Mk model for each partition. As such:

 <generalDataType id="twoState">
        <state code="0"/>
        <state code="1"/>
        <ambiguity code="?" states="01"/>
        <ambiguity code="-" states="01"/>
    </generalDataType>

    <generalDataType id="threeState">
        <state code="0"/>
        <state code="1"/>
        <state code="2"/>
        <ambiguity code="?" states="012"/>
        <ambiguity code="-" states="012"/>
    </generalDataType>

    <generalDataType id="fourState">
        <state code="0"/>
        <state code="1"/>
        <state code="2"/>
        <state code="3"/>
        <ambiguity code="?" states="0123"/>
        <ambiguity code="-" states="0123"/>
    </generalDataType>

... and so on, up to ten different states. Then:

    <generalSubstitutionModel id="twostatesubstmodel" dataType="twoState" name="GSM.twoState">
        <frequencies>
            <frequencyModel>
                <dataType idref="twoState"/>
                <frequencies>
                    <parameter id="twostate.frequencies" value="0.5 0.5"/>
                </frequencies>
            </frequencyModel>
        </frequencies>
        <rates relativeTo="1"/>
    </generalSubstitutionModel>

    <generalSubstitutionModel dataType="threeState" name="GSM.threeState">
        <frequencies>
            <frequencyModel>
                <dataType idref="threeState"/>
                <frequencies>
                    <parameter id="threestate.frequencies" value="0.33 0.33 0.34"/>
                </frequencies>
            </frequencyModel>
        </frequencies>
        <rates relativeTo="1"/>
    </generalSubstitutionModel>

    <generalSubstitutionModel dataType="fourState" name="GSM.fourState">
        <frequencies>
            <frequencyModel>
                <dataType idref="fourState"/>
                <frequencies>
                    <parameter id="fourstate.frequencies" value="0.25 0.25 0.25 0.25"/>
                </frequencies>
            </frequencyModel>
        </frequencies>
        <rates relativeTo="1"/>
    </generalSubstitutionModel>

... and so on, up to ten states. I did it using the XML reference retrieved from https://web.archive.org/web/20130107032047/http://beast.bio.ed.ac.uk/BEAST_XML_Reference
However, when I try to run the XML with only the model definitions as above, I get this error:

The '<generalSubstitutionModel>' element with id, 'twostatesubstmodel', is incorrectly constructed.
The following was expected:
Exactly one ELEMENT of name rates REQUIRED containing
    Exactly one ELEMENT of type Parameter REQUIRED

But I haven't found any information on what is this parameter element and how to construct it in the context of generalSubstitutionModel.

Would this implementation be possible on BEAST 2?

Thank you in advance.

Best regards,
Ian

Ivan Magalhães

unread,
Apr 18, 2016, 11:17:19 AM4/18/16
to beast-users
Dear Ian,

Have you been able to solve this?
I am having the same problem!

Many thanks and kind regards,
Ivan

Ben King

unread,
Apr 20, 2016, 1:18:47 AM4/20/16
to beast-users
Needs an actual rate matrix in the substitution model. Easier in Beast2 as all this is done automatically in Beauti
Something like might be better:


<generalSubstitutionModel id="twostatesubstmodel" dataType="twoState" name="GSM.twoState">
        <frequencies>
            <frequencyModel>
                <dataType idref="twoState"/>
                <frequencies>
                    <parameter id="twostate.frequencies" value="0.5 0.5"/>
                </frequencies>
            </frequencyModel>
        </frequencies>
        <rates>
            <parameter id="RateMatrix.2" value="1.0  " dimension="1" lower="0" upper="Infinity" />
        </rates>

    </generalSubstitutionModel>

    <generalSubstitutionModel dataType="threeState" name="GSM.threeState">
        <frequencies>
            <frequencyModel>
                <dataType idref="threeState"/>
                <frequencies>
                    <parameter id="threestate.frequencies" value="0.33 0.33 0.34"/>
                </frequencies>
            </frequencyModel>
        </frequencies>
        <rates>
            <parameter id="RateMatrix.3" value="1.0 1.0 1.0 " dimension="3" lower="0" upper="Infinity" />
        </rates>

    </generalSubstitutionModel>

    <generalSubstitutionModel dataType="fourState" name="GSM.fourState">
        <frequencies>
            <frequencyModel>
                <dataType idref="fourState"/>
                <frequencies>
                    <parameter id="fourstate.frequencies" value="0.25 0.25 0.25 0.25"/>
                </frequencies>
            </frequencyModel>
        </frequencies>
        <rates>
            <parameter id="RateMatrix.4" value="1.0 1.0 1.0 1.0 1.0 1.0 " dimension="6" lower="0" upper="Infinity" />
        </rates>
    </generalSubstitutionModel>
Reply all
Reply to author
Forward
0 new messages