use of dr.evolution.util.Taxon in project beast-mcmc by beast-dev.
the class SingleTipObservationProcessParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Parameter mu = (Parameter) xo.getElementFirstChild(AnyTipObservationProcessParser.DEATH_RATE);
Parameter lam = (Parameter) xo.getElementFirstChild(AnyTipObservationProcessParser.IMMIGRATION_RATE);
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
PatternList patterns = (PatternList) xo.getChild(PatternList.class);
Taxon sourceTaxon = (Taxon) xo.getChild(Taxon.class);
SiteModel siteModel = (SiteModel) xo.getChild(SiteModel.class);
BranchRateModel branchRateModel = (BranchRateModel) xo.getChild(BranchRateModel.class);
Logger.getLogger("dr.evomodel.MSSD").info("Creating SingleTipObservationProcess model. All traits are assumed extant in " + sourceTaxon.getId() + "Initial mu = " + mu.getParameterValue(0) + " initial lam = " + lam.getParameterValue(0));
return new SingleTipObservationProcess(treeModel, patterns, siteModel, branchRateModel, mu, lam, sourceTaxon);
}
use of dr.evolution.util.Taxon in project beast-mcmc by beast-dev.
the class AdvancedTreeLikelihood method addDeltaParameter.
private void addDeltaParameter(Parameter deltaParameter, TaxonList taxa) {
this.deltaParameter = deltaParameter;
this.deltaTips = new HashSet<Integer>();
if (taxa != null) {
boolean first = true;
StringBuffer sb = new StringBuffer("Delta parameter added for tips: {");
for (int i = 0; i < treeModel.getExternalNodeCount(); i++) {
NodeRef node = treeModel.getExternalNode(i);
Taxon taxon = treeModel.getNodeTaxon(node);
if (taxa.getTaxonIndex(taxon) != -1) {
if (!first) {
sb.append(", ");
} else {
first = false;
}
sb.append(taxon.getId());
deltaTips.add(node.getNumber());
}
}
sb.append("}");
Logger.getLogger("dr.evomodel").info(sb.toString());
} else {
Logger.getLogger("dr.evomodel").info("Delta parameter added for all tips.");
}
addVariable(deltaParameter);
}
use of dr.evolution.util.Taxon in project beast-mcmc by beast-dev.
the class PopTreeModel method mergeSubtreePopulation.
protected void mergeSubtreePopulation(NodeRef parent) {
/*
merge the subtree below node into a new population
*/
LinkedList<NodeRef> sequenceNodes;
sequenceNodes = new LinkedList<NodeRef>();
if (this.getNodeTaxon(parent) == null) {
this.setNodeTaxon(parent, new Taxon("popNode" + populations.size()));
}
if (this.isExternal(parent)) {
}
//push(parent);
sequenceNodes.addFirst(parent);
while (true) {
NodeRef currentNode = sequenceNodes.removeFirst();
if (this.isExternal(currentNode)) {
//push(currentNode);
sequenceNodes.addFirst(currentNode);
//this.setNodeAttribute(parent,"sequenceNodes",sequenceNodes);
populations.put(parent, sequenceNodes);
return;
}
int numChildren = this.getChildCount(currentNode);
for (int i = 0; getChildCount(currentNode) > 0; ) {
NodeRef child = this.getChild(currentNode, i);
//push(child);
sequenceNodes.addFirst(child);
this.removeChild(currentNode, child);
}
}
}
use of dr.evolution.util.Taxon in project beast-mcmc by beast-dev.
the class TaxonSetPanel method excludeSelectedTaxa.
private void excludeSelectedTaxa() {
int[] rows = includedTaxaTable.getSelectedRows();
List<Taxon> transfer = new ArrayList<Taxon>();
for (int r : rows) {
transfer.add(includedTaxa.get(r));
}
excludedTaxa.addAll(transfer);
Collections.sort(excludedTaxa);
includedTaxa.removeAll(excludedTaxa);
includedTaxaTableModel.fireTableDataChanged();
excludedTaxaTableModel.fireTableDataChanged();
excludedTaxaTable.getSelectionModel().clearSelection();
for (Taxon taxon : transfer) {
int row = excludedTaxa.indexOf(taxon);
excludedTaxaTable.getSelectionModel().addSelectionInterval(row, row);
}
taxonSetChanged();
}
use of dr.evolution.util.Taxon in project beast-mcmc by beast-dev.
the class TaxonSetPanel method includeSelectedTaxa.
private void includeSelectedTaxa() {
int[] rows = excludedTaxaTable.getSelectedRows();
List<Taxon> transfer = new ArrayList<Taxon>();
for (int r : rows) {
transfer.add(excludedTaxa.get(r));
}
includedTaxa.addAll(transfer);
Collections.sort(includedTaxa);
excludedTaxa.removeAll(includedTaxa);
includedTaxaTableModel.fireTableDataChanged();
excludedTaxaTableModel.fireTableDataChanged();
includedTaxaTable.getSelectionModel().clearSelection();
for (Taxon taxon : transfer) {
int row = includedTaxa.indexOf(taxon);
includedTaxaTable.getSelectionModel().addSelectionInterval(row, row);
}
taxonSetChanged();
}
Aggregations