Merge branch 'patchJAL-674_offset' into develop
authorJim Procter <jprocter@dundee.ac.uk>
Thu, 27 Nov 2014 16:02:07 +0000 (16:02 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Thu, 27 Nov 2014 16:02:07 +0000 (16:02 +0000)
src/jalview/analysis/AlignmentUtils.java
src/jalview/ext/jmol/PDBFileWithJmol.java
src/jalview/gui/Jalview2XML.java

index 929a855..6385fa7 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.analysis;
 
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
 
@@ -121,6 +122,16 @@ public class AlignmentUtils
     }
     AlignmentI newAl = new jalview.datamodel.Alignment(
             sq.toArray(new SequenceI[0]));
+    for (SequenceI s : sq)
+    {
+      if (s.getAnnotation() != null)
+      {
+        for (AlignmentAnnotation aa : s.getAnnotation())
+        {
+          newAl.addAnnotation(aa);
+        }
+      }
+    }
     newAl.setDataset(core.getDataset());
     return newAl;
   }
index f5710d3..92dce36 100644 (file)
@@ -188,7 +188,10 @@ public class PDBFileWithJmol extends AlignFile implements
                   {
                     String mt = model.getModelTitle() == null ? getDataName()
                             : model.getModelTitle();
-                    mt += _lastChainId;
+                    if (_lastChainId >= ' ')
+                    {
+                      mt += _lastChainId;
+                    }
                     AlignmentAnnotation ann = new AlignmentAnnotation(
                             "Secondary Structure",
                             "Secondary Structure for " + mt, asecstr);
index 158ae50..08fd306 100644 (file)
@@ -498,7 +498,7 @@ public class Jalview2XML
     for (String dssids : dsses.keySet())
     {
       AlignFrame _af = dsses.get(dssids);
-      String jfileName = MessageManager.formatMessage("label.dataset_for", new String[]{fileName,_af.getTitle()});
+      String jfileName = fileName + " Dataset for " + _af.getTitle();
       if (!jfileName.endsWith(".xml"))
       {
         jfileName = jfileName + ".xml";
@@ -1456,8 +1456,7 @@ public class Jalview2XML
           }
 
           ae.setPosition(a);
-          if (aa[i].annotations[a].secondaryStructure != ' '
-                  && aa[i].annotations[a].secondaryStructure != '\0')
+          if (aa[i].annotations[a].secondaryStructure > ' ')
           {
             ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure
                     + "");
@@ -2314,7 +2313,10 @@ public class Jalview2XML
     }
     else
     {
-      recoverDatasetFor(vamsasSet, al);
+      // recover dataset - passing on flag indicating if this a 'viewless'
+      // sequence set (a.k.a. a stored dataset for the project)
+      recoverDatasetFor(vamsasSet, al, object.getJalviewModelSequence()
+              .getViewportCount() == 0);
     }
     // ///////////////////////////////
 
@@ -3986,7 +3988,8 @@ public class Jalview2XML
     }
   }
 
-  private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al)
+  private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al,
+          boolean ignoreUnrefed)
   {
     jalview.datamodel.Alignment ds = getDatasetFor(vamsasSet.getDatasetId());
     Vector dseqs = null;
@@ -3998,7 +4001,7 @@ public class Jalview2XML
     for (int i = 0, iSize = vamsasSet.getSequenceCount(); i < iSize; i++)
     {
       Sequence vamsasSeq = vamsasSet.getSequence(i);
-      ensureJalviewDatasetSequence(vamsasSeq, ds, dseqs);
+      ensureJalviewDatasetSequence(vamsasSeq, ds, dseqs, ignoreUnrefed);
     }
     // create a new dataset
     if (ds == null)
@@ -4027,7 +4030,7 @@ public class Jalview2XML
    *          vector to add new dataset sequence to
    */
   private void ensureJalviewDatasetSequence(Sequence vamsasSeq,
-          AlignmentI ds, Vector dseqs)
+          AlignmentI ds, Vector dseqs, boolean ignoreUnrefed)
   {
     // JBP TODO: Check this is called for AlCodonFrames to support recovery of
     // xRef Codon Maps
@@ -4038,7 +4041,10 @@ public class Jalview2XML
     {
       dsq = sq.getDatasetSequence();
     }
-
+    if (sq == null && ignoreUnrefed)
+    {
+      return;
+    }
     String sqid = vamsasSeq.getDsseqid();
     if (dsq == null)
     {