Search in sources :

Example 1 with AlloppLeggedTree

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

the class AlloppNetworkNodeSlide method operateOneNodeInNet.

private void operateOneNodeInNet(double factor) {
    assert apspnet.getDiploidHistory().diphistOK(apspnet.getDiploidRootIsRoot());
    NodeHeightInNetIndex nhi = randomnode();
    if (nhi.doHybheight) {
        operateHybridHeight(nhi.index);
    } else {
        if (nhi.ploidy == 2) {
            operateOneNodeInDiploidHistory(nhi.index, factor);
        } else {
            assert nhi.ploidy == 4;
            AlloppLeggedTree altree = apspnet.getTetraploidTree(nhi.tree);
            operateOneNodeInTetraTree(altree, nhi.index, factor);
        }
    }
}
Also used : AlloppLeggedTree(dr.evomodel.alloppnet.speciation.AlloppLeggedTree)

Example 2 with AlloppLeggedTree

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

the class AlloppNetworkNodeSlide method operateHybridHeight.

private void operateHybridHeight(int footindex) {
    AlloppDiploidHistory diphist = apspnet.getDiploidHistory();
    ArrayList<Integer> feet = diphist.collectFeet();
    assert footindex < feet.size();
    int foot = feet.get(footindex);
    int tt = diphist.getNodeTettree(foot);
    AlloppLeggedTree tettree = apspnet.getTetraploidTree(tt);
    double minh = tettree.getRootHeight();
    int f1 = tettree.getDiphistLftLeg();
    int f2 = tettree.getDiphistRgtLeg();
    assert (foot == f1) || (foot == f2);
    apspnet.beginNetworkEdit();
    diphist.moveHybridHeight(f1, f2, minh);
    apspnet.endNetworkEdit();
}
Also used : AlloppDiploidHistory(dr.evomodel.alloppnet.speciation.AlloppDiploidHistory) AlloppLeggedTree(dr.evomodel.alloppnet.speciation.AlloppLeggedTree)

Example 3 with AlloppLeggedTree

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

the class AlloppSequenceReassignment method doOperation.

@Override
public double doOperation() {
    apspnet.beginNetworkEdit();
    if (MathUtils.nextInt(10) == 0) {
        int tt = MathUtils.nextInt(apspnet.getNumberOfTetraTrees());
        AlloppLeggedTree ttree = apspnet.getTetraploidTree(tt);
        ArrayList<Taxon> sptxs = ttree.getSpeciesTaxons();
        for (Taxon tx : sptxs) {
            int spi = apsp.apspeciesId2index(tx.getId());
            apsp.flipAssignmentsForAllGenesOneSpecies(spi);
        }
        apspnet.flipLegsOfTetraTree(tt);
    } else {
        if (MathUtils.nextInt(2) == 0) {
            apsp.permuteOneSpeciesOneIndivForOneGene();
        } else {
            apsp.permuteSetOfIndivsForOneGene();
        }
    }
    apspnet.endNetworkEdit();
    assert apspnet.alloppspeciesnetworkOK();
    return 0;
}
Also used : Taxon(dr.evolution.util.Taxon) AlloppLeggedTree(dr.evomodel.alloppnet.speciation.AlloppLeggedTree)

Aggregations

AlloppLeggedTree (dr.evomodel.alloppnet.speciation.AlloppLeggedTree)3 Taxon (dr.evolution.util.Taxon)1 AlloppDiploidHistory (dr.evomodel.alloppnet.speciation.AlloppDiploidHistory)1