Preliminary storeJalview
authoramwaterhouse <Andrew Waterhouse>
Tue, 8 Nov 2005 11:39:18 +0000 (11:39 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 8 Nov 2005 11:39:18 +0000 (11:39 +0000)
src/jalview/io/VamsasDatastore.java

index 69213af..efc13da 100755 (executable)
@@ -24,6 +24,8 @@ import org.vamsas.objects.core.*;
 import jalview.gui.*;\r
 import java.io.*;\r
 import java.util.jar.*;\r
+import org.exolab.castor.xml.*;\r
+import org.exolab.castor.mapping.Mapping;\r
 \r
 /*\r
 \r
@@ -50,6 +52,33 @@ public class VamsasDatastore
           storeVAMSAS(file);\r
         }\r
 \r
+        public void storeJalview(String file, AlignFrame af)\r
+        {\r
+          try\r
+          {\r
+            // 1. Load the mapping information from the file\r
+            Mapping map = new Mapping(getClass().getClassLoader());\r
+            java.net.URL url = getClass().getResource("/jalview_mapping.xml");\r
+            map.loadMapping(url);\r
+\r
+            // 2. Unmarshal the data\r
+            // Unmarshaller unmar = new Unmarshaller();\r
+            //unmar.setIgnoreExtraElements(true);\r
+            //unmar.setMapping(map);\r
+            // uni = (UniprotFile) unmar.unmarshal(new FileReader(file));\r
+\r
+            // 3. marshal the data with the total price back and print the XML in the console\r
+              Marshaller marshaller = new Marshaller( new FileWriter(file) );\r
+\r
+             marshaller.setMapping(map);\r
+             marshaller.marshal(af);\r
+          }\r
+          catch (Exception e)\r
+          {\r
+            e.printStackTrace();\r
+          }\r
+        }\r
+\r
 \r
 \r
         public VAMSAS storeVAMSAS(String file)\r