Example #1
0
 @Override
 public double doOperation() throws OperatorFailedException {
   apspnet.beginNetworkEdit();
   apspnet.moveLegs();
   apspnet.endNetworkEdit();
   return 0;
 }
 @Override
 public double doOperation() throws OperatorFailedException {
   apspnet.beginNetworkEdit();
   double b = (1.0 - scalingFactor) * (1.0 - scalingFactor) / scalingFactor;
   double c = scalingFactor / (1.0 - scalingFactor);
   double y = MathUtils.nextDouble();
   double s = b * (y + c) * (y + c);
   int i = MathUtils.nextInt(apspnet.getNumberOfTetraTrees());
   apspnet.setOneHybPopValue(i, s * apspnet.getOneHybPopValue(i));
   apspnet.endNetworkEdit();
   return 0.0; // this way of scaling, with proposal proportional to x^-(1/2) has hastings ratio 1
 }
  @Override
  public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    AlloppSpeciesBindings apsp = (AlloppSpeciesBindings) xo.getChild(AlloppSpeciesBindings.class);
    AlloppSpeciesNetworkModel apspnet =
        (AlloppSpeciesNetworkModel) xo.getChild(AlloppSpeciesNetworkModel.class);
    if (apspnet.getOneHybridization()) {
      throw new XMLParseException(
          "oneHybridization is set to true but there is a changeNumHybridizations operator");
    }

    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    return new AlloppChangeNumHybridizations(apspnet, apsp, weight);
  }
 @Override
 public String getOperatorName() {
   return AlloppHybPopSizesScaleParser.HYB_POP_SIZES_SCALE
       + "("
       + apspnet.getId()
       + ","
       + apsp.getId()
       + ")";
 }
Example #5
0
 @Override
 public String getOperatorName() {
   return AlloppMoveLegsParser.MOVE_LEGS + "(" + apspnet.getId() + "," + apsp.getId() + ")";
 }