Skip to content

Commit

Permalink
fix to make BEAUti work
Browse files Browse the repository at this point in the history
  • Loading branch information
rbouckaert committed Aug 30, 2022
1 parent ddfd68d commit 41c7a50
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion fxtemplates/morph-models.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@
<mergewith point='substModelTemplates'>

<!-- LewisMK substitution model -->
<subtemplate id='LewisMK' class='morphmodels.evolution.substitutionmodel.LewisMK' mainid='LewisMK.s:$(n)'>
<subtemplate id='LewisMK' class='morphmodels.evolution.substitutionmodel.LewisMK' mainid='LewisMK.s:$(n)'
suppressInputs='morphmodels.evolution.substitutionmodel.LewisMK.stateNumber,
morphmodels.evolution.substitutionmodel.LewisMK.datatype,
morphmodels.evolution.substitutionmodel.LewisMK.frequencies,
morphmodels.evolution.substitutionmodel.LewisMK.proportionInvariant'>
<![CDATA[
<plugin spec='morphmodels.evolution.substitutionmodel.LewisMK' id='LewisMK.s:$(n)'/>
]]>
Expand Down
17 changes: 10 additions & 7 deletions src/morphmodels/app/beauti/BeautiMorphModelAlignmentProvider.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package morphmodels.app.beauti;


import beast.base.core.Description;
import beast.base.core.ProgramStatus;

import java.io.File;
import java.util.*;

import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

import beastfx.app.inputeditor.BeautiAlignmentProvider;
import beastfx.app.inputeditor.BeautiDoc;
import beastfx.app.util.Alert;
import beastfx.app.util.ExtensionFileFilter;
import beastfx.app.util.FXUtils;
import javafx.scene.control.ButtonType;
import beast.base.core.BEASTInterface;
import beast.base.evolution.alignment.Alignment;
import beast.base.evolution.alignment.FilteredAlignment;
Expand Down Expand Up @@ -85,7 +86,7 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
+ parser.filteredAlignments.get(i % 10000 - 1).getID() + "<br/>";
}
overlaps += "The first thing you might want to do is delete some of these partitions.</html>";
JOptionPane.showMessageDialog(null, overlaps);
Alert.showMessageDialog(null, overlaps);
}
/** add alignments **/
for (Alignment data : parser.filteredAlignments) {
Expand All @@ -96,7 +97,7 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
}
} catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Loading of " + fileName + " failed: " + ex.getMessage());
Alert.showMessageDialog(null, "Loading of " + fileName + " failed: " + ex.getMessage());
return null;
}
}
Expand All @@ -105,20 +106,22 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
//"to apply different substitution models for each partition?", "Data partition with respect to the number of states", 0);

List<BEASTInterface> filteredAlignments = new ArrayList<>();
int condition = JOptionPane.showConfirmDialog(null, "Would you like to condition on recording variable characters only (Mkv)?", "Conditioning on variable characters", 0);
ButtonType condition = Alert.showConfirmDialog(null,
"Would you like to condition on recording variable characters only (Mkv)?",
"Conditioning on variable characters", Alert.YES_NO_OPTION);
if (partitions == 0) {
try {
for (BEASTInterface o : selectedPlugins) {
if (o instanceof Alignment) {
if (condition == 0) {
if (condition.toString().toLowerCase().contains("yes")) {
processAlignment((Alignment) o, filteredAlignments, true, doc);
} else {
processAlignment((Alignment) o, filteredAlignments, false, doc);
}
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Something went wrong converting the alignment: " + e.getMessage());
Alert.showMessageDialog(null, "Something went wrong converting the alignment: " + e.getMessage());
e.printStackTrace();
return null;
}
Expand Down

0 comments on commit 41c7a50

Please sign in to comment.