File tree Expand file tree Collapse file tree
src/beast/base/evolution/sitemodel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,6 +190,17 @@ public void addCondition(final Input<? extends StateNode> stateNode) {
190190 @ Override
191191 public void setDataType (final DataType dataType ) {
192192 m_dataType = dataType ;
193+
194+ // sanity check: make sure the number of states from dataType matches that of the substitution model
195+ if (m_dataType != null ) {
196+ int nrOfStatesInData = m_dataType .getStateCount ();
197+ if (nrOfStatesInData >= 0 ) {
198+ int nrOfFrequencies = substModelInput .get ().getFrequencies ().length ;
199+ if (nrOfStatesInData != nrOfFrequencies ) {
200+ throw new IllegalArgumentException ("Number of states in data (" + nrOfStatesInData + ") differs from number of frequencies (" + nrOfFrequencies +")" );
201+ }
202+ }
203+ }
193204 }
194205
195206 public double getProportionInvariant () {
You can’t perform that action at this time.
0 commit comments