action.link = Link
action.group_link = Group Link
action.show_chain = Show Chain
+label.highlight_selection = Highlight Selection
action.show_group = Show Group
action.fetch_db_references = Fetch DB References
action.view_flanking_regions = Show flanking regions
label.mapping_method = Sequence \u27f7 Structure mapping method
status.waiting_for_user_to_select_output_file = Waiting for user to select {0} file.
status.cancelled_image_export_operation = Cancelled {0} export operation.
-info.error_creating_file = Error creating {0} file.
\ No newline at end of file
+info.error_creating_file = Error creating {0} file.
*/
String[] modelFileNames = null;
- String lastMousedOverAtomSpec;
+ String lastHighlightCommand;
private List<String> lastReply;
* Construct and send a command to highlight zero, one or more atoms.
*
* <pre>
- * Done by generating a command like (to 'highlight' position 44)
- * show #0:44.C
+ * Done by generating a command like (to 'highlight' positions 44 and 46)
+ * show #0:44,46.C
* </pre>
*/
@Override
{
return;
}
- StringBuilder atomSpecs = new StringBuilder();
+ StringBuilder cmd = new StringBuilder(128);
boolean first = true;
+ boolean found = false;
for (AtomSpec atom : atoms)
{
List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
if (cms != null && !cms.isEmpty())
{
- atomSpecs.append(first ? "" : ",");
+ if (first)
+ {
+ cmd.append("show #").append(cms.get(0).getModelNumber())
+ .append(":");
+ }
+ else
+ {
+ cmd.append(",");
+ }
first = false;
- atomSpecs.append(cms.get(0).getModelNumber());
- atomSpecs.append(":" + pdbResNum);
+ cmd.append(cms.get(0).getModelNumber()).append(":");
+ cmd.append(pdbResNum);
if (!chain.equals(" "))
{
- atomSpecs.append("." + chain);
+ cmd.append(".").append(chain);
}
+ found = true;
}
}
- String atomSpec = atomSpecs.toString();
+ String command = cmd.toString();
/*
* Avoid repeated commands for the same residue
*/
- if (atomSpec.equals(lastMousedOverAtomSpec))
+ if (command.equals(lastHighlightCommand))
{
return;
}
- StringBuilder command = new StringBuilder(32);
viewerCommandHistory(false);
- if (atomSpec.length() > 0)
+ if (found)
{
- command.append("show #").append(atomSpec);
viewer.sendChimeraCommand(command.toString(), false);
}
viewerCommandHistory(true);
- this.lastMousedOverAtomSpec = atomSpec;
+ this.lastHighlightCommand = command;
}
/**
{
sendChimeraCommand("focus", false);
}
+
+ /**
+ * Send a 'show' command for all atoms in the currently selected columns
+ *
+ * @param vp
+ */
+ public void highlightSelection(AlignmentViewPanel vp)
+ {
+ List<Integer> cols = vp.getAlignViewport().getColumnSelection()
+ .getSelected();
+ AlignmentI alignment = vp.getAlignment();
+ StructureSelectionManager sm = getSsm();
+ for (SequenceI seq : alignment.getSequences())
+ {
+ /*
+ * convert selected columns into sequence positions
+ */
+ int[] positions = new int[cols.size()];
+ int i = 0;
+ for (Integer col : cols)
+ {
+ positions[i++] = seq.findPosition(col);
+ }
+ sm.highlightStructure(this, seq, positions);
+ }
+ }
}
});
viewMenu.add(seqColourBy);
viewMenu.add(fitToWindow);
+ viewMenu.add(highlightSelection);
final ItemListener handler;
JMenu alpanels = new ViewSelectionMenu(
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
closeViewer(false);
MessageManager.getString("label.all"));
menuItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
allChainsSelected = true;
menuItem = new JCheckBoxMenuItem(chainName, true);
menuItem.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent evt)
{
if (!allChainsSelected)
* @param closeChimera
* if true, close any linked Chimera process; if false, prompt first
*/
+ @Override
public void closeViewer(boolean closeChimera)
{
if (jmb != null && jmb.isChimeraRunning())
* Open any newly added PDB structures in Chimera, having first fetched data
* from PDB (if not already saved).
*/
+ @Override
public void run()
{
_started = true;
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
alignStructs_withAllAlignPanels();
}
}
+ @Override
public void setJalviewColourScheme(ColourSchemeI ucs)
{
jmb.setJalviewColourScheme(ucs);
}
@Override
+ protected void highlightSelection_actionPerformed()
+ {
+ jmb.highlightSelection(getAlignmentPanel());
+ }
+
+ @Override
public ViewerType getViewerType()
{
return ViewerType.CHIMERA;
protected JMenuItem fitToWindow = new JMenuItem();
+ protected JMenuItem highlightSelection = new JMenuItem();
+
protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
pdbFile.setText(MessageManager.getString("label.pdb_file"));
pdbFile.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
pdbFile_actionPerformed(actionEvent);
png.setText("PNG");
png.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
png_actionPerformed(actionEvent);
eps.setText("EPS");
eps.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
eps_actionPerformed(actionEvent);
viewMapping.setText(MessageManager.getString("label.view_mapping"));
viewMapping.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
viewMapping_actionPerformed(actionEvent);
fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
fitToWindow.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
fitToWindow_actionPerformed();
}
});
+ highlightSelection.setText(MessageManager
+ .getString("label.highlight_selection"));
+ highlightSelection.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ highlightSelection_actionPerformed();
+ }
+ });
+
JMenu colourMenu = new JMenu();
colourMenu.setText(MessageManager.getString("label.colours"));
.setText(MessageManager.getString("action.background_colour"));
backGround.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
backGround_actionPerformed(actionEvent);
seqColour.setText(MessageManager.getString("action.by_sequence"));
seqColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
seqColour_actionPerformed(actionEvent);
chainColour.setText(MessageManager.getString("action.by_chain"));
chainColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
chainColour_actionPerformed(actionEvent);
chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
chargeColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
chargeColour_actionPerformed(actionEvent);
zappoColour.setText(MessageManager.getString("label.zappo"));
zappoColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
zappoColour_actionPerformed(actionEvent);
taylorColour.setText(MessageManager.getString("label.taylor"));
taylorColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
taylorColour_actionPerformed(actionEvent);
hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
hydroColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
hydroColour_actionPerformed(actionEvent);
.getString("label.strand_propensity"));
strandColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
strandColour_actionPerformed(actionEvent);
helixColour.setText(MessageManager.getString("label.helix_propensity"));
helixColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
helixColour_actionPerformed(actionEvent);
turnColour.setText(MessageManager.getString("label.turn_propensity"));
turnColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
turnColour_actionPerformed(actionEvent);
buriedColour.setText(MessageManager.getString("label.buried_index"));
buriedColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
buriedColour_actionPerformed(actionEvent);
.getString("label.purine_pyrimidine"));
purinePyrimidineColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
purinePyrimidineColour_actionPerformed(actionEvent);
userColour.setText(MessageManager.getString("action.user_defined"));
userColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
userColour_actionPerformed(actionEvent);
.getString("label.let_jmol_manage_structure_colours"));
viewerColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
viewerColour_actionPerformed(actionEvent);
helpItem.setText(MessageManager.getString("label.jmol_help"));
helpItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
showHelp_actionPerformed(actionEvent);
.setText(MessageManager.getString("label.align_structures"));
alignStructs.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent actionEvent)
{
alignStructs_actionPerformed(actionEvent);
{
}
+ protected void highlightSelection_actionPerformed()
+ {
+ }
+
protected void viewerColour_actionPerformed(ActionEvent actionEvent)
{
}
* the sequence that the mouse over occurred on
* @param indexpos
* the absolute position being mouseovered in seq (0 to seq.length())
- * @param index
+ * @param seqPos
* the sequence position (if -1, seq.findPosition is called to
* resolve the residue number)
*/
- public void mouseOverSequence(SequenceI seq, int indexpos, int index,
+ public void mouseOverSequence(SequenceI seq, int indexpos, int seqPos,
VamsasSource source)
{
boolean hasSequenceListeners = handlingVamsasMo
|| !seqmappings.isEmpty();
SearchResults results = null;
- if (index == -1)
+ if (seqPos == -1)
{
- index = seq.findPosition(indexpos);
+ seqPos = seq.findPosition(indexpos);
}
for (int i = 0; i < listeners.size(); i++)
{
}
if (listener instanceof StructureListener)
{
- highlightStructure((StructureListener) listener, seq, index);
+ highlightStructure((StructureListener) listener, seq, seqPos);
}
else
{
{
if (results == null)
{
- results = MappingUtils.buildSearchResults(seq, index,
+ results = MappingUtils.buildSearchResults(seq, seqPos,
seqmappings);
}
if (handlingVamsasMo)
{
- results.addResult(seq, index, index);
+ results.addResult(seq, seqPos, seqPos);
}
if (!results.isEmpty())
else if (listener instanceof SecondaryStructureListener)
{
((SecondaryStructureListener) listener).mouseOverSequence(seq,
- indexpos, index);
+ indexpos, seqPos);
}
}
}
/**
* Send suitable messages to a StructureListener to highlight atoms
- * corresponding to the given sequence position.
+ * corresponding to the given sequence position(s)
*
* @param sl
* @param seq
- * @param index
+ * @param positions
*/
- protected void highlightStructure(StructureListener sl, SequenceI seq,
- int index)
+ public void highlightStructure(StructureListener sl, SequenceI seq,
+ int... positions)
{
if (!sl.isListeningFor(seq))
{
{
if (sm.sequence == seq || sm.sequence == seq.getDatasetSequence())
{
- atomNo = sm.getAtomNum(index);
-
- if (atomNo > 0)
+ for (int index : positions)
{
- atoms.add(new AtomSpec(sm.pdbfile, sm.pdbchain, sm
- .getPDBResNum(index), atomNo));
+ atomNo = sm.getAtomNum(index);
+
+ if (atomNo > 0)
+ {
+ atoms.add(new AtomSpec(sm.pdbfile, sm.pdbchain, sm
+ .getPDBResNum(index), atomNo));
+ }
}
}
}