use of dr.evomodel.substmodel.OldGLMSubstitutionModel in project beast-mcmc by beast-dev.
the class OldGLMSubstitutionModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
DataType dataType = DataTypeUtils.getDataType(xo);
if (dataType == null)
dataType = (DataType) xo.getChild(DataType.class);
int rateCount = (dataType.getStateCount() - 1) * dataType.getStateCount();
LogLinearModel glm = (LogLinearModel) xo.getChild(GeneralizedLinearModel.class);
int length = glm.getXBeta().length;
if (length != rateCount) {
throw new XMLParseException("Rates parameter in " + getParserName() + " element should have " + (rateCount) + " dimensions. However GLM dimension is " + length);
}
XMLObject cxo = xo.getChild(dr.oldevomodelxml.substmodel.ComplexSubstitutionModelParser.ROOT_FREQUENCIES);
FrequencyModel rootFreq = (FrequencyModel) cxo.getChild(FrequencyModel.class);
if (dataType != rootFreq.getDataType()) {
throw new XMLParseException("Data type of " + getParserName() + " element does not match that of its rootFrequencyModel.");
}
return new OldGLMSubstitutionModel(xo.getId(), dataType, rootFreq, glm);
}
Aggregations