public void run()\r
{\r
StringBuffer result = new StringBuffer();\r
- if (database.getSelectedItem().equals("Uniprot")\r
- || database.getSelectedItem().equals("EMBL")\r
- || database.getSelectedItem().equals("EMBLCDS"))\r
- {\r
- EBIFetchClient dbFetch = new EBIFetchClient();\r
- String[] reply = dbFetch.fetchData(\r
- database.getSelectedItem().toString().toLowerCase(\r
- ) + ":" + textfield.getText(),\r
- "fasta", "raw");\r
-\r
- for (int i = 0; i < reply.length; i++)\r
- result.append(reply[i]+"\n");\r
- }\r
- else if (database.getSelectedItem().equals("PDB"))\r
- {\r
- EBIFetchClient ebi = new EBIFetchClient();\r
- String[] reply = ebi.fetchData("pdb:" + textfield.getText(), "pdb",\r
- "raw");\r
- PDBfile pdbfile = new PDBfile(reply);\r
- for (int i = 0; i < pdbfile.chains.size(); i++)\r
+ if (database.getSelectedItem().equals("Uniprot")\r
+ || database.getSelectedItem().equals("EMBL")\r
+ || database.getSelectedItem().equals("EMBLCDS"))\r
{\r
- result.append("\n>" +\r
- ( (PDBChain) pdbfile.chains.elementAt(i)).sequence.getName() +\r
- "\n"\r
- +\r
- ( (PDBChain) pdbfile.chains.elementAt(i)).sequence.\r
- getSequence());\r
+ EBIFetchClient dbFetch = new EBIFetchClient();\r
+ String[] reply = dbFetch.fetchData(\r
+ database.getSelectedItem().toString().toLowerCase(\r
+ ) + ":" + textfield.getText(),\r
+ "fasta", "raw");\r
+\r
+ for (int i = 0; i < reply.length; i++)\r
+ result.append(reply[i] + "\n");\r
+ }\r
+ else if (database.getSelectedItem().equals("PDB"))\r
+ {\r
+ EBIFetchClient ebi = new EBIFetchClient();\r
+ String[] reply = ebi.fetchData("pdb:" + textfield.getText(), "pdb",\r
+ "raw");\r
+ try{\r
+ PDBfile pdbfile = new PDBfile(reply);\r
+ for (int i = 0; i < pdbfile.chains.size(); i++)\r
+ {\r
+ result.append("\n>" +\r
+ ( (PDBChain) pdbfile.chains.elementAt(i)).sequence.\r
+ getName() +\r
+ "\n"\r
+ +\r
+ ( (PDBChain) pdbfile.chains.elementAt(i)).sequence.\r
+ getSequence());\r
+ }\r
+ }catch(Exception ex)// Problem parsing PDB file\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Error retrieving "+textfield.getText()+" from "+database.getSelectedItem(),\r
+ "Error Retrieving Data", JOptionPane.WARNING_MESSAGE);\r
+ }\r
}\r
- }\r
\r
if (result.length() > 0)\r
{\r
if (FormatAdapter.formats.contains(format))\r
{\r
sequences = new FormatAdapter().readFile(result.toString(), "Paste", format);\r
- if (sequences != null)\r
+ if (sequences != null && sequences.length>0)\r
{\r
if(alignFrame==null)\r
{\r
}\r
\r
}\r
+ else\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Error retrieving "+textfield.getText()+" from "+database.getSelectedItem(),\r
+ "Error Retrieving Data", JOptionPane.WARNING_MESSAGE);\r
+\r
}\r
}\r
\r