merge from 2_4_Release branch
[jalview.git] / src / jalview / gui / SequenceFetcher.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.gui;
20
21 import java.io.*;
22 import java.util.*;
23
24 import java.awt.*;
25 import java.awt.event.*;
26
27 import javax.swing.*;
28
29 import MCview.*;
30 import jalview.datamodel.*;
31 import jalview.datamodel.xdb.embl.*;
32 import java.io.File;
33 import jalview.io.*;
34 import jalview.ws.DBRefFetcher;
35 import jalview.ws.ebi.EBIFetchClient;
36 import jalview.ws.seqfetcher.ASequenceFetcher;
37 import jalview.ws.seqfetcher.DbSourceProxy;
38
39 import java.awt.Rectangle;
40 import java.awt.BorderLayout;
41 import java.awt.Dimension;
42
43 public class SequenceFetcher extends JPanel implements Runnable
44 {
45   // ASequenceFetcher sfetch;
46   JInternalFrame frame;
47
48   IProgressIndicator guiWindow;
49
50   AlignFrame alignFrame;
51
52   StringBuffer result;
53
54   final String noDbSelected = "-- Select Database --";
55
56   Hashtable sources = new Hashtable();
57
58   private static jalview.ws.SequenceFetcher sfetch = null;
59
60   private static String dasRegistry = null;
61
62   /**
63    * Blocking method that initialises and returns the shared instance of the
64    * SequenceFetcher client
65    * 
66    * @param guiWindow -
67    *                where the initialisation delay message should be shown
68    * @return the singleton instance of the sequence fetcher client
69    */
70   public static jalview.ws.SequenceFetcher getSequenceFetcherSingleton(
71           final IProgressIndicator guiWindow)
72   {
73     if (sfetch == null
74             || dasRegistry != DasSourceBrowser.getDasRegistryURL())
75     {
76       /**
77        * give a visual indication that sequence fetcher construction is occuring
78        */
79       if (guiWindow != null)
80       {
81         guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
82                 Thread.currentThread().hashCode());
83       }
84       dasRegistry = DasSourceBrowser.getDasRegistryURL();
85       jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
86       if (guiWindow != null)
87       {
88         guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
89                 Thread.currentThread().hashCode());
90       }
91       sfetch = sf;
92
93     }
94     return sfetch;
95   }
96
97   public SequenceFetcher(IProgressIndicator guiIndic)
98   {
99     final IProgressIndicator guiWindow = guiIndic;
100     final SequenceFetcher us = this;
101     // launch initialiser thread
102     Thread sf = new Thread(new Runnable()
103     {
104
105       public void run()
106       {
107         if (getSequenceFetcherSingleton(guiWindow) != null)
108         {
109           us.initGui(guiWindow);
110         }
111         else
112         {
113           javax.swing.SwingUtilities.invokeLater(new Runnable()
114           {
115             public void run()
116             {
117               JOptionPane
118                       .showInternalMessageDialog(
119                               Desktop.desktop,
120                               "Could not create the sequence fetcher client. Check error logs for details.",
121                               "Couldn't create SequenceFetcher",
122                               JOptionPane.ERROR_MESSAGE);
123             }
124           });
125
126           // raise warning dialog
127         }
128       }
129     });
130     sf.start();
131   }
132
133   /**
134    * called by thread spawned by constructor
135    * 
136    * @param guiWindow
137    */
138   private void initGui(IProgressIndicator guiWindow)
139   {
140     this.guiWindow = guiWindow;
141     if (guiWindow instanceof AlignFrame)
142     {
143       alignFrame = (AlignFrame) guiWindow;
144     }
145
146     database.addItem(noDbSelected);
147     /*
148      * Dynamically generated database list will need a translation function from
149      * internal source to externally distinct names. UNIPROT and UP_NAME are
150      * identical DB sources, and should be collapsed.
151      */
152
153     String dbs[] = sfetch.getOrderedSupportedSources();
154     for (int i = 0; i < dbs.length; i++)
155     {
156       if (!sources.containsValue(dbs[i]))
157       {
158         String name = sfetch.getSourceProxy(dbs[i]).getDbName();
159         // duplicate source names are thrown away, here.
160         if (!sources.containsKey(name))
161         {
162           database.addItem(name);
163         }
164         // overwrite with latest version of the retriever for this source
165         sources.put(name, dbs[i]);
166       }
167     }
168     try
169     {
170       jbInit();
171     } catch (Exception ex)
172     {
173       ex.printStackTrace();
174     }
175
176     frame = new JInternalFrame();
177     frame.setContentPane(this);
178     if (new jalview.util.Platform().isAMac())
179     {
180       Desktop.addInternalFrame(frame, getFrameTitle(), 400, 180);
181     }
182     else
183     {
184       Desktop.addInternalFrame(frame, getFrameTitle(), 400, 140);
185     }
186   }
187
188   private String getFrameTitle()
189   {
190     return ((alignFrame == null) ? "New " : "Additional ")
191             + "Sequence Fetcher";
192   }
193
194   private void jbInit() throws Exception
195   {
196     this.setLayout(borderLayout2);
197
198     database.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
199     dbeg.setFont(new java.awt.Font("Verdana", Font.BOLD, 11));
200     jLabel1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
201     jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
202     jLabel1
203             .setText("Separate multiple accession ids with semi colon \";\"");
204     ok.setText("OK");
205     ok.addActionListener(new ActionListener()
206     {
207       public void actionPerformed(ActionEvent e)
208       {
209         ok_actionPerformed();
210       }
211     });
212     clear.setText("Clear");
213     clear.addActionListener(new ActionListener()
214     {
215       public void actionPerformed(ActionEvent e)
216       {
217         clear_actionPerformed();
218       }
219     });
220
221     example.setText("Example");
222     example.addActionListener(new ActionListener()
223     {
224       public void actionPerformed(ActionEvent e)
225       {
226         example_actionPerformed();
227       }
228     });
229     close.setText("Close");
230     close.addActionListener(new ActionListener()
231     {
232       public void actionPerformed(ActionEvent e)
233       {
234         close_actionPerformed(e);
235       }
236     });
237     textArea.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
238     textArea.setLineWrap(true);
239     textArea.addKeyListener(new KeyAdapter()
240     {
241       public void keyPressed(KeyEvent e)
242       {
243         if (e.getKeyCode() == KeyEvent.VK_ENTER)
244           ok_actionPerformed();
245       }
246     });
247     jPanel3.setLayout(borderLayout1);
248     borderLayout1.setVgap(5);
249     jPanel1.add(ok);
250     jPanel1.add(example);
251     jPanel1.add(clear);
252     jPanel1.add(close);
253     jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER);
254     jPanel2.setLayout(borderLayout3);
255
256     database.addActionListener(new ActionListener()
257     {
258
259       public void actionPerformed(ActionEvent e)
260       {
261         DbSourceProxy db = null;
262         try
263         {
264           db = sfetch.getSourceProxy((String) sources.get(database
265                   .getSelectedItem()));
266           dbeg.setText("Example query: " + db.getTestQuery());
267         } catch (Exception ex)
268         {
269           dbeg.setText("");
270         }
271         jPanel2.repaint();
272       }
273     });
274     dbeg.setText("");
275     jPanel2.add(database, java.awt.BorderLayout.NORTH);
276     jPanel2.add(dbeg, java.awt.BorderLayout.CENTER);
277     jPanel2.add(jLabel1, java.awt.BorderLayout.SOUTH);
278     // jPanel2.setPreferredSize(new Dimension())
279     jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER);
280     this.add(jPanel1, java.awt.BorderLayout.SOUTH);
281     this.add(jPanel3, java.awt.BorderLayout.CENTER);
282     this.add(jPanel2, java.awt.BorderLayout.NORTH);
283     jScrollPane1.getViewport().add(textArea);
284
285   }
286
287   protected void example_actionPerformed()
288   {
289     DbSourceProxy db = null;
290     try
291     {
292       db = sfetch.getSourceProxy((String) sources.get(database
293               .getSelectedItem()));
294       textArea.setText(db.getTestQuery());
295     } catch (Exception ex)
296     {
297     }
298     jPanel3.repaint();
299   }
300
301   protected void clear_actionPerformed()
302   {
303     textArea.setText("");
304     jPanel3.repaint();
305   }
306
307   JLabel dbeg = new JLabel();
308
309   JComboBox database = new JComboBox();
310
311   JLabel jLabel1 = new JLabel();
312
313   JButton ok = new JButton();
314
315   JButton clear = new JButton();
316
317   JButton example = new JButton();
318
319   JButton close = new JButton();
320
321   JPanel jPanel1 = new JPanel();
322
323   JTextArea textArea = new JTextArea();
324
325   JScrollPane jScrollPane1 = new JScrollPane();
326
327   JPanel jPanel2 = new JPanel();
328
329   JPanel jPanel3 = new JPanel();
330
331   JPanel jPanel4 = new JPanel();
332
333   BorderLayout borderLayout1 = new BorderLayout();
334
335   BorderLayout borderLayout2 = new BorderLayout();
336
337   BorderLayout borderLayout3 = new BorderLayout();
338
339   public void close_actionPerformed(ActionEvent e)
340   {
341     try
342     {
343       frame.setClosed(true);
344     } catch (Exception ex)
345     {
346     }
347   }
348
349   public void ok_actionPerformed()
350   {
351     database.setEnabled(false);
352     textArea.setEnabled(false);
353     ok.setEnabled(false);
354     close.setEnabled(false);
355
356     Thread worker = new Thread(this);
357     worker.start();
358   }
359
360   private void resetDialog()
361   {
362     database.setEnabled(true);
363     textArea.setEnabled(true);
364     ok.setEnabled(true);
365     close.setEnabled(true);
366   }
367
368   public void run()
369   {
370     String error = "";
371     if (database.getSelectedItem().equals(noDbSelected))
372     {
373       error += "Please select the source database\n";
374     }
375     com.stevesoft.pat.Regex empty = new com.stevesoft.pat.Regex("\\s+", "");
376     textArea.setText(empty.replaceAll(textArea.getText()));
377     if (textArea.getText().length() == 0)
378     {
379       error += "Please enter a (semi-colon separated list of) database id(s)";
380     }
381     if (error.length() > 0)
382     {
383       showErrorMessage(error);
384       resetDialog();
385       return;
386     }
387     AlignmentI aresult = null;
388     try
389     {
390       guiWindow.setProgressBar("Fetching Sequences from "
391               + database.getSelectedItem(), Thread.currentThread()
392               .hashCode());
393       aresult = sfetch.getSourceProxy(
394               (String) sources.get(database.getSelectedItem()))
395               .getSequenceRecords(textArea.getText());
396
397     } catch (Exception e)
398     {
399       showErrorMessage("Error retrieving " + textArea.getText() + " from "
400               + database.getSelectedItem());
401       // error +="Couldn't retrieve sequences from "+database.getSelectedItem();
402       System.err.println("Retrieval failed for source ='"
403               + database.getSelectedItem() + "' and query\n'"
404               + textArea.getText() + "'\n");
405       e.printStackTrace();
406     } catch (OutOfMemoryError e)
407     {
408       // resets dialog box - so we don't use OOMwarning here.
409       showErrorMessage("Out of Memory when retrieving "
410               + textArea.getText()
411               + " from "
412               + database.getSelectedItem()
413               + "\nPlease see the Jalview FAQ for instructions for increasing the memory available to Jalview.\n");
414       e.printStackTrace();
415     } catch (Error e)
416     {
417       showErrorMessage("Serious Error retrieving " + textArea.getText()
418               + " from " + database.getSelectedItem());
419       e.printStackTrace();
420     }
421     if (aresult != null)
422     {
423       parseResult(aresult, null, null);
424     }
425     // only remove visual delay after we finished parsing.
426     guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
427     resetDialog();
428   }
429
430   /*
431    * result = new StringBuffer(); if
432    * (database.getSelectedItem().equals("Uniprot")) {
433    * getUniprotFile(textArea.getText()); } else if
434    * (database.getSelectedItem().equals("EMBL") ||
435    * database.getSelectedItem().equals("EMBLCDS")) { String DBRefSource =
436    * database.getSelectedItem().equals("EMBLCDS") ?
437    * jalview.datamodel.DBRefSource.EMBLCDS : jalview.datamodel.DBRefSource.EMBL;
438    * 
439    * StringTokenizer st = new StringTokenizer(textArea.getText(), ";");
440    * SequenceI[] seqs = null; while(st.hasMoreTokens()) { EBIFetchClient dbFetch =
441    * new EBIFetchClient(); String qry =
442    * database.getSelectedItem().toString().toLowerCase( ) + ":" +
443    * st.nextToken(); File reply = dbFetch.fetchDataAsFile( qry, "emblxml",null);
444    * 
445    * jalview.datamodel.xdb.embl.EmblFile efile=null; if (reply != null &&
446    * reply.exists()) { efile =
447    * jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply); } if (efile!=null) {
448    * for (Iterator i=efile.getEntries().iterator(); i.hasNext(); ) { EmblEntry
449    * entry = (EmblEntry) i.next(); SequenceI[] seqparts =
450    * entry.getSequences(false,true, DBRefSource); if (seqparts!=null) {
451    * SequenceI[] newseqs = null; int si=0; if (seqs==null) { newseqs = new
452    * SequenceI[seqparts.length]; } else { newseqs = new
453    * SequenceI[seqs.length+seqparts.length];
454    * 
455    * for (;si<seqs.length; si++) { newseqs[si] = seqs[si]; seqs[si] = null; } }
456    * for (int j=0;j<seqparts.length; si++, j++) { newseqs[si] =
457    * seqparts[j].deriveSequence(); // place DBReferences on dataset and refer }
458    * seqs=newseqs; } } } else { result.append("# no response for "+qry); } } if
459    * (seqs!=null && seqs.length>0) { if (parseResult(new Alignment(seqs), null,
460    * null)!=null) { result.append("# Successfully parsed the
461    * "+database.getSelectedItem()+" Queries into an Alignment"); } } } else if
462    * (database.getSelectedItem().equals("PDB")) { StringTokenizer qset = new
463    * StringTokenizer(textArea.getText(), ";"); String query; SequenceI[] seqs =
464    * null; while (qset.hasMoreTokens() && ((query = qset.nextToken())!=null)) {
465    * SequenceI[] seqparts = getPDBFile(query.toUpperCase()); if (seqparts !=
466    * null) { if (seqs == null) { seqs = seqparts; } else { SequenceI[] newseqs =
467    * new SequenceI[seqs.length+seqparts.length]; int i=0; for (; i <
468    * seqs.length; i++) { newseqs[i] = seqs[i]; seqs[i] = null; } for (int j=0;j<seqparts.length;
469    * i++, j++) { newseqs[i] = seqparts[j]; } seqs=newseqs; } result.append("#
470    * Success for "+query.toUpperCase()+"\n"); } } if (seqs != null &&
471    * seqs.length > 0) { if (parseResult(new Alignment(seqs), null, null)!=null) {
472    * result.append( "# Successfully parsed the PDB File Queries into an
473    * Alignment"); } } } else if( database.getSelectedItem().equals("PFAM")) {
474    * try { result.append(new FastaFile(
475    * "http://www.sanger.ac.uk/cgi-bin/Pfam/getalignment.pl?format=fal&acc=" +
476    * textArea.getText().toUpperCase(), "URL").print() );
477    * 
478    * if(result.length()>0) { parseResult( result.toString(),
479    * textArea.getText().toUpperCase() ); } } catch (java.io.IOException ex) {
480    * result = null; } }
481    * 
482    * if (result == null || result.length() == 0) { showErrorMessage("Error
483    * retrieving " + textArea.getText() + " from " + database.getSelectedItem()); }
484    * 
485    * resetDialog(); return; }
486    * 
487    * void getUniprotFile(String id) { EBIFetchClient ebi = new EBIFetchClient();
488    * File file = ebi.fetchDataAsFile("uniprot:" + id, "xml", null);
489    * 
490    * DBRefFetcher dbref = new DBRefFetcher(); Vector entries =
491    * dbref.getUniprotEntries(file);
492    * 
493    * if (entries != null) { //First, make the new sequences Enumeration en =
494    * entries.elements(); while (en.hasMoreElements()) { UniprotEntry entry =
495    * (UniprotEntry) en.nextElement();
496    * 
497    * StringBuffer name = new StringBuffer(">UniProt/Swiss-Prot"); Enumeration
498    * en2 = entry.getAccession().elements(); while (en2.hasMoreElements()) {
499    * name.append("|"); name.append(en2.nextElement()); } en2 =
500    * entry.getName().elements(); while (en2.hasMoreElements()) {
501    * name.append("|"); name.append(en2.nextElement()); }
502    * 
503    * if (entry.getProtein() != null) { name.append(" " +
504    * entry.getProtein().getName().elementAt(0)); }
505    * 
506    * result.append(name + "\n" + entry.getUniprotSequence().getContent() +
507    * "\n"); }
508    * 
509    * //Then read in the features and apply them to the dataset Alignment al =
510    * parseResult(result.toString(), null); for (int i = 0; i < entries.size();
511    * i++) { UniprotEntry entry = (UniprotEntry) entries.elementAt(i);
512    * Enumeration e = entry.getDbReference().elements(); Vector onlyPdbEntries =
513    * new Vector(); while (e.hasMoreElements()) { PDBEntry pdb = (PDBEntry)
514    * e.nextElement(); if (!pdb.getType().equals("PDB")) { continue; }
515    * 
516    * onlyPdbEntries.addElement(pdb); }
517    * 
518    * Enumeration en2 = entry.getAccession().elements(); while
519    * (en2.hasMoreElements()) {
520    * al.getSequenceAt(i).getDatasetSequence().addDBRef(new DBRefEntry(
521    * DBRefSource.UNIPROT, "0", en2.nextElement().toString())); }
522    * 
523    * 
524    * 
525    * 
526    * al.getSequenceAt(i).getDatasetSequence().setPDBId(onlyPdbEntries); if
527    * (entry.getFeature() != null) { e = entry.getFeature().elements(); while
528    * (e.hasMoreElements()) { SequenceFeature sf = (SequenceFeature)
529    * e.nextElement(); sf.setFeatureGroup("Uniprot");
530    * al.getSequenceAt(i).getDatasetSequence().addSequenceFeature( sf ); } } } } }
531    * 
532    * SequenceI[] getPDBFile(String id) { Vector result = new Vector(); String
533    * chain = null; if (id.indexOf(":") > -1) { chain =
534    * id.substring(id.indexOf(":") + 1); id = id.substring(0, id.indexOf(":")); }
535    * 
536    * EBIFetchClient ebi = new EBIFetchClient(); String file =
537    * ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw"). getAbsolutePath(); if (file ==
538    * null) { return null; } try { PDBfile pdbfile = new PDBfile(file,
539    * jalview.io.AppletFormatAdapter.FILE); for (int i = 0; i <
540    * pdbfile.chains.size(); i++) { if (chain == null || ( (PDBChain)
541    * pdbfile.chains.elementAt(i)).id. toUpperCase().equals(chain)) { PDBChain
542    * pdbchain = (PDBChain) pdbfile.chains.elementAt(i); // Get the Chain's
543    * Sequence - who's dataset includes any special features added from the PDB
544    * file SequenceI sq = pdbchain.sequence; // Specially formatted name for the
545    * PDB chain sequences retrieved from the PDB
546    * sq.setName("PDB|"+id+"|"+sq.getName()); // Might need to add more metadata
547    * to the PDBEntry object // like below /* PDBEntry entry = new PDBEntry(); //
548    * Construct the PDBEntry entry.setId(id); if (entry.getProperty() == null)
549    * entry.setProperty(new Hashtable()); entry.getProperty().put("chains",
550    * pdbchain.id + "=" + sq.getStart() + "-" + sq.getEnd());
551    * sq.getDatasetSequence().addPDBId(entry); // Add PDB DB Refs // We make a
552    * DBRefEtntry because we have obtained the PDB file from a verifiable source //
553    * JBPNote - PDB DBRefEntry should also carry the chain and mapping
554    * information DBRefEntry dbentry = new
555    * DBRefEntry(jalview.datamodel.DBRefSource.PDB, "0", id + pdbchain.id);
556    * sq.addDBRef(dbentry); // and add seuqence to the retrieved set
557    * result.addElement(sq.deriveSequence()); } }
558    * 
559    * if (result.size() < 1) { throw new Exception("WsDBFetch for PDB id resulted
560    * in zero result size"); } } catch (Exception ex) // Problem parsing PDB file {
561    * jalview.bin.Cache.log.warn("Exception when retrieving " +
562    * textArea.getText() + " from " + database.getSelectedItem(), ex); return
563    * null; }
564    * 
565    * 
566    * SequenceI[] results = new SequenceI[result.size()]; for (int i = 0, j =
567    * result.size(); i < j; i++) { results[i] = (SequenceI) result.elementAt(i);
568    * result.setElementAt(null,i); } return results; }
569    */
570   AlignmentI parseResult(String result, String title)
571   {
572     String format = new IdentifyFile().Identify(result, "Paste");
573     Alignment sequences = null;
574     if (FormatAdapter.isValidFormat(format))
575     {
576       sequences = null;
577       try
578       {
579         sequences = new FormatAdapter().readFile(result.toString(),
580                 "Paste", format);
581       } catch (Exception ex)
582       {
583       }
584
585       if (sequences != null)
586       {
587         return parseResult(sequences, title, format);
588       }
589     }
590     else
591     {
592       showErrorMessage("Error retrieving " + textArea.getText() + " from "
593               + database.getSelectedItem());
594     }
595
596     return null;
597   }
598
599   AlignmentI parseResult(AlignmentI al, String title,
600           String currentFileFormat)
601   {
602
603     if (al != null && al.getHeight() > 0)
604     {
605       if (alignFrame == null)
606       {
607         AlignFrame af = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
608                 AlignFrame.DEFAULT_HEIGHT);
609         if (currentFileFormat != null)
610         {
611           af.currentFileFormat = currentFileFormat; // WHAT IS THE DEFAULT
612           // FORMAT FOR
613           // NON-FormatAdapter Sourced
614           // Alignments?
615         }
616
617         if (title == null)
618         {
619           title = "Retrieved from " + database.getSelectedItem();
620         }
621
622         Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
623                 AlignFrame.DEFAULT_HEIGHT);
624
625         af.statusBar.setText("Successfully pasted alignment file");
626
627         try
628         {
629           af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN",
630                   false));
631         } catch (Exception ex)
632         {
633         }
634       }
635       else
636       {
637         for (int i = 0; i < al.getHeight(); i++)
638         {
639           alignFrame.viewport.alignment.addSequence(al.getSequenceAt(i)); // this
640           // also
641           // creates
642           // dataset
643           // sequence
644           // entries
645         }
646         alignFrame.viewport.setEndSeq(alignFrame.viewport.alignment
647                 .getHeight());
648         alignFrame.viewport.alignment.getWidth();
649         alignFrame.viewport.firePropertyChange("alignment", null,
650                 alignFrame.viewport.getAlignment().getSequences());
651       }
652     }
653     return al;
654   }
655
656   void showErrorMessage(final String error)
657   {
658     resetDialog();
659     javax.swing.SwingUtilities.invokeLater(new Runnable()
660     {
661       public void run()
662       {
663         JOptionPane.showInternalMessageDialog(Desktop.desktop, error,
664                 "Error Retrieving Data", JOptionPane.WARNING_MESSAGE);
665       }
666     });
667   }
668 }