use of dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel in project beast-mcmc by beast-dev.
the class BranchSubstitutionParameterGradientParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
String traitName = xo.getAttribute(TRAIT_NAME, DEFAULT_TRAIT_NAME);
boolean useHessian = xo.getAttribute(USE_HESSIAN, false);
final TreeDataLikelihood treeDataLikelihood = (TreeDataLikelihood) xo.getChild(TreeDataLikelihood.class);
BranchSpecificSubstitutionParameterBranchModel branchModel = (BranchSpecificSubstitutionParameterBranchModel) xo.getChild(BranchModel.class);
BeagleDataLikelihoodDelegate beagleData = (BeagleDataLikelihoodDelegate) treeDataLikelihood.getDataLikelihoodDelegate();
BranchRateModel branchRateModel = (BranchRateModel) xo.getChild(BranchRateModel.class);
CompoundParameter branchParameter = branchModel.getBranchSpecificParameters(branchRateModel);
return new BranchSubstitutionParameterGradient(traitName, treeDataLikelihood, beagleData, branchParameter, branchRateModel, useHessian);
}
use of dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel in project beast-mcmc by beast-dev.
the class BranchSpecificSubstitutionParameterBranchModelParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
List<Parameter> parameters = new ArrayList<>();
for (XMLObject xoc : xo.getAllChildren(OLD_PARAMETER)) {
Parameter parameter = (Parameter) xoc.getChild(Parameter.class);
parameters.add(parameter);
}
List<BranchRateModel> branchRateModels = new ArrayList<>();
for (XMLObject xoc : xo.getAllChildren(NEW_PARAMETER)) {
BranchRateModel branchRateModel = (BranchRateModel) xoc.getChild(BranchRateModel.class);
branchRateModels.add(branchRateModel);
}
ParameterReplaceableSubstitutionModel substitutionModel = (ParameterReplaceableSubstitutionModel) xo.getChild(ParameterReplaceableSubstitutionModel.class);
TreeModel tree = (TreeModel) xo.getChild(TreeModel.class);
return new BranchSpecificSubstitutionParameterBranchModel(BRANCH_SPECIFIC_SUBSTITUTION_PARAMETER_BRANCH_MODEL, parameters, branchRateModels, substitutionModel, tree);
}
Aggregations