Search in sources :

Example 46 with Taxon

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);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) SingleTipObservationProcess(dr.oldevomodel.MSSD.SingleTipObservationProcess) BranchRateModel(dr.evomodel.branchratemodel.BranchRateModel) Taxon(dr.evolution.util.Taxon) PatternList(dr.evolution.alignment.PatternList) Parameter(dr.inference.model.Parameter) SiteModel(dr.oldevomodel.sitemodel.SiteModel)

Example 47 with Taxon

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);
}
Also used : NodeRef(dr.evolution.tree.NodeRef) Taxon(dr.evolution.util.Taxon)

Example 48 with Taxon

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);
        }
    }
}
Also used : NodeRef(dr.evolution.tree.NodeRef) Taxon(dr.evolution.util.Taxon)

Example 49 with Taxon

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();
}
Also used : Taxon(dr.evolution.util.Taxon) ArrayList(java.util.ArrayList)

Example 50 with Taxon

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();
}
Also used : Taxon(dr.evolution.util.Taxon) ArrayList(java.util.ArrayList)

Aggregations

Taxon (dr.evolution.util.Taxon)151 Taxa (dr.evolution.util.Taxa)31 ArrayList (java.util.ArrayList)24 TaxonList (dr.evolution.util.TaxonList)19 NodeRef (dr.evolution.tree.NodeRef)18 Date (dr.evolution.util.Date)18 Tree (dr.evolution.tree.Tree)15 Sequence (dr.evolution.sequence.Sequence)12 TreeModel (dr.evomodel.tree.TreeModel)12 Parameter (dr.inference.model.Parameter)12 Attribute (dr.util.Attribute)11 SimpleAlignment (dr.evolution.alignment.SimpleAlignment)10 Patterns (dr.evolution.alignment.Patterns)9 NewickImporter (dr.evolution.io.NewickImporter)7 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)7 Microsatellite (dr.evolution.datatype.Microsatellite)6 IOException (java.io.IOException)5 HashSet (java.util.HashSet)5 PatternList (dr.evolution.alignment.PatternList)4 DataType (dr.evolution.datatype.DataType)4