Skip to content

Commit 41c7a50

Browse files
committed
fix to make BEAUti work
1 parent ddfd68d commit 41c7a50

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

fxtemplates/morph-models.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@
143143
<mergewith point='substModelTemplates'>
144144

145145
<!-- LewisMK substitution model -->
146-
<subtemplate id='LewisMK' class='morphmodels.evolution.substitutionmodel.LewisMK' mainid='LewisMK.s:$(n)'>
146+
<subtemplate id='LewisMK' class='morphmodels.evolution.substitutionmodel.LewisMK' mainid='LewisMK.s:$(n)'
147+
suppressInputs='morphmodels.evolution.substitutionmodel.LewisMK.stateNumber,
148+
morphmodels.evolution.substitutionmodel.LewisMK.datatype,
149+
morphmodels.evolution.substitutionmodel.LewisMK.frequencies,
150+
morphmodels.evolution.substitutionmodel.LewisMK.proportionInvariant'>
147151
<![CDATA[
148152
<plugin spec='morphmodels.evolution.substitutionmodel.LewisMK' id='LewisMK.s:$(n)'/>
149153
]]>

src/morphmodels/app/beauti/BeautiMorphModelAlignmentProvider.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package morphmodels.app.beauti;
22

3+
34
import beast.base.core.Description;
45
import beast.base.core.ProgramStatus;
56

67
import java.io.File;
78
import java.util.*;
89

9-
import javax.swing.JFileChooser;
10-
import javax.swing.JOptionPane;
1110

1211
import beastfx.app.inputeditor.BeautiAlignmentProvider;
1312
import beastfx.app.inputeditor.BeautiDoc;
13+
import beastfx.app.util.Alert;
1414
import beastfx.app.util.ExtensionFileFilter;
1515
import beastfx.app.util.FXUtils;
16+
import javafx.scene.control.ButtonType;
1617
import beast.base.core.BEASTInterface;
1718
import beast.base.evolution.alignment.Alignment;
1819
import beast.base.evolution.alignment.FilteredAlignment;
@@ -85,7 +86,7 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
8586
+ parser.filteredAlignments.get(i % 10000 - 1).getID() + "<br/>";
8687
}
8788
overlaps += "The first thing you might want to do is delete some of these partitions.</html>";
88-
JOptionPane.showMessageDialog(null, overlaps);
89+
Alert.showMessageDialog(null, overlaps);
8990
}
9091
/** add alignments **/
9192
for (Alignment data : parser.filteredAlignments) {
@@ -96,7 +97,7 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
9697
}
9798
} catch (Exception ex) {
9899
ex.printStackTrace();
99-
JOptionPane.showMessageDialog(null, "Loading of " + fileName + " failed: " + ex.getMessage());
100+
Alert.showMessageDialog(null, "Loading of " + fileName + " failed: " + ex.getMessage());
100101
return null;
101102
}
102103
}
@@ -105,20 +106,22 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
105106
//"to apply different substitution models for each partition?", "Data partition with respect to the number of states", 0);
106107

107108
List<BEASTInterface> filteredAlignments = new ArrayList<>();
108-
int condition = JOptionPane.showConfirmDialog(null, "Would you like to condition on recording variable characters only (Mkv)?", "Conditioning on variable characters", 0);
109+
ButtonType condition = Alert.showConfirmDialog(null,
110+
"Would you like to condition on recording variable characters only (Mkv)?",
111+
"Conditioning on variable characters", Alert.YES_NO_OPTION);
109112
if (partitions == 0) {
110113
try {
111114
for (BEASTInterface o : selectedPlugins) {
112115
if (o instanceof Alignment) {
113-
if (condition == 0) {
116+
if (condition.toString().toLowerCase().contains("yes")) {
114117
processAlignment((Alignment) o, filteredAlignments, true, doc);
115118
} else {
116119
processAlignment((Alignment) o, filteredAlignments, false, doc);
117120
}
118121
}
119122
}
120123
} catch (Exception e) {
121-
JOptionPane.showMessageDialog(null, "Something went wrong converting the alignment: " + e.getMessage());
124+
Alert.showMessageDialog(null, "Something went wrong converting the alignment: " + e.getMessage());
122125
e.printStackTrace();
123126
return null;
124127
}

0 commit comments

Comments
 (0)