Retrieves PFAM alignments
authoramwaterhouse <Andrew Waterhouse>
Fri, 3 Feb 2006 17:44:33 +0000 (17:44 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 3 Feb 2006 17:44:33 +0000 (17:44 +0000)
src/jalview/gui/SequenceFetcher.java

index 0884d44..6d49d12 100755 (executable)
@@ -44,6 +44,7 @@ public class SequenceFetcher
     database.addItem("EMBL");\r
     database.addItem("EMBLCDS");\r
     database.addItem("PDB");\r
+    database.addItem("PFAM");\r
 \r
     try\r
     {\r
@@ -64,8 +65,7 @@ public class SequenceFetcher
 \r
   private String getFrameTitle()\r
   {\r
-    return ( (alignFrame == null) ? "New " : "Additional ") +\r
-        "Sequence Fetcher (WSDBfetch@EBI)";\r
+    return ( (alignFrame == null) ? "New " : "Additional ") + "Sequence Fetcher";\r
   }\r
 \r
   private void jbInit()\r
@@ -142,7 +142,6 @@ public class SequenceFetcher
 \r
   public void ok_actionPerformed(ActionEvent e)\r
   {\r
-    frame.setTitle("Sequence Fetcher (WSDBfetch@EBI) - Fetching Sequence...");\r
     database.setEnabled(false);\r
     textfield.setEnabled(false);\r
     ok.setEnabled(false);\r
@@ -158,7 +157,6 @@ public class SequenceFetcher
     textfield.setEnabled(true);\r
     ok.setEnabled(true);\r
     close.setEnabled(true);\r
-    frame.setTitle(getFrameTitle());\r
   }\r
 \r
   public void run()\r
@@ -214,13 +212,27 @@ public class SequenceFetcher
       if (result.length()>0)\r
         parseResult(result.toString());\r
     }\r
+    else if( database.getSelectedItem().equals("PFAM"))\r
+    {\r
+      try{\r
+        result.append(new FastaFile(\r
+           "http://www.sanger.ac.uk/cgi-bin/Pfam/getalignment.pl?format=fal&acc="\r
+           +  textfield.getText().toUpperCase(), "URL").print()\r
+           );\r
+\r
+         if(result.length()>0)\r
+           parseResult( result.toString() );\r
+\r
+      }catch(java.io.IOException ex)\r
+      {   result = null;    }\r
+    }\r
 \r
     if (result == null || result.length() == 0)\r
       showErrorMessage("Error retrieving " + textfield.getText()\r
                        + " from " + database.getSelectedItem());\r
-    else\r
-      textfield.setText("");\r
+\r
     resetDialog();\r
+    return;\r
   }\r
 \r
   void getUniprotFile(String id)\r
@@ -433,9 +445,11 @@ public class SequenceFetcher
 \r
   void showErrorMessage(String error)\r
   {\r
+    resetDialog();\r
     JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
                                           error, "Error Retrieving Data",\r
                                           JOptionPane.WARNING_MESSAGE);\r
+    return;\r
   }\r
 }\r
 \r