parseResult takes the title as string. usually null
authoramwaterhouse <Andrew Waterhouse>
Wed, 8 Feb 2006 15:27:00 +0000 (15:27 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 8 Feb 2006 15:27:00 +0000 (15:27 +0000)
src/jalview/gui/SequenceFetcher.java

index 6d49d12..498489d 100755 (executable)
@@ -194,7 +194,7 @@ public class SequenceFetcher
         for (int i = 0; i < reply.length; i++)\r
           result.append(reply[i] + "\n");\r
 \r
-        parseResult(result.toString());\r
+        parseResult(result.toString(), null);\r
       }\r
     }\r
     else if (database.getSelectedItem().equals("PDB"))\r
@@ -210,7 +210,7 @@ public class SequenceFetcher
 \r
 \r
       if (result.length()>0)\r
-        parseResult(result.toString());\r
+        parseResult(result.toString(), null);\r
     }\r
     else if( database.getSelectedItem().equals("PFAM"))\r
     {\r
@@ -221,7 +221,7 @@ public class SequenceFetcher
            );\r
 \r
          if(result.length()>0)\r
-           parseResult( result.toString() );\r
+           parseResult( result.toString(), textfield.getText().toUpperCase() );\r
 \r
       }catch(java.io.IOException ex)\r
       {   result = null;    }\r
@@ -272,7 +272,7 @@ public class SequenceFetcher
       }\r
 \r
       //Then read in the features and apply them to the dataset\r
-      SequenceI[] sequence = parseResult(result.toString());\r
+      SequenceI[] sequence = parseResult(result.toString(), null);\r
       for (int i = 0; i < entries.size(); i++)\r
       {\r
         UniprotEntry entry = (UniprotEntry) entries.elementAt(i);\r
@@ -336,23 +336,28 @@ public class SequenceFetcher
     return result;\r
   }\r
 \r
-  SequenceI[] parseResult(String result)\r
+  SequenceI[] parseResult(String result, String title)\r
   {\r
     String format = IdentifyFile.Identify(result, "Paste");\r
     SequenceI[] sequences = null;\r
 \r
     if (FormatAdapter.formats.contains(format))\r
     {\r
-      sequences = new FormatAdapter().readFile(result.toString(), "Paste",\r
-                                               format);\r
+      sequences = null;\r
+      try{ sequences = new FormatAdapter().readFile(result.toString(), "Paste",\r
+                                               format);}\r
+      catch(Exception ex){}\r
+\r
       if (sequences != null && sequences.length > 0)\r
       {\r
         if (alignFrame == null)\r
         {\r
           AlignFrame af = new AlignFrame(new Alignment(sequences));\r
           af.currentFileFormat = format;\r
+          if(title==null)\r
+            title = "Retrieved from " + database.getSelectedItem();\r
           Desktop.addInternalFrame(af,\r
-                                   "Retrieved from " + database.getSelectedItem(),\r
+                                   title,\r
                                    AlignFrame.NEW_WINDOW_WIDTH,\r
                                    AlignFrame.NEW_WINDOW_HEIGHT);\r
           af.statusBar.setText("Successfully pasted alignment file");\r
@@ -370,7 +375,7 @@ public class SequenceFetcher
             alignFrame.viewport.alignment.addSequence(sequences[i]);\r
 \r
             ////////////////////////////\r
-            //Datset needs extension;\r
+            //Dataset needs extension;\r
             /////////////////////////////\r
             Sequence ds = new Sequence(sequences[i].getName(),\r
                                        AlignSeq.extractGaps("-. ",\r