public Object parseXMLObject(XMLObject xo) throws XMLParseException {

    // final int overSampling = xo.getAttribute(OVERSAMPLING, 1);
    final boolean normalize = xo.getAttribute(NORMALIZE, false);
    final double normalizeBranchRateTo = xo.getAttribute(NORMALIZE_BRANCH_RATE_TO, Double.NaN);

    TreeModel tree = (TreeModel) xo.getChild(TreeModel.class);
    ParametricDistributionModel distributionModel =
        (ParametricDistributionModel) xo.getElementFirstChild(DISTRIBUTION);

    // Parameter rateCategoryParameter = (Parameter) xo.getElementFirstChild(RATE_CATEGORIES);

    Parameter rateCategoryQuantilesParameter =
        (Parameter) xo.getElementFirstChild(RATE_CATEGORY_QUANTILES);

    Logger.getLogger("dr.evomodel").info("Using continuous relaxed clock model.");
    // Logger.getLogger("dr.evomodel").info("  over sampling = " + overSampling);
    Logger.getLogger("dr.evomodel")
        .info("  parametric model = " + distributionModel.getModelName());
    // Logger.getLogger("dr.evomodel").info("   rate categories = " +
    // rateCategoryParameter.getDimension());
    Logger.getLogger("dr.evomodel")
        .info("   rate categories = " + rateCategoryQuantilesParameter.getDimension());
    if (normalize) {
      Logger.getLogger("dr.evomodel")
          .info("   mean rate is normalized to " + normalizeBranchRateTo);
    }

    if (xo.hasAttribute(SINGLE_ROOT_RATE)) {
      // singleRootRate = xo.getBooleanAttribute(SINGLE_ROOT_RATE);
      Logger.getLogger("dr.evomodel").warning("   WARNING: single root rate is not implemented!");
    }

    /* if (xo.hasAttribute(NORMALIZED_MEAN)) {
        dbr.setNormalizedMean(xo.getDoubleAttribute(NORMALIZED_MEAN));
    }*/

    return new ContinuousBranchRates(
        tree, /*rateCategoryParameter, */
        rateCategoryQuantilesParameter,
        distributionModel, /*overSampling,*/
        normalize,
        normalizeBranchRateTo);
  }
Example #2
0
    public TaxaConstraint(TaxonList taxons, ParametricDistributionModel p, boolean isMono) {
      this.taxons = taxons;
      this.isMonophyletic = isMono;

      if (p != null) {
        final UnivariateFunction univariateFunction = p.getProbabilityDensityFunction();
        lower = univariateFunction.getLowerBound();
        upper = univariateFunction.getUpperBound();
      } else {
        lower = 0;
        upper = Double.POSITIVE_INFINITY;
      }
    }