update author list in license for (JAL-826)
[jalview.git] / src / jalview / io / StockholmFile.java
index 2e0fea7..3a7a739 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -149,12 +149,16 @@ public class StockholmFile extends AlignFile
           int start = 1;\r
           int end = -1;\r
           String sid = acc;\r
-          // Retrieve hash of annotations for this accession\r
+          /*\r
+           * Retrieve hash of annotations for this accession\r
+           * Associate Annotation with accession\r
+           */\r
           Hashtable accAnnotations = null;\r
 \r
           if (seqAnn != null && seqAnn.containsKey(acc))\r
           {\r
             accAnnotations = (Hashtable) seqAnn.remove(acc);\r
+            //TODO: add structures to sequence\r
           }\r
 \r
           // Split accession in id and from/to\r
@@ -184,7 +188,19 @@ public class StockholmFile extends AlignFile
               jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);\r
               // seqO.addDBRef(dbref);\r
             }\r
+          }        \r
+          if (accAnnotations != null && accAnnotations.containsKey("SS"))\r
+          {\r
+                 Vector v = (Vector) accAnnotations.get("SS");\r
+                 \r
+                 for (int i = 0; i < v.size(); i++)\r
+                   {\r
+                         AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);\r
+                         seqO.addAlignmentAnnotation(an);\r
+                         //annotations.add(an);\r
+                   }\r
           }\r
+        \r
           Hashtable features = null;\r
           // We need to adjust the positions of all features to account for gaps\r
           try\r
@@ -426,7 +442,7 @@ public class StockholmFile extends AlignFile
               ann = new Hashtable();\r
               seqAnn.put(acc, ann);\r
             }\r
-\r
+            //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence\r
             Hashtable features;\r
             // Get an object with all the content for an annotation\r
             if (ann.containsKey("features"))\r
@@ -461,6 +477,24 @@ public class StockholmFile extends AlignFile
             }\r
             ns += seq;\r
             content.put(description, ns);\r
+
+            if(type.equals("SS")){\r
+                Hashtable strucAnn;\r
+                if (seqAnn.containsKey(acc))\r
+                {\r
+                  strucAnn = (Hashtable) seqAnn.get(acc);\r
+                }\r
+                else\r
+                {\r
+                  strucAnn = new Hashtable();\r
+                }\r
+                \r
+                Vector newStruc=new Vector();\r
+                parseAnnotationRow(newStruc, type,ns);\r
+                \r
+                strucAnn.put(type, newStruc);\r
+                seqAnn.put(acc, strucAnn);\r
+             }\r
           }\r
           else\r
           {\r
@@ -566,6 +600,7 @@ public class StockholmFile extends AlignFile
               annot.annotations.length);\r
       System.arraycopy(els, 0, anns, annot.annotations.length, els.length);\r
       annot.annotations = anns;\r
+      //System.out.println("else: ");\r
     }\r
     return annot;\r
   }\r