Search in sources :

Example 1 with AlloppSpeciesNetworkModel

use of dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel in project beast-mcmc by beast-dev.

the class AlloppMoveLegsParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    AlloppSpeciesBindings apsp = (AlloppSpeciesBindings) xo.getChild(AlloppSpeciesBindings.class);
    AlloppSpeciesNetworkModel apspnet = (AlloppSpeciesNetworkModel) xo.getChild(AlloppSpeciesNetworkModel.class);
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    return new AlloppMoveLegs(apspnet, apsp, weight);
}
Also used : AlloppSpeciesNetworkModel(dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel) AlloppSpeciesBindings(dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings) AlloppMoveLegs(dr.evomodel.alloppnet.operators.AlloppMoveLegs)

Example 2 with AlloppSpeciesNetworkModel

use of dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel in project beast-mcmc by beast-dev.

the class AlloppNetworkPriorParser method parseXMLObject.

/*
	<apspNetworkPrior id="apspnetwork.prior" units="substitutions">
    <eventRate>
      <parameter id="apspnetwork.prior.eventRate" value="0.1" lower="0.0" upper="Infinity"/>
    </eventRate>
    <apspNetwork>
      <apspNetwork idref="apspnetwork"/>
		</apspNetwork>
	</apspNetworkPrior>
*/
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final XMLObject mxo = xo.getChild(MODEL);
    final AlloppNetworkPriorModel anpm = (AlloppNetworkPriorModel) mxo.getChild(AlloppNetworkPriorModel.class);
    final XMLObject asnmxo = xo.getChild(APSPNETWORK);
    final AlloppSpeciesNetworkModel asnm = (AlloppSpeciesNetworkModel) asnmxo.getChild(AlloppSpeciesNetworkModel.class);
    return new AlloppNetworkPrior(anpm, asnm);
}
Also used : AlloppNetworkPriorModel(dr.evomodel.alloppnet.speciation.AlloppNetworkPriorModel) AlloppSpeciesNetworkModel(dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel) AlloppNetworkPrior(dr.evomodel.alloppnet.speciation.AlloppNetworkPrior)

Example 3 with AlloppSpeciesNetworkModel

use of dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel in project beast-mcmc by beast-dev.

the class AlloppSequenceReassignmentParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    AlloppSpeciesBindings apsp = (AlloppSpeciesBindings) xo.getChild(AlloppSpeciesBindings.class);
    AlloppSpeciesNetworkModel apspnet = (AlloppSpeciesNetworkModel) xo.getChild(AlloppSpeciesNetworkModel.class);
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    return new AlloppSequenceReassignment(apspnet, apsp, weight);
}
Also used : AlloppSpeciesNetworkModel(dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel) AlloppSpeciesBindings(dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings) AlloppSequenceReassignment(dr.evomodel.alloppnet.operators.AlloppSequenceReassignment)

Example 4 with AlloppSpeciesNetworkModel

use of dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel in project beast-mcmc by beast-dev.

the class AlloppSpeciesNetworkModelTEST method testNetworkToMulLabTree.

public void testNetworkToMulLabTree() {
    ApSpInfo[] apspecies = new ApSpInfo[5];
    apspecies[0] = new ApSpInfo("a", 2, new Individual[0]);
    apspecies[1] = new ApSpInfo("b", 4, new Individual[0]);
    apspecies[2] = new ApSpInfo("c", 4, new Individual[0]);
    apspecies[3] = new ApSpInfo("d", 4, new Individual[0]);
    apspecies[4] = new ApSpInfo("e", 2, new Individual[0]);
    AlloppSpeciesBindings testASB = new AlloppSpeciesBindings(apspecies);
    AlloppSpeciesNetworkModel testASNM = new AlloppSpeciesNetworkModel(testASB);
    System.out.println("Tests of Network To MulLabTree conversion with dips a,e and tets b,c,d");
    String newick;
    newick = testASNM.testExampleNetworkToMulLabTree(1);
    System.out.println(newick + "\n\n");
    assertEquals(0, newick.compareTo("((((b0,c0),d0),a),(((b1,c1),d1),e))"));
    newick = testASNM.testExampleNetworkToMulLabTree(2);
    System.out.println(newick + "\n\n");
    assertEquals(0, newick.compareTo("(((((b0,c0),d0),a),((b1,c1),d1)),e)"));
    newick = testASNM.testExampleNetworkToMulLabTree(3);
    System.out.println(newick + "\n\n");
    assertEquals(0, newick.compareTo("(((((b0,c0),d0),((b1,c1),d1)),a),e)"));
    newick = testASNM.testExampleNetworkToMulLabTree(4);
    System.out.println(newick + "\n\n");
    assertEquals(0, newick.compareTo("((((b0,c0),a),(d0,d1)),((b1,c1),e))"));
    newick = testASNM.testExampleNetworkToMulLabTree(5);
    System.out.println(newick + "\n\n");
    assertEquals(0, newick.compareTo("(((((a,b0),c0),c1),(d0,d1)),(b1,e))"));
    System.out.println("");
    System.out.println("");
}
Also used : AlloppSpeciesNetworkModel(dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel) AlloppSpeciesBindings(dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings) Individual(dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings.Individual) ApSpInfo(dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings.ApSpInfo)

Example 5 with AlloppSpeciesNetworkModel

use of dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel in project beast-mcmc by beast-dev.

the class AlloppSpeciesNetworkModelParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    AlloppSpeciesBindings apspb = (AlloppSpeciesBindings) xo.getChild(AlloppSpeciesBindings.class);
    boolean onehyb = xo.getBooleanAttribute(ONEHYBRIDIZATION);
    boolean diprootisroot = xo.getBooleanAttribute(DIPLOIDROOT_ISROOT);
    final XMLObject tippopxo = xo.getChild(TIP_POPULATIONS);
    final double tippopvalue = tippopxo.getAttribute(Attributable.VALUE, 1.0);
    final XMLObject rootpopxo = xo.getChild(ROOT_POPULATIONS);
    final double rootpopvalue = rootpopxo.getAttribute(Attributable.VALUE, 1.0);
    final XMLObject hybpopxo = xo.getChild(HYBRID_POPULATIONS);
    final double hybpopvalue = hybpopxo.getAttribute(Attributable.VALUE, 1.0);
    AlloppSpeciesNetworkModel asnm = new AlloppSpeciesNetworkModel(apspb, tippopvalue, rootpopvalue, hybpopvalue, onehyb, diprootisroot);
    // don't know dimensionality until network created, so replace parameters
    ParameterParser.replaceParameter(tippopxo, asnm.tippopvalues);
    final Parameter.DefaultBounds tippopbounds = new Parameter.DefaultBounds(Double.MAX_VALUE, 0, asnm.tippopvalues.getDimension());
    asnm.tippopvalues.addBounds(tippopbounds);
    ParameterParser.replaceParameter(rootpopxo, asnm.rootpopvalues);
    final Parameter.DefaultBounds rootpopbounds = new Parameter.DefaultBounds(Double.MAX_VALUE, 0, asnm.rootpopvalues.getDimension());
    asnm.rootpopvalues.addBounds(rootpopbounds);
    ParameterParser.replaceParameter(hybpopxo, asnm.logginghybpopvalues);
    final Parameter.DefaultBounds hybpopbounds = new Parameter.DefaultBounds(Double.MAX_VALUE, 0, asnm.logginghybpopvalues.getDimension());
    asnm.logginghybpopvalues.addBounds(hybpopbounds);
    // note hybpopvalues are different and only work for logging.
    return asnm;
}
Also used : AlloppSpeciesNetworkModel(dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel) AlloppSpeciesBindings(dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings) Parameter(dr.inference.model.Parameter)

Aggregations

AlloppSpeciesNetworkModel (dr.evomodel.alloppnet.speciation.AlloppSpeciesNetworkModel)10 AlloppSpeciesBindings (dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings)8 AlloppChangeNumHybridizations (dr.evomodel.alloppnet.operators.AlloppChangeNumHybridizations)1 AlloppHybPopSizesScale (dr.evomodel.alloppnet.operators.AlloppHybPopSizesScale)1 AlloppMoveLegs (dr.evomodel.alloppnet.operators.AlloppMoveLegs)1 AlloppNetworkNodeSlide (dr.evomodel.alloppnet.operators.AlloppNetworkNodeSlide)1 AlloppSequenceReassignment (dr.evomodel.alloppnet.operators.AlloppSequenceReassignment)1 AlloppMSCoalescent (dr.evomodel.alloppnet.speciation.AlloppMSCoalescent)1 AlloppNetworkPrior (dr.evomodel.alloppnet.speciation.AlloppNetworkPrior)1 AlloppNetworkPriorModel (dr.evomodel.alloppnet.speciation.AlloppNetworkPriorModel)1 AlloppNumHybsStatistic (dr.evomodel.alloppnet.speciation.AlloppNumHybsStatistic)1 ApSpInfo (dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings.ApSpInfo)1 Individual (dr.evomodel.alloppnet.speciation.AlloppSpeciesBindings.Individual)1 Parameter (dr.inference.model.Parameter)1