From: jprocter Date: Wed, 22 Sep 2010 09:59:51 +0000 (+0000) Subject: Fix and documentation for JAL-657 X-Git-Tag: Release_2_6~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=152aa52bc19a393141cfc19f5852d1fbcd239f16;p=jalview.git Fix and documentation for JAL-657 --- diff --git a/help/html/features/seqfetch.html b/help/html/features/seqfetch.html index d8415c7..c4d671a 100755 --- a/help/html/features/seqfetch.html +++ b/help/html/features/seqfetch.html @@ -16,36 +16,59 @@ * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . --> -Sequence Fetcher + +Sequence Fetcher +

Sequence Fetcher

-

Jalview can retrieve sequences from certain databases using either the -WSDBFetch service provided by the European Bioinformatics Institute, and, since Jalview 2.4, DAS servers capable of the sequence command (configured in DAS settings).

-The Jalview Sequence Fetcher Dialog Box -

The Sequence Fetcher dialog box can be opened via the "File" - menu on the main desktop in order to retrieve sequences as a new - alignment, or opened via the "File" menu of an existing alignment - to import additional sequences. Please note, there will be a short delay when the sequence fetcher is first opened, - whilst Jalview compiles the list of available sequence datasources from the - currently defined DAS server registry. +

Jalview can retrieve sequences from certain databases using +either the WSDBFetch service provided by the European Bioinformatics +Institute, and, since Jalview 2.4, DAS servers capable of the sequence +command (configured in DAS settings).

+The Jalview Sequence Fetcher Dialog Box +

The Sequence Fetcher dialog box can be opened via the +"File" menu on the main desktop in order to retrieve sequences +as a new alignment, or opened via the "File" menu of an +existing alignment to import additional sequences. Please note, there +will be a short delay when the sequence fetcher is first opened, whilst +Jalview compiles the list of available sequence datasources from the +currently defined DAS server registry.

+

First, select the database you want to retrieve sequences from. +Then, enter one or more accession ids (as a semi-colon separated list), +or press the "Example" button to paste the example accession +for the currently selected database into the retrieval box. Finally, +press "OK" to initiate the retrieval.

+

Fetching Individual PDB Chains
+If you are retrieving sequences from the PDB, you can retrieve specific +chains by appending a colon and the chain id to the PDB id. For example +:
+

 1GAQ:A
+
+When retrieving from DAS sequence sources, coordinate range arguments +can be passed to the server using the standard DAS sequence command +format ( +:<start>,<end> +) +

+

Retrieving parts of large sequence records
+Some sequence sources allow a range query to be appended to the sequence +ID - e.g. 'Mito:1,85779'. If you know a source understands this type of +query format, then you should untick the checkbox for 'replace commas +with semi-colons' so the range query can be passed to the server +(otherwise the query will be split up into two 'Mito:1' and '85779'). In +some cases, a source that supports range queries usually include a range +qualification in its example query. In this case, Jalview will +automatically disable the 'replace commas with semi-colons' option.
+Support for range queries was added in Jalview 2.6

+

If you use the WSDBFetch sequence fetcher services (EMBL, +Uniprot, PDB and PFAM) in work for publication, please cite:

+

Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., +Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez +R.
+SOAP-based services provided by the European Bioinformatics Institute.
+Nucleic Acids Res. 33(1):W25-W28 (2005)
+

-

First, select the database you want to retrieve sequences from. Then, enter - one or more accession ids (as a semi-colon separated list), or press the - "Example" button to paste the example accession for the currently selected database into the retrieval box. - Finally, press "OK" to initiate the retrieval.

-

- If you are retrieving sequences from the PDB, you can retrieve - specific chains by appending a colon and the chain id to the PDB - id. For example :

 1GAQ:A

When retrieving from DAS sequence sources, - coordinate range arguments can be passed to the server using the standard DAS - sequence command format (:<start>,<end>)

-

If you use the WSDBFetch sequence fetcher services (EMBL, Uniprot, PDB and PFAM) - in work for publication, please cite:

-

Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar - S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R.
- SOAP-based services provided by the European Bioinformatics Institute.
- Nucleic Acids Res. 33(1):W25-W28 (2005)
-
-

diff --git a/help/html/features/seqfetcher.gif b/help/html/features/seqfetcher.gif index 809d719..652976f 100644 Binary files a/help/html/features/seqfetcher.gif and b/help/html/features/seqfetcher.gif differ diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index c5a9235..af8c108 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -57,8 +57,11 @@ public class SequenceFetcher extends JPanel implements Runnable private static jalview.ws.SequenceFetcher sfetch = null; private static String dasRegistry = null; - private static boolean _initingFetcher=false; - private static Thread initingThread=null; + + private static boolean _initingFetcher = false; + + private static Thread initingThread = null; + /** * Blocking method that initialises and returns the shared instance of the * SequenceFetcher client @@ -70,29 +73,39 @@ public class SequenceFetcher extends JPanel implements Runnable public static jalview.ws.SequenceFetcher getSequenceFetcherSingleton( final IProgressIndicator guiWindow) { - if (_initingFetcher && initingThread!=null && initingThread.isAlive()) + if (_initingFetcher && initingThread != null && initingThread.isAlive()) { if (guiWindow != null) { - guiWindow.setProgressBar("Waiting for Sequence Database Fetchers to initialise", + guiWindow.setProgressBar( + "Waiting for Sequence Database Fetchers to initialise", Thread.currentThread().hashCode()); } - // initting happening on another thread - so wait around to see if it finishes. - while (_initingFetcher && initingThread!=null && initingThread.isAlive()) + // initting happening on another thread - so wait around to see if it + // finishes. + while (_initingFetcher && initingThread != null + && initingThread.isAlive()) { - try {Thread.sleep(10);} catch (Exception e){}; + try + { + Thread.sleep(10); + } catch (Exception e) + { + } + ; } if (guiWindow != null) { - guiWindow.setProgressBar("Waiting for Sequence Database Fetchers to initialise", + guiWindow.setProgressBar( + "Waiting for Sequence Database Fetchers to initialise", Thread.currentThread().hashCode()); } } if (sfetch == null || dasRegistry != DasSourceBrowser.getDasRegistryURL()) { - _initingFetcher=true; - initingThread=Thread.currentThread(); + _initingFetcher = true; + initingThread = Thread.currentThread(); /** * give a visual indication that sequence fetcher construction is occuring */ @@ -109,8 +122,8 @@ public class SequenceFetcher extends JPanel implements Runnable initingThread.hashCode()); } sfetch = sf; - _initingFetcher=false; - initingThread=null; + _initingFetcher = false; + initingThread = null; } return sfetch; } @@ -198,11 +211,11 @@ public class SequenceFetcher extends JPanel implements Runnable frame.setContentPane(this); if (new jalview.util.Platform().isAMac()) { - Desktop.addInternalFrame(frame, getFrameTitle(), 400, 180); + Desktop.addInternalFrame(frame, getFrameTitle(), 400, 240); } else { - Desktop.addInternalFrame(frame, getFrameTitle(), 400, 140); + Desktop.addInternalFrame(frame, getFrameTitle(), 400, 180); } } @@ -220,8 +233,12 @@ public class SequenceFetcher extends JPanel implements Runnable dbeg.setFont(new java.awt.Font("Verdana", Font.BOLD, 11)); jLabel1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); - jLabel1 - .setText("Separate multiple accession ids with semi colon \";\""); + jLabel1.setText("Separate multiple accession ids with semi colon \";\""); + + replacePunctuation.setHorizontalAlignment(SwingConstants.CENTER); + replacePunctuation + .setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); + replacePunctuation.setText("Replace commas with semi-colons"); ok.setText("OK"); ok.addActionListener(new ActionListener() { @@ -284,10 +301,13 @@ public class SequenceFetcher extends JPanel implements Runnable { db = sfetch.getSourceProxy((String) sources.get(database .getSelectedItem())); - dbeg.setText("Example query: " + db.getTestQuery()); + String eq = db.getTestQuery(); + dbeg.setText("Example query: " + eq); + replacePunctuation.setEnabled(!(eq != null && eq.indexOf(",") > -1)); } catch (Exception ex) { dbeg.setText(""); + replacePunctuation.setEnabled(true); } jPanel2.repaint(); } @@ -295,7 +315,10 @@ public class SequenceFetcher extends JPanel implements Runnable dbeg.setText(""); jPanel2.add(database, java.awt.BorderLayout.NORTH); jPanel2.add(dbeg, java.awt.BorderLayout.CENTER); - jPanel2.add(jLabel1, java.awt.BorderLayout.SOUTH); + JPanel jPanel2a = new JPanel(new BorderLayout()); + jPanel2a.add(jLabel1, java.awt.BorderLayout.NORTH); + jPanel2a.add(replacePunctuation, java.awt.BorderLayout.SOUTH); + jPanel2.add(jPanel2a, java.awt.BorderLayout.SOUTH); // jPanel2.setPreferredSize(new Dimension()) jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER); this.add(jPanel1, java.awt.BorderLayout.SOUTH); @@ -331,6 +354,8 @@ public class SequenceFetcher extends JPanel implements Runnable JLabel jLabel1 = new JLabel(); + JCheckBox replacePunctuation = new JCheckBox(); + JButton ok = new JButton(); JButton clear = new JButton(); @@ -393,9 +418,19 @@ public class SequenceFetcher extends JPanel implements Runnable { error += "Please select the source database\n"; } - // TODO: make this transformation optional and configurable - com.stevesoft.pat.Regex empty = new com.stevesoft.pat.Regex( - "(\\s|[,; ])+", ";"); // \\s+", ""); + // TODO: make this transformation more configurable + com.stevesoft.pat.Regex empty; + if (replacePunctuation.isEnabled() && replacePunctuation.isSelected()) + { + empty = new com.stevesoft.pat.Regex( + // replace commas and spaces with a semicolon + "(\\s|[,; ])+", ";"); + } + else + { + // just turn spaces and semicolons into single semicolons + empty = new com.stevesoft.pat.Regex("(\\s|[; ])+", ";"); + } textArea.setText(empty.replaceAll(textArea.getText())); // see if there's anthing to search with if (!new com.stevesoft.pat.Regex("[A-Za-z0-9_.]").search(textArea @@ -414,9 +449,9 @@ public class SequenceFetcher extends JPanel implements Runnable Enumeration en = new StringTokenizer(textArea.getText(), ";"); try { - guiWindow.setProgressBar("Fetching Sequences from " - + database.getSelectedItem(), Thread.currentThread() - .hashCode()); + guiWindow.setProgressBar( + "Fetching Sequences from " + database.getSelectedItem(), + Thread.currentThread().hashCode()); DbSourceProxy proxy = sfetch.getSourceProxy((String) sources .get(source)); if (proxy.getAccessionSeparator() == null) @@ -445,10 +480,8 @@ public class SequenceFetcher extends JPanel implements Runnable indres = proxy.getSequenceRecords(item); } catch (OutOfMemoryError oome) { - new OOMWarning( - "fetching " + item + " from " - + database.getSelectedItem(),oome, - this); + new OOMWarning("fetching " + item + " from " + + database.getSelectedItem(), oome, this); } if (indres != null) { @@ -484,13 +517,10 @@ public class SequenceFetcher extends JPanel implements Runnable aresult = proxy.getSequenceRecords(multiacc.toString()); } catch (OutOfMemoryError oome) { - new OOMWarning( - "fetching " + multiacc + " from " - + database.getSelectedItem(),oome, - this); + new OOMWarning("fetching " + multiacc + " from " + + database.getSelectedItem(), oome, this); } - - + } } catch (Exception e)