import java.util.Collections;
import java.util.Iterator;
import java.util.Locale;
+import java.util.concurrent.Callable;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
import jalview.datamodel.ContactMatrixI;
+import jalview.datamodel.GroupSet;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
consclipbrd.addActionListener(this);
pop.add(consclipbrd);
}
- if (aa[selectedRow].graph == AlignmentAnnotation.CONTACT_MAP
- && PAEContactMatrix.PAEMATRIX
- .equals(aa[selectedRow].getCalcId()))
+ if (aa[selectedRow].graph == AlignmentAnnotation.CONTACT_MAP)
{
- final PAEContactMatrix cm = (PAEContactMatrix) av
- .getContactMatrix(aa[selectedRow]);
- if (cm != null && cm.getNewick() != null
- && cm.getNewick().length() > 0)
+
+ final ContactMatrixI cm = av.getContactMatrix(aa[selectedRow]);
+ if (cm != null)
{
- item = new JMenuItem("Show Tree for Matrix");
- item.addActionListener(new ActionListener()
- {
+ pop.addSeparator();
- @Override
- public void actionPerformed(ActionEvent e)
+ if (cm.hasTree())
+ {
+ item = new JMenuItem("Show Tree for Matrix");
+ item.addActionListener(new ActionListener()
{
- ap.alignFrame.showContactMapTree(aa[selectedRow], cm);
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
- }
- });
- pop.addSeparator();
- pop.add(item);
- }
+ ap.alignFrame.showContactMapTree(aa[selectedRow], cm);
+ }
+ });
+ pop.add(item);
+ }
+ else
+ {
+ item = new JMenuItem("Calculate Tree for Matrix");
+ item.addActionListener(new ActionListener()
+ {
+ // TODO - refactor to analysis background thread
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ AlignmentAnnotation alan = aa[selectedRow];
+ cm.setGroupSet(GroupSet.makeGroups(cm, 5f, true));
+ ap.alignFrame.showContactMapTree(alan, cm);
+ }
+ }).start();
+ }
+ });
+ pop.add(item);
+
+ }
+ // Show/Hide group shading on matrix view
+ // Set/adjust threshold for grouping ?
+ // colour alignment by this [type]
+ // select/hide columns by this row
+
+ }
}
}
pop.show(this, evt.getX(), evt.getY());