JAL-878; Additional structures with a 'GR' tag in StockholmFiles are
authorjanengelhardt <engelhardt87@googlemail.com>
Fri, 22 Jul 2011 11:11:03 +0000 (13:11 +0200)
committerjanengelhardt <engelhardt87@googlemail.com>
Mon, 25 Jul 2011 12:59:28 +0000 (14:59 +0200)
associated their specific sequence.

Change-Id: I26913db05bef3983b63397304c97351f5361d61d

src/jalview/gui/SeqPanel.java
src/jalview/io/StockholmFile.java

index 6a03b53..a57c2e4 100644 (file)
@@ -1303,7 +1303,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     else
     // ///Editing a single sequence///////////
     {
-      if (insertGap && !editSeq)
+      if (insertGap)
       {
         // dragging to the right
         if (fixedColumns && fixedRight != -1)
@@ -1312,17 +1312,13 @@ public class SeqPanel extends JPanel implements MouseListener,
           {
             insertChar(j, new SequenceI[]
             { seq }, fixedRight);
-               System.out.println("InsertGap1");
-
           }
         }
         else
         {
           editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
           { seq }, lastres, startres - lastres, av.alignment, true);
-          System.out.println("InsertGap2 - lastres: "+lastres+" startres: "+startres);
-
-        }
+         }
       }
       else
       {
@@ -1368,14 +1364,11 @@ public class SeqPanel extends JPanel implements MouseListener,
                 insertChar(j, new SequenceI[]
                 { seq }, fixedRight);
               }
-               System.out.println("EditSeq1");
-
-            }
+              }
             else
             {
               editCommand.appendEdit(EditCommand.INSERT_NUC, new SequenceI[]
               { seq }, lastres, startres - lastres, av.alignment, true);
-               System.out.println("EditSeq2");
              }
        }
       }
index 2e0fea7..8f6a12f 100644 (file)
@@ -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