JAL-1803 recover type field faithfully for mmCIF/PDB file type info
[jalview.git] / src / jalview / gui / Jalview2XML.java
index 56b7255..86f8146 100644 (file)
@@ -2824,7 +2824,7 @@ public class Jalview2XML
         } else {
           incompleteSeqs.remove(seqId);
         }
-        if (vamsasSeq[vi].getId().equals(seqId))
+        if (vamsasSeq.length > vi && vamsasSeq[vi].getId().equals(seqId))
         {
           // most likely we are reading a dataset XML document so
           // update from vamsasSeq section of XML for this sequence
@@ -2982,9 +2982,9 @@ public class Jalview2XML
             entry.setId(ids[p].getId());
             if (ids[p].getType() != null)
             {
-              if (ids[p].getType().equalsIgnoreCase("PDB"))
+              if (PDBEntry.Type.getType(ids[p].getType()) != null)
               {
-                entry.setType(PDBEntry.Type.PDB);
+                entry.setType(PDBEntry.Type.getType(ids[p].getType()));
               }
               else
               {
@@ -3002,6 +3002,17 @@ public class Jalview2XML
                 entry.setFile(pdbloaded.get(ids[p].getId()).toString());
               }
             }
+            if (ids[p].getPdbentryItem() != null)
+            {
+              entry.setProperty(new Hashtable());
+              for (PdbentryItem item : ids[p].getPdbentryItem())
+              {
+                for (Property pr : item.getProperty())
+                {
+                  entry.getProperty().put(pr.getName(), pr.getValue());
+                }
+              }
+            }
             StructureSelectionManager.getStructureSelectionManager(
                     Desktop.instance).registerPDBEntry(entry);
             // adds PDBEntry to datasequence's set (since Jalview 2.10)