use of dr.evolution.LinkedGroup in project beast-mcmc by beast-dev.
the class LinkageConstraintsParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
ArrayList<LinkedGroup> groups = new ArrayList<LinkedGroup>();
for (int i = 0; i < xo.getChildCount(); i++) {
Object child = xo.getChild(i);
if (child instanceof LinkedGroup) {
groups.add((LinkedGroup) child);
}
}
LinkageConstraints lc = new LinkageConstraints(groups);
return lc;
}
use of dr.evolution.LinkedGroup in project beast-mcmc by beast-dev.
the class LinkedGroupParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
TaxonList taxa = null;
double linkageProbability = 0.9999999999;
if (xo.hasAttribute("probability")) {
linkageProbability = xo.getDoubleAttribute("probability");
}
taxa = (TaxonList) xo.getChild(TaxonList.class);
LinkedGroup lg = new LinkedGroup(taxa, linkageProbability);
return lg;
}
use of dr.evolution.LinkedGroup in project beast-mcmc by beast-dev.
the class HiddenLinkageLikelihood method getLogLikelihood.
public double getLogLikelihood() {
double logL = 0;
// first check whether the reads are linked together
// according to the linkage constraints provided as data in the
// input file
ArrayList<LinkedGroup> linkedGroups = hlm.getData().getConstraints();
for (LinkedGroup lg : linkedGroups) {
TaxonList tl = lg.getLinkedReads();
int found = 0;
for (int l = 0; l < hlm.getLinkageGroupCount(); l++) {
Set<Taxon> group = hlm.getGroup(l);
for (int i = 0; i < tl.getTaxonCount(); i++) {
if (group.contains(tl.getTaxon(i)))
found++;
}
if (found == tl.getTaxonCount()) {
logL += Math.log(lg.getLinkageProbability());
break;
} else if (found > 0) {
logL += Math.log(1.0 - lg.getLinkageProbability());
break;
}
}
}
// reference tree topology
if (hlm.getData().getFixedReferenceTree()) {
// not yet implemented.
logL += Double.NEGATIVE_INFINITY;
}
return logL;
}
Aggregations