package jalview.gui;
import jalview.analysis.TreeBuilder;
+import jalview.analysis.TreeCalculator;
+import jalview.analysis.TreeModel;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.analysis.scoremodels.SimilarityParams;
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
import jalview.bin.Cache;
import jalview.datamodel.SequenceGroup;
+import jalview.ext.archaeopteryx.AptxInit;
import jalview.util.MessageManager;
import java.awt.BorderLayout;
Object curSel = comboBox.getSelectedItem();
toolTips.clear();
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
-
/*
* select the score models applicable to the alignment type
*/
protected void calculate_actionPerformed()
{
boolean doPCA = pca.isSelected();
- String modelName = modelNames.getSelectedItem().toString();
+ String substitutionMatrix = modelNames.getSelectedItem().toString();
SimilarityParamsI params = getSimilarityParameters(doPCA);
if (doPCA)
{
- openPcaPanel(modelName, params);
+ openPcaPanel(substitutionMatrix, params);
}
else
{
- openTreePanel(modelName, params);
+ createTree(substitutionMatrix, params);
+
+
+
+
+
+
}
// closeFrame();
}
- /**
- * Open a new Tree panel on the desktop
- *
- * @param modelName
- * @param params
- */
- protected void openTreePanel(String modelName, SimilarityParamsI params)
+ protected void createTree(String substitutionMatrix,
+ SimilarityParamsI params)
+ {
+ String treeAlgo = determineTreeAlgo();
+ TreeCalculator treeCalculator = new TreeCalculator(treeAlgo,
+ substitutionMatrix, params);
+ TreeBuilder calculatedTree = treeCalculator.makeTree(af.getViewport());
+
+ AptxInit.createInstance(calculatedTree);
+
+ TreeModel tree = new TreeModel(calculatedTree);
+ openTreePanel(tree, treeAlgo, substitutionMatrix);
+ }
+
+
+ protected String determineTreeAlgo() // to be modified & expanded
+ {
+ String treeAlgorithm = neighbourJoining.isSelected()
+ ? TreeBuilder.NEIGHBOUR_JOINING
+ : TreeBuilder.AVERAGE_DISTANCE;
+
+ return treeAlgorithm;
+
+ }
+
+ protected void checkEnoughSequences(AlignViewport viewport)
{
- /*
- * gui validation shouldn't allow insufficient sequences here, but leave
- * this check in in case this method gets exposed programmatically in future
- */
- AlignViewport viewport = af.getViewport();
SequenceGroup sg = viewport.getSelectionGroup();
if (sg != null && sg.getSize() < MIN_TREE_SELECTION)
{
JvOptionPane.WARNING_MESSAGE);
return;
}
+ }
- String treeType = neighbourJoining.isSelected()
- ? TreeBuilder.NEIGHBOUR_JOINING
- : TreeBuilder.AVERAGE_DISTANCE;
- af.newTreePanel(treeType, modelName, params);
+ /**
+ * Open a new Tree panel on the desktop
+ *
+ * @param tree
+ * @param params
+ * @param treeAlgo
+ */
+ protected void openTreePanel(TreeModel tree, String treeAlgo,
+ String substitutionMatrix)
+ {
+ /*
+ * gui validation shouldn't allow insufficient sequences here, but leave
+ * this check in in case this method gets exposed programmatically in future
+ */
+ checkEnoughSequences(af.getViewport());
+
+ af.newTreePanel(tree, treeAlgo, substitutionMatrix);
}
/**