Add getAlignment function
authoramwaterhouse <Andrew Waterhouse>
Mon, 14 Nov 2005 18:35:52 +0000 (18:35 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 14 Nov 2005 18:35:52 +0000 (18:35 +0000)
src/jalview/bin/JalviewLite.java

index 8f48385..4e4f943 100755 (executable)
@@ -45,6 +45,8 @@ public class JalviewLite extends Applet
     Button launcher = new Button("Start Jalview");\r
     public static boolean AWT1 = false;\r
 \r
+    AlignFrame currentAlignFrame;\r
+\r
 \r
     /**\r
      * init method for Jalview Applet\r
@@ -162,6 +164,29 @@ public class JalviewLite extends Applet
         frame.setVisible(true);\r
     }\r
 \r
+    public String getAlignment(String format)\r
+    {\r
+      return getAlignment(format, "true");\r
+    }\r
+\r
+    public String getAlignment(String format, String suffix)\r
+    {\r
+      try\r
+      {\r
+        boolean seqlimits = suffix.equalsIgnoreCase("true");\r
+\r
+        String reply = new AppletFormatAdapter().formatSequences(format,\r
+            currentAlignFrame.viewport.getAlignment().getSequences(),\r
+            true, seqlimits);\r
+        return reply;\r
+      }\r
+      catch (Exception ex)\r
+      {ex.printStackTrace();\r
+        return "Error retrieving alignment in " + format + " format. ";\r
+\r
+      }\r
+    }\r
+\r
     /**\r
      * This paints the background surrounding the "Launch Jalview button"\r
      * <br>\r
@@ -210,12 +235,12 @@ public class JalviewLite extends Applet
 \r
             if ((sequences != null) && (sequences.length > 0))\r
             {\r
-                AlignFrame af = new AlignFrame(new Alignment(sequences),\r
+                currentAlignFrame = new AlignFrame(new Alignment(sequences),\r
                         applet, file);\r
-                af.statusBar.setText("Successfully loaded file " + file);\r
+                currentAlignFrame.statusBar.setText("Successfully loaded file " + file);\r
 \r
                 if(featuresFile!=null)\r
-                  af.parseFeaturesFile(featuresFile);\r
+                  currentAlignFrame.parseFeaturesFile(featuresFile);\r
             }\r
             else\r
             {\r