import jalview.analysis.AlignmentUtils;
import jalview.analysis.TreeBuilder;
+import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.analysis.scoremodels.SimilarityParams;
import jalview.api.analysis.ScoreModelI;
private static final Font VERDANA_11PT = new Font("Verdana", 0, 11);
+
+ private static final int MIN_PAIRWISE_SELECTION = 2;
+
private static final int MIN_TREE_SELECTION = 3;
private static final int MIN_PCA_SELECTION = 4;
AlignFrame af;
+ JRadioButton pairwise;
+
JRadioButton pca;
JRadioButton pasimap;
averageDistance = new JRadioButton(
MessageManager.getString("label.tree_calc_av"));
averageDistance.setOpaque(false);
+
+ pairwise = new JRadioButton(MessageManager.getString("label.pairwise_alignment"));
+ pairwise.setOpaque(false);
JPanel calcChoicePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
calcChoicePanel.setOpaque(false);
treePanel.add(averageDistance);
calcChoicePanel.add(treePanel);
+ calcChoicePanel.add(pairwise,FlowLayout.CENTER);
ButtonGroup calcTypes = new ButtonGroup();
calcTypes.add(pca);
calcTypes.add(pasimap);
calcTypes.add(neighbourJoining);
calcTypes.add(averageDistance);
+ calcTypes.add(pairwise);
ActionListener calcChanged = new ActionListener()
{
//to do
ssSourceDropdown = buildSSSourcesOptionsList();
ssSourceDropdown.setVisible(false); // Initially hide the dropdown
-
+ pairwise.addActionListener(calcChanged);
/*
* score models drop-down - with added tooltips!
*/
MIN_TREE_SELECTION);
boolean checkAverageDistance = checkEnabled(averageDistance, size,
MIN_TREE_SELECTION);
+ boolean checkPairwise = checkEnabled(pairwise, size,
+ MIN_PAIRWISE_SELECTION);
- if (checkPca || checkPasimap || checkNeighbourJoining || checkAverageDistance)
+ if (checkPca || checkPasimap || checkPca || checkNeighbourJoining || checkAverageDistance || checkPairwise)
{
calculate.setToolTipText(null);
calculate.setEnabled(true);
{
boolean doPCA = pca.isSelected();
boolean doPaSiMap = pasimap.isSelected();
+ boolean doPairwise= pairwise.isSelected();
String modelName = modelNames.getSelectedItem() == null ? "" : modelNames.getSelectedItem().toString();
String ssSource = "";
Object selectedItem = ssSourceDropdown.getSelectedItem();
params.setSecondaryStructureSource(ssSource);
}
- if (doPCA && !doPaSiMap)
+ if (doPCA)
{
openPcaPanel(modelName, params);
- }
- else if (doPaSiMap && !doPCA)
- {
- openPasimapPanel(modelName, params);
- }
- else
- {
- openTreePanel(modelName, params);
- }
+ } else if (doPaSiMap) {
+ openPasimapPanel(modelName, params);
+ } else if (doPairwise) {
+ openPairwisePanel(modelName, params);
+ } else {
+ openTreePanel(modelName, params);
+ }
closeFrame();
}
+ private void openPairwisePanel(String modelName, SimilarityParamsI params)
+ {
+ ScoreModelI sm = ScoreModels.getInstance().getScoreModel(modelName, af.alignPanel);
+ if (sm==null || !(sm instanceof ScoreMatrix))
+ {
+ return;
+ }
+ JInternalFrame frame = new JInternalFrame();
+ frame.setFrameIcon(null);
+ frame.setContentPane(new PairwiseAlignPanel(af.getViewport(),(ScoreMatrix)sm));
+ Desktop.addInternalFrame(frame,
+ MessageManager.getString("action.pairwise_alignment"), 600,
+ 500);
+ }
+
/**
* Open a new Tree panel on the desktop
*