Make sure annots are alignment width
[jalview.git] / src / jalview / gui / Jalview2XML.java
index b90f497..198db44 100755 (executable)
@@ -209,6 +209,19 @@ public class Jalview2XML
 
     vamsasSet.setGapChar(jal.getGapCharacter() + "");
 
+    if(jal.getProperties()!=null)
+    {
+      Enumeration en = jal.getProperties().keys();
+      while(en.hasMoreElements())
+      {
+        String key = en.nextElement().toString();
+        SequenceSetProperties ssp = new SequenceSetProperties();
+        ssp.setKey(key);
+        ssp.setValue(jal.getProperties().get(key).toString());
+        vamsasSet.addSequenceSetProperties(ssp);
+      }
+    }
+
     JSeq jseq;
 
     //SAVE SEQUENCES
@@ -534,7 +547,7 @@ public class Jalview2XML
         }
 
         an.setLabel(aa[i].label);
-        if (!Float.isNaN(aa[i].score))
+        if (aa[i].hasScore())
         {
           an.setScore(aa[i].getScore());
         }
@@ -1207,6 +1220,13 @@ public class Jalview2XML
     jalview.datamodel.Alignment al =
         new jalview.datamodel.Alignment(orderedSeqs);
 
+    for(int i=0; i<vamsasSet.getSequenceSetPropertiesCount(); i++ )
+    {
+      SequenceSetProperties ssp = vamsasSet.getSequenceSetProperties(i);
+      al.setProperty(ssp.getKey(), ssp.getValue());
+    }
+
+
     al.setDataset(null);
     /////////////////////////////////
 
@@ -1338,12 +1358,11 @@ public class Jalview2XML
 
           for (int aa = 0; aa < ae.length && aa < anot.length; aa++)
           {
-
             anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(
 
                     ae[aa].getDisplayCharacter(),
                     ae[aa].getDescription(),
-                    ae[aa].getSecondaryStructure()==null ? ' ' :
+                    (ae[aa].getSecondaryStructure()==null || ae[aa].getSecondaryStructure().length() == 0) ? ' ' :
                       ae[aa].getSecondaryStructure().charAt(0),
                       ae[aa].getValue()
 
@@ -1896,7 +1915,7 @@ public class Jalview2XML
               else if(comp!=null)
               {
                 StructureSelectionManager.getStructureSelectionManager()
-                    .setMapping(seq, pdbFile,
+                    .setMapping(seq, null, pdbFile,
                                 jalview.io.AppletFormatAdapter.FILE);
 
                 ( (AppJMol) comp).addSequence(seq);