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);
}
}
}
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();
}
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;
}
Aggregations