fixed after refactoring of SequenceFeature[] seq.getSequenceFeatures
authorjprocter <Jim Procter>
Wed, 1 Mar 2006 16:23:15 +0000 (16:23 +0000)
committerjprocter <Jim Procter>
Wed, 1 Mar 2006 16:23:15 +0000 (16:23 +0000)
src/jalview/analysis/SeqsetUtils.java

index 61f10b5..691b905 100755 (executable)
@@ -49,7 +49,13 @@ public class SeqsetUtils
     sqinfo.put("Name", seq.getName());\r
     sqinfo.put("Start", new Integer(seq.getStart()));\r
     sqinfo.put("End", new Integer(seq.getEnd()));\r
-    sqinfo.put("SeqFeatures", (seq.getSequenceFeatures() !=null) ? seq.getSequenceFeatures() : null);\r
+    Vector sfeat = new Vector();\r
+    jalview.datamodel.SequenceFeature[] sfarray=seq.getSequenceFeatures();\r
+    if (sfarray!=null && sfarray.length>0) {\r
+      for (int i=0;i<sfarray.length;i++)\r
+        sfeat.add(sfarray[i]);\r
+    }\r
+    sqinfo.put("SeqFeatures", sfeat);\r
     sqinfo.put("PdbId",\r
                (seq.getPDBId() != null) ? seq.getPDBId() : new Vector());\r
     sqinfo.put("datasetSequence", (seq.getDatasetSequence() !=null) ? seq.getDatasetSequence() : new Sequence("THISISAPLACEHOLDER",""));\r
@@ -61,7 +67,7 @@ public class SeqsetUtils
    * TODO: replace these methods with something more elegant.\r
    * @param sq SequenceI\r
    * @param sqinfo Hashtable\r
-   * @return boolean\r
+   * @return boolean true if name was not updated from sqinfo Name entry\r
    */\r
   public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo)\r
   {\r
@@ -71,7 +77,7 @@ public class SeqsetUtils
     String oldname = (String) sqinfo.get("Name");\r
     Integer start = (Integer) sqinfo.get("Start");\r
     Integer end = (Integer) sqinfo.get("End");\r
-    SequenceFeature [] sfeatures = (SequenceFeature[]) sqinfo.get(\r
+    Vector sfeatures = (Vector) sqinfo.get(\r
         "SeqFeatures");\r
     Vector pdbid = (Vector) sqinfo.get("PdbId");\r
     Sequence seqds = (Sequence) sqinfo.get("datasetSequence");\r
@@ -94,10 +100,12 @@ public class SeqsetUtils
       sq.setEnd(end.intValue());\r
     }\r
 \r
-    if ((sfeatures != null) && (sfeatures.length>0))\r
+    if ((sfeatures != null) && (sfeatures.size()>0))\r
     {\r
-      sq.setSequenceFeatures(sfeatures);\r
+      SequenceFeature[] sfarray = (SequenceFeature[]) sfeatures.toArray();\r
+      sq.setSequenceFeatures(sfarray);\r
     }\r
+\r
     if ((seqds!=null) && !(seqds.getName().equals("THISISAPLACEHOLDER") && seqds.getLength()==0)) {\r
       sq.setDatasetSequence(seqds);\r
     }\r