JAL-2148 Bugfix in structureImportSettings string-to-enum conversion and further...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 22 Jul 2016 16:13:53 +0000 (17:13 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 22 Jul 2016 16:13:53 +0000 (17:13 +0100)
src/MCview/Atom.java
src/jalview/ext/jmol/JmolParser.java
src/jalview/structure/StructureImportSettings.java

index 68a7c21..ab038a0 100755 (executable)
@@ -109,6 +109,23 @@ public class Atom
     }
   }
 
+  @Override
+  public boolean equals(Object that)
+  {
+    if (this == that || that == null)
+    {
+      return true;
+    }
+    if (that instanceof Atom)
+    {
+      Atom other = (Atom) that;
+      return other.resName.equals(this.resName)
+              && other.resNumber == this.resNumber
+              && other.resNumIns.equals(this.resNumIns)
+              && other.chain.equals(this.chain);
+    }
+    return false;
+  }
   public Atom(float x, float y, float z)
   {
     this.x = x;
index 7056f0f..baebe08 100644 (file)
@@ -219,7 +219,12 @@ public class JmolParser extends StructureFile implements JmolStatusListener
         curAtom.resNumIns = "" + curAtom.resNumber + curAtom.insCode;
         curAtom.tfactor = atom.getBfactor100() / 100f;
         curAtom.type = 0;
-        significantAtoms.add(curAtom);
+        // significantAtoms.add(curAtom);
+        // ignore atoms from subsequent models
+        if (!significantAtoms.contains(curAtom))
+        {
+          significantAtoms.add(curAtom);
+        }
         prevAtom = atom;
       }
     }
@@ -230,6 +235,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener
           org.jmol.modelset.Atom prevAtom,
           HashMap<String, org.jmol.modelset.Atom> chainTerMap)
   {
+    // System.out.println("Atom: " + curAtom.getAtomNumber()
+    // + "   Last atom index " + curAtom.group.lastAtomIndex);
     if (chainTerMap == null || prevAtom == null)
     {
       return true;
index e969d4b..3d41a83 100644 (file)
@@ -109,7 +109,7 @@ public class StructureImportSettings
           String defaultStructureFileFormat)
   {
     StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
-            .valueOf(defaultStructureFileFormat);
+            .valueOf(defaultStructureFileFormat.toUpperCase());
   }
 
   public static String getDefaultPDBFileParser()
@@ -126,7 +126,7 @@ public class StructureImportSettings
   public static void setDefaultPDBFileParser(String defaultPDBFileParser)
   {
     StructureImportSettings.defaultPDBFileParser = StructureParser
-            .valueOf(defaultPDBFileParser);
+            .valueOf(defaultPDBFileParser.toUpperCase());
   }
 
 }