JAL-674 support preservation of any annotation created by the MCView PDB parser by...
authorJim Procter <j.procter@dundee.ac.uk>
Wed, 15 Oct 2014 09:12:10 +0000 (10:12 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Wed, 15 Oct 2014 09:12:10 +0000 (10:12 +0100)
src/MCview/PDBfile.java

index bb01faf..086c4d9 100755 (executable)
@@ -364,17 +364,24 @@ public class PDBfile extends jalview.io.AlignFile
           seqs.set(p, sq = matches.get(q));
           sq.setName(sp.getName());
           sq.setDescription(sp.getDescription());
-          sq.transferAnnotation(sp, aligns.get(q).getMappingFromS1(false));
+          Mapping sp2sq;
+          sq.transferAnnotation(sp, sp2sq = aligns.get(q).getMappingFromS1(false));
           int inspos = -1;
           for (int ap = 0; ap < annotations.size();)
           {
-            if (((AlignmentAnnotation) annotations.get(ap)).sequenceRef == sp)
+            if (annotations.get(ap).sequenceRef == sp)
             {
               if (inspos == -1)
               {
                 inspos = ap;
               }
-              annotations.remove(ap);
+              if (removeOldAnnots) {
+                annotations.remove(ap);
+              } else {
+                AlignmentAnnotation alan = annotations.get(ap);
+                alan.liftOver(sq, sp2sq);
+                alan.setSequenceRef(sq);
+              }
             }
             else
             {