use of dr.app.beauti.types.TreePriorType in project beast-mcmc by beast-dev.
the class PartitionTreePriorPanel method setupPanel.
private void setupPanel() {
removeAll();
JTextArea citationText = new JTextArea(1, 40);
citationText.setLineWrap(true);
citationText.setWrapStyleWord(true);
citationText.setEditable(false);
citationText.setFont(this.getFont());
citationText.setOpaque(false);
// citationText.setBackground(this.getBackground());
// JScrollPane scrollPane = new JScrollPane(citation, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
// JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// scrollPane.setOpaque(true);
String calYule = "Heled J, Drummond AJ (2011), Syst Biol, doi: 10.1093/sysbio/syr087 [Calibrated Yule]";
String citation;
String citationCoalescent = "Kingman JFC (1982) Stoch Proc Appl 13, 235-248 [Constant Coalescent].";
addComponentWithLabel("Tree Prior:", treePriorCombo);
if (!treesPanel.linkTreePriorCheck.isEnabled()) {
treesPanel.updateLinkTreePriorEnablility();
}
switch((TreePriorType) treePriorCombo.getSelectedItem()) {
case CONSTANT:
citation = citationCoalescent;
break;
case EXPONENTIAL:
case LOGISTIC:
case EXPANSION:
addComponentWithLabel("Parameterization for growth:", parameterizationCombo);
partitionTreePrior.setParameterization((TreePriorParameterizationType) parameterizationCombo.getSelectedItem());
// citationCoalescent + "\n" +
citation = "Griffiths RC, Tavare S (1994) Phil Trans R Soc Lond B Biol Sci 344, 403-410 [Parametric Coalescent].";
// + "\nDrummond AJ, Rambaut A, Shapiro B, Pybus OG (2005) Mol Biol Evol 22, 1185-1192.";
break;
case SKYLINE:
groupCountField.setColumns(6);
addComponentWithLabel("Number of groups:", groupCountField);
addComponentWithLabel("Skyline Model:", bayesianSkylineCombo);
// citationCoalescent + "\n" +
citation = "Drummond AJ, Rambaut A, Shapiro B, Pybus OG (2005) Mol Biol Evol 22, 1185-1192 [Skyline Coalescent].";
break;
case EXTENDED_SKYLINE:
addComponentWithLabel("Model Type:", extendedBayesianSkylineCombo);
treesPanel.linkTreePriorCheck.setSelected(true);
treesPanel.linkTreePriorCheck.setEnabled(false);
treesPanel.updateShareSameTreePriorChanged();
// citationCoalescent + "\n" +
citation = "Heled J, Drummond AJ (2008) BMC Evol Biol 8, 289 [Extended Skyline Coalescent].";
break;
case GMRF_SKYRIDE:
addComponentWithLabel("Smoothing:", gmrfBayesianSkyrideCombo);
treesPanel.linkTreePriorCheck.setSelected(true);
treesPanel.linkTreePriorCheck.setEnabled(false);
// For GMRF, one tree prior has to be associated to one tree model. The validation is in BeastGenerator.checkOptions()
addLabel("<html>For the Skyride, tree model/tree prior combination not implemented by BEAST. " + "The Skyride is only available for a single tree<br>model partition in this release. " + "Please try the Skygrid or link all tree models." + "</html>");
// citationCoalescent + "\n" +
citation = "Minin VN, Bloomquist EW, Suchard MA (2008) Mol Biol Evol 25, 1459-1471 [Skyride Coalescent].";
break;
case SKYGRID:
skyGridPointsField.setColumns(6);
addComponentWithLabel("Number of parameters:", skyGridPointsField);
skyGridInterval.setColumns(6);
addComponentWithLabel("Time at last transition point:", skyGridInterval);
treesPanel.linkTreePriorCheck.setSelected(true);
treesPanel.linkTreePriorCheck.setEnabled(false);
treesPanel.updateShareSameTreePriorChanged();
// citationCoalescent + "\n" +
citation = "Gill MS, Lemey P, Faria NR, Rambaut A, Shapiro B, Suchard MA (2013) Mol Biol Evol 30, 713-724 [SkyGrid Coalescent].";
break;
case YULE:
citation = "Gernhard T (2008) J Theor Biol 253, 769-778 [Yule Process]." + "\nYule GU (1925) Phil Trans R Soc Lond B Biol Sci 213, 21-87 [Yule Process].";
break;
case YULE_CALIBRATION:
// addComponentWithLabel("Calibration Correction Type:", calibrationCorrectionCombo);
citation = calYule;
break;
case BIRTH_DEATH:
citation = BirthDeathModelParser.getCitation();
break;
case BIRTH_DEATH_INCOMPLETE_SAMPLING:
citation = BirthDeathModelParser.getCitationRHO();
break;
case BIRTH_DEATH_SERIAL_SAMPLING:
citation = BirthDeathSerialSamplingModelParser.getCitationPsiOrg();
break;
case BIRTH_DEATH_BASIC_REPRODUCTIVE_NUMBER:
citation = BirthDeathSerialSamplingModelParser.getCitationRT();
break;
default:
throw new RuntimeException("No such tree prior has been specified so cannot refer to it");
}
if (treesPanel.options.maximumTipHeight > 0)
citation = citation + // "Rodrigo AG, Felsenstein J (1999) in Molecular Evolution of HIV (Crandall K), pp. 233-272 [Serially Sampled Data]."
"\n" + "Drummond AJ, Nicholls GK, Rodrigo AG, Solomon W (2002) Genetics 161, 1307-1320 [Serially Sampled Data].";
addComponentWithLabel("Citation:", citationText);
citationText.setText(citation);
for (PartitionTreeModel model : treesPanel.treeModelPanels.keySet()) {
if (model != null) {
treesPanel.treeModelPanels.get(model).setOptions();
treesPanel.treeModelPanels.get(model).setupPanel();
}
}
validate();
repaint();
}
use of dr.app.beauti.types.TreePriorType in project beast-mcmc by beast-dev.
the class TreePriorGenerator method writeTreePriorModel.
// void writeTreePrior(PartitionTreePrior prior, PartitionTreeModel model, XMLWriter writer) { // for species, partitionName.treeModel
// setModelPrefix(prior.getPrefix()); // only has prefix, if (options.getPartitionTreePriors().size() > 1)
//
// writePriorLikelihood(prior, model, writer);
// }
/**
* Write a tree prior (coalescent or speciational) model
*
* @param prior the partition tree prior
* @param writer the writer
*/
void writeTreePriorModel(PartitionTreePrior prior, XMLWriter writer) {
String prefix = prior.getPrefix();
String initialPopSize = null;
TreePriorType nodeHeightPrior = prior.getNodeHeightPrior();
Units.Type units = options.units;
TreePriorParameterizationType parameterization = prior.getParameterization();
switch(nodeHeightPrior) {
case CONSTANT:
writer.writeComment("A prior assumption that the population size has remained constant", "throughout the time spanned by the genealogy.");
writer.writeOpenTag(ConstantPopulationModelParser.CONSTANT_POPULATION_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + "constant"), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(options.units)) });
writer.writeOpenTag(ConstantPopulationModelParser.POPULATION_SIZE);
writeParameter("constant.popSize", prior, writer);
writer.writeCloseTag(ConstantPopulationModelParser.POPULATION_SIZE);
writer.writeCloseTag(ConstantPopulationModelParser.CONSTANT_POPULATION_MODEL);
break;
case EXPONENTIAL:
// generate an exponential prior tree
writer.writeComment("A prior assumption that the population size has grown exponentially", "throughout the time spanned by the genealogy.");
writer.writeOpenTag(ExponentialGrowthModelParser.EXPONENTIAL_GROWTH_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + "exponential"), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(options.units)) });
// write pop size socket
writer.writeOpenTag(ExponentialGrowthModelParser.POPULATION_SIZE);
writeParameter("exponential.popSize", prior, writer);
writer.writeCloseTag(ExponentialGrowthModelParser.POPULATION_SIZE);
if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
// write growth rate socket
writer.writeOpenTag(ExponentialGrowthModelParser.GROWTH_RATE);
writeParameter("exponential.growthRate", prior, writer);
writer.writeCloseTag(ExponentialGrowthModelParser.GROWTH_RATE);
} else {
// write doubling time socket
writer.writeOpenTag(ExponentialGrowthModelParser.DOUBLING_TIME);
writeParameter("exponential.doublingTime", prior, writer);
writer.writeCloseTag(ExponentialGrowthModelParser.DOUBLING_TIME);
}
writer.writeCloseTag(ExponentialGrowthModelParser.EXPONENTIAL_GROWTH_MODEL);
break;
case LOGISTIC:
// generate an exponential prior tree
writer.writeComment("A prior assumption that the population size has grown logistically", "throughout the time spanned by the genealogy.");
writer.writeOpenTag(LogisticGrowthModelParser.LOGISTIC_GROWTH_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + "logistic"), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(options.units)) });
// write pop size socket
writer.writeOpenTag(LogisticGrowthModelParser.POPULATION_SIZE);
writeParameter("logistic.popSize", prior, writer);
writer.writeCloseTag(LogisticGrowthModelParser.POPULATION_SIZE);
if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
// write growth rate socket
writer.writeOpenTag(LogisticGrowthModelParser.GROWTH_RATE);
writeParameter("logistic.growthRate", prior, writer);
writer.writeCloseTag(LogisticGrowthModelParser.GROWTH_RATE);
} else {
// write doubling time socket
writer.writeOpenTag(LogisticGrowthModelParser.DOUBLING_TIME);
writeParameter("logistic.doublingTime", prior, writer);
writer.writeCloseTag(LogisticGrowthModelParser.DOUBLING_TIME);
}
// write logistic t50 socket
writer.writeOpenTag(LogisticGrowthModelParser.TIME_50);
// if (options.clockModelOptions.getRateOptionClockModel() == FixRateType.FIX_MEAN
// || options.clockModelOptions.getRateOptionClockModel() == FixRateType.RELATIVE_TO) {
// writer.writeComment("No calibration");
// writer.writeComment("logistic.t50 initial always has to < treeRootHeight initial");
// dr.app.beauti.options.Parameter priorPara = prior.getParameter("logistic.t50");
//
// double initRootHeight;
// if (options.isShareSameTreePrior()) {
// initRootHeight = priorPara.initial;
// for (PartitionTreeModel tree : options.getPartitionTreeModels()) {
// double tmpRootHeight = tree.getParameter("treeModel.rootHeight").initial;
// if (initRootHeight > tmpRootHeight) { // take min
// initRootHeight = tmpRootHeight;
// }
// }
// } else {
// initRootHeight = prior.getTreeModel().getParameter("treeModel.rootHeight").initial;
// }
// // logistic.t50 initial always has to < treeRootHeight initial
// if (priorPara.initial >= initRootHeight) {
// priorPara.initial = initRootHeight / 2; // tree prior.initial has to < treeRootHeight.initial
// }
// } else {
// writer.writeComment("Has calibration");
//
// throw new IllegalArgumentException("This function is not available in this release !");
// }
writeParameter("logistic.t50", prior, writer);
writer.writeCloseTag(LogisticGrowthModelParser.TIME_50);
writer.writeCloseTag(LogisticGrowthModelParser.LOGISTIC_GROWTH_MODEL);
initialPopSize = "logistic.popSize";
break;
case EXPANSION:
// generate an exponential prior tree
writer.writeComment("A prior assumption that the population size has grown exponentially", "from some ancestral population size in the past.");
writer.writeOpenTag(ExpansionModelParser.EXPANSION_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + "expansion"), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(options.units)) });
// write pop size socket
writeParameter(ExpansionModelParser.POPULATION_SIZE, "expansion.popSize", prior, writer);
if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
// write growth rate socket
writeParameter(ExpansionModelParser.GROWTH_RATE, "expansion.growthRate", prior, writer);
} else {
// write doubling time socket
writeParameter(ExpansionModelParser.DOUBLING_TIME, "expansion.doublingTime", prior, writer);
}
// write ancestral proportion socket
writeParameter(ExpansionModelParser.ANCESTRAL_POPULATION_PROPORTION, "expansion.ancestralProportion", prior, writer);
writer.writeCloseTag(ExpansionModelParser.EXPANSION_MODEL);
initialPopSize = "expansion.popSize";
break;
case YULE:
case YULE_CALIBRATION:
if (nodeHeightPrior == TreePriorType.YULE_CALIBRATION) {
writer.writeComment("Calibrated Yule: Heled J, Drummond AJ (2011), Syst Biol, doi: " + "10.1093/sysbio/syr087");
} else {
writer.writeComment("A prior on the distribution node heights defined given", "a Yule speciation process (a pure birth process).");
}
writer.writeOpenTag(YuleModelParser.YULE_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + YuleModelParser.YULE), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(units)) });
writeParameter(YuleModelParser.BIRTH_RATE, "yule.birthRate", prior, writer);
writer.writeCloseTag(YuleModelParser.YULE_MODEL);
break;
case BIRTH_DEATH:
case BIRTH_DEATH_INCOMPLETE_SAMPLING:
writer.writeComment("A prior on the distribution node heights defined given");
writer.writeComment(nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING ? BirthDeathModelParser.getCitationRHO() : BirthDeathModelParser.getCitation());
writer.writeOpenTag(BirthDeathModelParser.BIRTH_DEATH_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + BirthDeathModelParser.BIRTH_DEATH), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(units)) });
writeParameter(BirthDeathModelParser.BIRTHDIFF_RATE, BirthDeathModelParser.MEAN_GROWTH_RATE_PARAM_NAME, prior, writer);
writeParameter(BirthDeathModelParser.RELATIVE_DEATH_RATE, BirthDeathModelParser.RELATIVE_DEATH_RATE_PARAM_NAME, prior, writer);
if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING) {
writeParameter(BirthDeathModelParser.SAMPLE_PROB, BirthDeathModelParser.BIRTH_DEATH + "." + BirthDeathModelParser.SAMPLE_PROB, prior, writer);
}
writer.writeCloseTag(BirthDeathModelParser.BIRTH_DEATH_MODEL);
break;
case BIRTH_DEATH_SERIAL_SAMPLING:
writer.writeComment(BirthDeathSerialSamplingModelParser.getCitationPsiOrg());
writer.writeOpenTag(BirthDeathSerialSamplingModelParser.BIRTH_DEATH_SERIAL_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + BirthDeathSerialSamplingModelParser.BDSS), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(units)), new Attribute.Default<Boolean>(BirthDeathSerialSamplingModelParser.HAS_FINAL_SAMPLE, false) });
writeParameter(BirthDeathSerialSamplingModelParser.LAMBDA, BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.LAMBDA, prior, writer);
writeParameter(BirthDeathSerialSamplingModelParser.RELATIVE_MU, BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.RELATIVE_MU, prior, writer);
// writeParameter(BirthDeathSerialSamplingModelParser.SAMPLE_PROBABILITY,
// BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.SAMPLE_PROBABILITY, prior, writer);
writeParameter(BirthDeathSerialSamplingModelParser.PSI, BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.PSI, prior, writer);
writeParameter(BirthDeathSerialSamplingModelParser.ORIGIN, BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.ORIGIN, prior, writer);
writer.writeCloseTag(BirthDeathSerialSamplingModelParser.BIRTH_DEATH_SERIAL_MODEL);
break;
case BIRTH_DEATH_BASIC_REPRODUCTIVE_NUMBER:
writer.writeComment(BirthDeathSerialSamplingModelParser.getCitationRT());
writer.writeOpenTag(BirthDeathEpidemiologyModelParser.BIRTH_DEATH_EPIDEMIOLOGY, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + BirthDeathEpidemiologyModelParser.BIRTH_DEATH_EPIDEMIOLOGY), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(units)) });
writeParameter(BirthDeathEpidemiologyModelParser.R0, BirthDeathEpidemiologyModelParser.R0, prior, writer);
writeParameter(BirthDeathEpidemiologyModelParser.RECOVERY_RATE, BirthDeathEpidemiologyModelParser.RECOVERY_RATE, prior, writer);
writeParameter(BirthDeathEpidemiologyModelParser.SAMPLING_PROBABILITY, BirthDeathEpidemiologyModelParser.SAMPLING_PROBABILITY, prior, writer);
writeParameter(BirthDeathEpidemiologyModelParser.ORIGIN, BirthDeathEpidemiologyModelParser.ORIGIN, prior, writer);
writer.writeCloseTag(BirthDeathEpidemiologyModelParser.BIRTH_DEATH_EPIDEMIOLOGY);
break;
}
if (nodeHeightPrior != TreePriorType.CONSTANT && nodeHeightPrior != TreePriorType.EXPONENTIAL) {
// If the node height prior is not one of these two then we need to simulate a
// random starting tree under a constant size coalescent.
writer.writeComment("This is a simple constant population size coalescent model", "that is used to generate an initial tree for the chain.");
writer.writeOpenTag(ConstantPopulationModelParser.CONSTANT_POPULATION_MODEL, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, prefix + "initialDemo"), new Attribute.Default<String>("units", Units.Utils.getDefaultUnitName(units)) });
writer.writeOpenTag(ConstantPopulationModelParser.POPULATION_SIZE);
if (initialPopSize != null) {
writer.writeIDref(ParameterParser.PARAMETER, prefix + initialPopSize);
} else {
writeParameter(prefix + "initialDemo.popSize", 1, 100.0, Double.NaN, Double.NaN, writer);
}
writer.writeCloseTag(ConstantPopulationModelParser.POPULATION_SIZE);
writer.writeCloseTag(ConstantPopulationModelParser.CONSTANT_POPULATION_MODEL);
}
// if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_BASIC_REPRODUCTIVE_NUMBER) {
// writer.writeComment("R0 = b/(b*d+s*r)");
// writer.writeOpenTag(RPNcalculatorStatisticParser.RPN_STATISTIC,
// new Attribute[]{
// new Attribute.Default<String>(XMLParser.ID, modelPrefix + "R0")
// });
//
// writer.writeOpenTag(RPNcalculatorStatisticParser.VARIABLE,
// new Attribute[]{
// new Attribute.Default<String>(Statistic.NAME, modelPrefix + "b")
// });
// writeParameterRef(modelPrefix + BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.LAMBDA, writer);
// writer.writeCloseTag(RPNcalculatorStatisticParser.VARIABLE);
//
// writer.writeOpenTag(RPNcalculatorStatisticParser.VARIABLE,
// new Attribute[]{
// new Attribute.Default<String>(Statistic.NAME, modelPrefix + "d")
// });
// writeParameterRef(modelPrefix + BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.RELATIVE_MU, writer);
// writer.writeCloseTag(RPNcalculatorStatisticParser.VARIABLE);
//
// writer.writeOpenTag(RPNcalculatorStatisticParser.VARIABLE,
// new Attribute[]{
// new Attribute.Default<String>(Statistic.NAME, modelPrefix + "s")
// });
// writeParameterRef(modelPrefix + BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.PSI, writer);
// writer.writeCloseTag(RPNcalculatorStatisticParser.VARIABLE);
//
// writer.writeOpenTag(RPNcalculatorStatisticParser.VARIABLE,
// new Attribute[]{
// new Attribute.Default<String>(Statistic.NAME, modelPrefix + "r")
// });
// writeParameterRef(modelPrefix + BirthDeathSerialSamplingModelParser.BDSS + "." + BirthDeathSerialSamplingModelParser.R, writer);
// writer.writeCloseTag(RPNcalculatorStatisticParser.VARIABLE);
//
// writer.writeOpenTag(RPNcalculatorStatisticParser.EXPRESSION,
// new Attribute[]{
// new Attribute.Default<String>(Statistic.NAME, modelPrefix + "R0")
// });
// writer.writeText(modelPrefix + "b " + modelPrefix + "b " + modelPrefix + "d " + "* " + modelPrefix + "s " + modelPrefix + "r " + "* + /");
// writer.writeCloseTag(RPNcalculatorStatisticParser.EXPRESSION);
//
// writer.writeCloseTag(RPNcalculatorStatisticParser.RPN_STATISTIC);
// }
}
use of dr.app.beauti.types.TreePriorType in project beast-mcmc by beast-dev.
the class MLEGSSDialog method showDialog.
public int showDialog() {
final JOptionPane optionPane = new JOptionPane(optionsPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
final JDialog dialog = optionPane.createDialog(frame, description);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
// do nothing
}
});
optionPane.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
// if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
if (!dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
// checking if a tree working prior has been selected
if (((String) treeWorkingPrior.getSelectedItem()).equals("None")) {
JOptionPane.showMessageDialog(frame, "Please select a suitable tree working prior.", "Tree working prior selection warning", JOptionPane.WARNING_MESSAGE);
dialog.setVisible(true);
} else {
TreePriorType treePrior = beautiOptions.getPartitionTreePriors().get(0).getNodeHeightPrior();
if (((String) treeWorkingPrior.getSelectedItem()).equals("Matching coalescent model")) {
if (!(treePrior.equals(TreePriorType.CONSTANT) || treePrior.equals(TreePriorType.EXPONENTIAL) || treePrior.equals(TreePriorType.EXPANSION) || treePrior.equals(TreePriorType.LOGISTIC))) {
JOptionPane.showMessageDialog(frame, "Please select a suitable tree working prior.", "Tree working prior selection warning", JOptionPane.WARNING_MESSAGE);
dialog.setVisible(true);
}
} else if (((String) treeWorkingPrior.getSelectedItem()).equals("Matching speciation model")) {
if (!treePrior.equals(TreePriorType.YULE)) {
JOptionPane.showMessageDialog(frame, "Please select a suitable tree working prior.", "Tree working prior selection warning", JOptionPane.WARNING_MESSAGE);
dialog.setVisible(true);
}
} else if (((String) treeWorkingPrior.getSelectedItem()).equals("Product of exponential distributions")) {
if (treePrior.equals(TreePriorType.YULE)) {
JOptionPane.showMessageDialog(frame, "Please select a suitable tree working prior.", "Tree working prior selection warning", JOptionPane.WARNING_MESSAGE);
dialog.setVisible(true);
}
} else {
dialog.setVisible(false);
}
}
}
}
});
dialog.pack();
dialog.setVisible(true);
int result = JOptionPane.CANCEL_OPTION;
Integer value = (Integer) optionPane.getValue();
if (value != null && value != -1) {
result = value;
}
return result;
}
Aggregations