You are here

General Data Type

BEAST Documentation->Tutorials->General Data Type


Creating your own general data type and substitution model

The easiest way to start is to use BEAUti to create an XML BEAST file, and edit the XML file by adding the general data type following the demonstration below:

Here is the code in the beginning of XML:

<taxa id="taxa">
	<taxon id="human"/>
	<taxon id="chimp"/>
	<taxon id="bonobo"/>
	<taxon id="gorilla"/>
	<taxon id="orangutan"/>
	<taxon id="siamang"/>
</taxa>

<generalDataType id="general">
	<state code="A"/> <!-- A -->
	<state code="C"/> <!-- C -->
	<state code="G"/> <!-- G -->
	<state code="T"/> <!-- T -->
	<ambiguity code="-" states="ACGT"/>
	<ambiguity code="?" states="ACGT"/>
</generalDataType>

<alignment id="alignment">
	<dataType idref="general"/>
	<sequence>
		<taxon idref="human"/>			
                AGAAA-TAT?G  ...
	</sequence>
	<sequence>
		<taxon idref="chimp"/>
		AGAAA-TAC?  ...
	</sequence>
	<sequence>
		<taxon idref="bonobo"/>	
		AGAA--TAT??  ...
		</sequence>
	<sequence>
		<taxon idref="gorilla"/>
		AG?AA-TATAA  ...
	</sequence>
	<sequence>
		<taxon idref="orangutan"/>
		AGAAA-TATTT  ...
	</sequence>
	<sequence>
		<taxon idref="siamang"/>
		AGAAATT?TAA  ...
	</sequence>
</alignment>

The rest of part is how to refer your general data type:

<frequencyModel id="frequencies">
	<dataType idref="general"/>
	<alignment idref="alignment"/>
	<frequencies>
		<parameter id="frequencies.freqs" dimension="4"/>
	</frequencies>
</frequencyModel>

<generalSubstitutionModel id="generalSubst">
	<frequencies>
		<frequencyModel idref="frequencies"/>
	</frequencies>
	<rates relativeTo="5">
		<parameter id="rates" dimension="5" value="1.0"/>
	</rates>
</generalSubstitutionModel>

<!-- site model -->
<siteModel id="siteModel">
	<substitutionModel>
		<generalSubstitutionModel idref="generalSubst"/>
	</substitutionModel>
	<mutationRate>
		<parameter id="siteModel.mu" value="1.0" lower="0.0"/>
	</mutationRate>
</siteModel>

Do not forget to refer it in the tree likelihood as well:

<treeLikelihood id="treeLikelihood">
	<patterns idref="patterns"/>
	<treeModel idref="treeModel"/>
	<siteModel idref="siteModel"/>
</treeLikelihood>

Updated on 26/01/2010.


Return to Tutorials