Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions beast-fx/src/main/java/beastfx/app/inputeditor/BeautiPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import beast.base.evolution.branchratemodel.BranchRateModel;
import beast.base.evolution.sitemodel.SiteModelInterface;
import beast.base.evolution.tree.TreeInterface;
import beast.base.inference.CompoundDistribution;
import beast.base.parser.PartitionContext;
import beast.base.spec.evolution.likelihood.GenericTreeLikelihood;
import beast.base.spec.evolution.sitemodel.SiteModel;
Expand Down Expand Up @@ -410,10 +409,8 @@ public void cloneFrom(String sourceID, String targetID) {
throw new RuntimeException("Programmer error: sourceID and targetID should be in list");
}

CompoundDistribution likelihoods = (CompoundDistribution) doc.pluginmap.get("likelihood");

GenericTreeLikelihood likelihoodSource = (GenericTreeLikelihood) likelihoods.pDistributions.get().get(source);
GenericTreeLikelihood likelihood = (GenericTreeLikelihood) likelihoods.pDistributions.get().get(target);
GenericTreeLikelihood likelihoodSource = (GenericTreeLikelihood) list.get(source);
GenericTreeLikelihood likelihood = (GenericTreeLikelihood) list.get(target);
PartitionContext oldContext = doc.getContextFor(likelihoodSource);
PartitionContext newContext = doc.getContextFor(likelihood);
// this ensures the config.sync does not set any input value
Expand Down Expand Up @@ -471,11 +468,16 @@ public void cloneFrom(String sourceID, String targetID) {
TreeInterface tree = null;
TreeInterface treeSource = likelihoodSource.treeInput.get();
try {
tree = (TreeInterface) BeautiDoc.deepCopyPlugin((BEASTInterface) treeSource, likelihood,
doc.getMCMC(), oldContext, newContext, doc, null);
} catch (Exception e) {
Alert.showMessageDialog(((Pane)this.getContent()), "Could not clone " + sourceID + " to " + targetID + " " + e.getMessage());
return;
tree = (TreeInterface) BeautiDoc.deepCopyPlugin((BEASTInterface) treeSource, likelihood,
doc.getMCMC(), oldContext, newContext, doc, null);
} catch (Exception e) {
Alert.showMessageDialog(((Pane)this.getContent()), "Could not clone " + sourceID + " to " + targetID + " " + e.getMessage());
return;
}
// deepCopyPlugin returns null instead of throwing when nothing was copied
if (tree == null) {
Alert.showMessageDialog(((Pane)this.getContent()), "Could not clone " + sourceID + " to " + targetID + ": no copy of " + treeSource.getID() + " was made");
return;
}
// sanity check: make sure taxon sets are compatible
Taxon.assertSameTaxa(tree.getID(), tree.getTaxonset().getTaxaNames(),
Expand Down
Loading