package jalview.gui;
import java.util.*;
-
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
+
import javax.swing.*;
import jalview.datamodel.*;
import jalview.jbgui.*;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.ScoreMatrix;
import jalview.util.MessageManager;
import jalview.viewmodel.PCAModel;
Thread worker = new Thread(this);
worker.start();
}
-
+ @Override
+ protected void scoreMatrix_menuSelected()
+ {
+ scoreMatrixMenu.removeAll();
+ for (final Object sm:ResidueProperties.scoreMatrices.keySet())
+ {
+ JMenuItem jm=new JMenuItem();
+ jm.setText((String)sm);
+ jm.setSelected(pcaModel.getScore_matrix().equals((String)sm));
+ final PCAPanel us = this;
+ jm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (!pcaModel.getScore_matrix().equals((String)sm))
+ {
+ pcaModel.setScore_matrix((String) sm);
+ Thread worker = new Thread(us);
+ worker.start();
+ }
+ }
+ });
+ scoreMatrixMenu.add(jm);
+ }
+ }
public void bgcolour_actionPerformed(ActionEvent e)
{
Color col = JColorChooser.showDialog(this, "Select Background Colour",
}
}
+
public void viewMenu_menuSelected()
{
buildAssociatedViewMenu();
JMenu fileMenu = new JMenu();
JMenu saveMenu = new JMenu();
+
+ protected JMenu scoreMatrixMenu = new JMenu();
JMenuItem eps = new JMenuItem();
{
}
});
+ scoreMatrixMenu.setText(MessageManager.getString("label.score_matrices"));
+ scoreMatrixMenu.addMenuListener(new MenuListener()
+ {
+ public void menuSelected(MenuEvent e)
+ {
+ scoreMatrix_menuSelected();
+ }
+
+ public void menuDeselected(MenuEvent e)
+ {
+ }
+
+ public void menuCanceled(MenuEvent e)
+ {
+ }
+ });
showLabels.setText(MessageManager.getString("label.show_labels"));
showLabels.addActionListener(new ActionListener()
{
calcSettings.add(jvVersionSetting);
calcSettings.add(nuclSetting);
calcSettings.add(protSetting);
+ calcSettings.add(scoreMatrixMenu);
statusPanel.setLayout(statusPanelLayout);
statusBar.setFont(new java.awt.Font("Verdana", 0, 12));
// statusPanel.setBackground(Color.lightGray);
viewMenu.add(associateViewsMenu);
}
+ protected void scoreMatrix_menuSelected()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void resetButton_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
seqstrings = seqstrings2;
seqs = seqs2;
nucleotide = nucleotide2;
+ score_matrix = nucleotide2 ? "PID" : "BLOSUM62";
}
private volatile PCA pca;
AlignmentView seqstrings;
SequenceI[] seqs;
+
+ /**
+ * Score matrix used to calculate PC
+ */
+ String score_matrix;
/**
* use the identity matrix for calculating similarity between sequences.
public void run()
{
- pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide);
+ pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide, score_matrix);
pca.setJvCalcMode(jvCalcMode);
pca.run();
jvCalcMode = state;
}
+ public String getScore_matrix()
+ {
+ return score_matrix;
+ }
+
+ public void setScore_matrix(String score_matrix)
+ {
+ this.score_matrix = score_matrix;
+ }
+
}