From: Jim Procter Date: Thu, 27 Nov 2014 14:39:32 +0000 (+0000) Subject: Merge branch 'patchJAL-674_offset' into Release_2_8_2_Branch X-Git-Tag: Release_2_8_2b1^2~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fef5170ee6fbcdb70a14f6682a96cdd68f8ce88f;hp=3ad07b11cf5c6c2a763fa9661252bb29ac4bc132;p=jalview.git Merge branch 'patchJAL-674_offset' into Release_2_8_2_Branch --- diff --git a/help/html/features/chimera.html b/help/html/features/chimera.html index 236701a..dbaad73 100644 --- a/help/html/features/chimera.html +++ b/help/html/features/chimera.html @@ -24,7 +24,7 @@

The Chimera Viewer

-

Since Jalview 2.8.2, Chimera +

Since Jalview 2.8.2, Chimera (http://www.cgl.ucsf.edu/chimera/) has been integrated into Jalview for interactively viewing structures opened by entries in the "Structure" submenu in the sequence id pop-up menu (if you can't see this, then you need to -

Basic screen operations (see Chimera help for full details). +

Basic screen operations (see Chimera help +(http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/mouse.html) for full details). diff --git a/help/html/features/viewingpdbs.html b/help/html/features/viewingpdbs.html index 75a5c9c..99f17fe 100755 --- a/help/html/features/viewingpdbs.html +++ b/help/html/features/viewingpdbs.html @@ -31,8 +31,7 @@

The Jmol viewer has been included since Jalview - 2.3. Jalview 2.8.2 included support for - Chimera, provided it is + 2.3. Jalview 2.8.2 included support for Chimera, provided it is installed and can be launched by Jalview. The default viewer can be configured in the Structure tab in the diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index cabee76..795dfa0 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -251,6 +251,7 @@ label.structure_viewer = Default structure viewer label.chimera_path = Path to Chimera program label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.
Double-click to browse for file. label.invalid_chimera_path = Chimera path not found or not executable +label.chimera_missing = Chimera structure viewer not found.
Please enter the path to Chimera (if installed),
or download and install UCSF Chimera. label.min_colour = Minimum Colour label.max_colour = Maximum Colour label.use_original_colours = Use Original Colours diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java index 1208638..4797b37 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java @@ -864,22 +864,24 @@ public class StructureManager StructureSettings defaultSettings = null; // TODO: [Optional] Change priority of Chimera paths - public List getChimeraPaths() + public static List getChimeraPaths() { List pathList = new ArrayList(); // if no network is available and the settings have been modified by the // user, check for a // path to chimera - if (defaultSettings != null) - { - String defaultPath = defaultSettings.getChimeraPath(); - if (defaultPath != null && !defaultPath.equals("")) - { - pathList.add(defaultPath); - return pathList; - } - } + // + // For Jalview, Preferences/Cache plays this role instead + // if (defaultSettings != null) + // { + // String defaultPath = defaultSettings.getChimeraPath(); + // if (defaultPath != null && !defaultPath.equals("")) + // { + // pathList.add(defaultPath); + // return pathList; + // } + // } /* * Jalview addition: check if path set in user preferences. @@ -887,7 +889,7 @@ public class StructureManager String userPath = Cache.getDefault(Preferences.CHIMERA_PATH, null); if (userPath != null) { - pathList.add(userPath); + pathList.add(0, userPath); } // Add default installation paths diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index fb03f04..82f5e5c 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -782,7 +782,7 @@ public abstract class JalviewChimeraBinding extends private void waitForChimera() { - while (viewer.isBusy()) + while (viewer != null && viewer.isBusy()) { try { Thread.sleep(15); @@ -954,7 +954,7 @@ public abstract class JalviewChimeraBinding extends } } - boolean debug = true; + boolean debug = false; private void log(String message) { @@ -963,8 +963,8 @@ public abstract class JalviewChimeraBinding extends private void viewerCommandHistory(boolean enable) { - log("(Not yet implemented) History " - + ((debug || enable) ? "on" : "off")); + // log("(Not yet implemented) History " + // + ((debug || enable) ? "on" : "off")); } public void loadInline(String string) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 0087e8d..31652c1 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4186,6 +4186,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ msa = viewport.getAlignmentView(true); } + else if (viewport.getSelectionGroup() != null + && viewport.getSelectionGroup().getSize() == 1) + { + int option = JOptionPane + .showConfirmDialog( +this, + "More than one sequece group selection is required for this Job, click \n'Cancel' to edit your selection or 'Ok' to submit the entire sequence.", + "Invalid selection", + JOptionPane.OK_CANCEL_OPTION); + if (option == JOptionPane.OK_OPTION) + { + msa = viewport.getAlignmentView(false); + } + + } else { /* diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 02865e1..513659f 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -840,8 +840,13 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, { if (progressBar != null) { - progressBar.setProgressBar( - MessageManager.getString("label.state_completed"), hdl); + progressBar + .setProgressBar( + pdbid + + " " + + MessageManager + .getString("label.state_completed"), + hdl); } } /* diff --git a/src/jalview/gui/Help.java b/src/jalview/gui/Help.java index ae3f457..b07cc4e 100644 --- a/src/jalview/gui/Help.java +++ b/src/jalview/gui/Help.java @@ -17,7 +17,8 @@ public class Help { public enum HelpId { - Home("home"), SequenceFeatureSettings("seqfeatures.settings"); + Home("home"), SequenceFeatureSettings("seqfeatures.settings"), StructureViewer( + "viewingpdbs"); private String id; diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index b082bc6..bdc83e5 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -22,6 +22,7 @@ package jalview.gui; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.bin.Cache; +import jalview.gui.Help.HelpId; import jalview.gui.StructureViewer.Viewer; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; @@ -39,15 +40,19 @@ import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.io.File; import java.util.Collection; +import java.util.List; import java.util.StringTokenizer; import java.util.Vector; +import javax.help.HelpSetException; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.JInternalFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; +import ext.edu.ucsf.rbvi.strucviz2.StructureManager; + /** * DOCUMENT ME! * @@ -596,7 +601,8 @@ public class Preferences extends GPreferences } /** - * Do any necessary validation before saving settings. + * Do any necessary validation before saving settings. Return focus to the + * first tab which fails validation. * * @return */ @@ -879,4 +885,53 @@ public class Preferences extends GPreferences return true; } + /** + * If Chimera is selected, check it can be found on default or user-specified + * path, if not show a warning/help dialog. + */ + @Override + protected void structureViewer_actionPerformed(String selectedItem) + { + if (!selectedItem.equals(Viewer.CHIMERA.name())) + { + return; + } + boolean found = false; + + /* + * Try user-specified and standard paths for Chimera executable. + */ + List paths = StructureManager.getChimeraPaths(); + paths.add(0, chimeraPath.getText()); + for (String path : paths) + { + if (new File(path.trim()).canExecute()) + { + found = true; + break; + } + } + if (!found) + { + String[] options = + { "OK", "Help" }; + int showHelp = JOptionPane.showInternalOptionDialog( + Desktop.desktop, + JvSwingUtils.wrapTooltip(true, + MessageManager.getString("label.chimera_missing")), + "", JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE, null, options, options[0]); + if (showHelp == JOptionPane.NO_OPTION) + { + try + { + Help.showHelpWindow(HelpId.StructureViewer); + } catch (HelpSetException e) + { + e.printStackTrace(); + } + } + } + } + } diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 5569c24..610f32e 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -782,6 +782,15 @@ public class GPreferences extends JPanel structViewer.setBounds(new Rectangle(160, ypos, 120, height)); structViewer.addItem(Viewer.JMOL.name()); structViewer.addItem(Viewer.CHIMERA.name()); + structViewer.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + structureViewer_actionPerformed((String) structViewer + .getSelectedItem()); + } + }); structureTab.add(structViewer); ypos += lineSpacing; @@ -819,6 +828,15 @@ public class GPreferences extends JPanel } /** + * Action on choosing a structure viewer from combobox options. + * + * @param selectedItem + */ + protected void structureViewer_actionPerformed(String selectedItem) + { + } + + /** * Show a dialog for the user to choose a file. Returns the chosen path, or * null on Cancel. * diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index 09a6d8d..39be454 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -22,6 +22,7 @@ package jalview.ws.jws2; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentView; +import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; @@ -127,8 +128,10 @@ public class MsaWSClient extends Jws2Client return; } + startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset); + } public MsaWSClient() @@ -173,9 +176,55 @@ public class MsaWSClient extends Jws2Client WsURL, wsInfo, alignFrame, WebServiceName, jobtitle, msa, submitGaps, preserveOrder, seqdataset); wsInfo.setthisService(msathread); + msathread.start(); + } + private boolean isValidAlignment(AlignmentView av) + { + int validSeqCount = 0; + List seqs = av.getVisibleAlignment('c').getSequences(); // .getSequences(); + if (seqs.size() < 2) + { + JOptionPane + .showMessageDialog( + alignFrame, + "A minimum of two sequences is required to perform this operation", + "Invalid selection", JOptionPane.INFORMATION_MESSAGE); + + return false; + } + + for (SequenceI seq : seqs) + { + + if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){3}[a-zA-Z-]*")) + { + ++validSeqCount; + } + if (validSeqCount > 1) + { + return true; + } + } + + JOptionPane + .showMessageDialog( + alignFrame, + "All selected sequence for this job must have a minimum of \nthree non-gap character to perform this operation", + "Invalid selection", JOptionPane.INFORMATION_MESSAGE); + + return false; + } + + public static void main(String[] args) + { + System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*")); + } + + + protected String getServiceActionKey() { return "MsaWS"; @@ -250,9 +299,13 @@ public class MsaWSClient extends Jws2Client public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + + if (msa != null && isValidAlignment(msa)) + { new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps, true, alignFrame.getViewport().getAlignment() .getDataset(), alignFrame); + } } }); @@ -271,9 +324,13 @@ public class MsaWSClient extends Jws2Client public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + + if (msa != null && isValidAlignment(msa)) + { new MsaWSClient(service, null, null, true, alignFrame .getTitle(), msa, withGaps, true, alignFrame .getViewport().getAlignment().getDataset(), alignFrame); + } } }); @@ -324,9 +381,13 @@ public class MsaWSClient extends Jws2Client { AlignmentView msa = alignFrame .gatherSequencesForAlignment(); + + if (msa != null && isValidAlignment(msa)) + { new MsaWSClient(service, preset, alignFrame.getTitle(), msa, false, true, alignFrame.getViewport() .getAlignment().getDataset(), alignFrame); + } }
Action