From d28fba781c93c83b6082e74b22a8bf52d241d609 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Fri, 22 Jul 2016 17:13:53 +0100 Subject: [PATCH] JAL-2148 Bugfix in structureImportSettings string-to-enum conversion and further enhancement to deal with Atoms from multi-model entries --- src/MCview/Atom.java | 17 +++++++++++++++++ src/jalview/ext/jmol/JmolParser.java | 9 ++++++++- src/jalview/structure/StructureImportSettings.java | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index 68a7c21..ab038a0 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -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; diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index 7056f0f..baebe08 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -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 chainTerMap) { + // System.out.println("Atom: " + curAtom.getAtomNumber() + // + " Last atom index " + curAtom.group.lastAtomIndex); if (chainTerMap == null || prevAtom == null) { return true; diff --git a/src/jalview/structure/StructureImportSettings.java b/src/jalview/structure/StructureImportSettings.java index e969d4b..3d41a83 100644 --- a/src/jalview/structure/StructureImportSettings.java +++ b/src/jalview/structure/StructureImportSettings.java @@ -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()); } } -- 1.7.10.2