From: Jim Procter Date: Tue, 8 May 2018 09:57:35 +0000 (+0100) Subject: Merge branch 'patch/JAL-2321_addsecstrForDroppedPDBFile' into releases/Release_2_10_4... X-Git-Tag: Release_2_10_4~7 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7dd97604d9087217ad6937a5b860ffb401c53094;hp=2bef55651d4b9d94148f75e3a697ec63823b218a;p=jalview.git Merge branch 'patch/JAL-2321_addsecstrForDroppedPDBFile' into releases/Release_2_10_4_Branch --- diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index dc3d0ee..2a510a2 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -28,7 +28,6 @@ import jalview.io.DataSourceType; import jalview.io.FileParse; import jalview.io.StructureFile; import jalview.schemes.ResidueProperties; -import jalview.structure.StructureImportSettings; import jalview.util.Format; import jalview.util.MessageManager; @@ -60,6 +59,12 @@ public class JmolParser extends StructureFile implements JmolStatusListener { Viewer viewer = null; + public JmolParser(boolean immediate, String inFile, + DataSourceType sourceType) throws IOException + { + super(immediate, inFile, sourceType); + } + public JmolParser(String inFile, DataSourceType sourceType) throws IOException { @@ -183,7 +188,11 @@ public class JmolParser extends StructureFile implements JmolStatusListener } lastID = tmpatom.resNumIns.trim(); } - xferSettings(); + if (isParseImmediately()) + { + // configure parsing settings from the static singleton + xferSettings(); + } makeResidueList(); makeCaBondList(); @@ -200,7 +209,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener prot.add(chainseq); } - if (StructureImportSettings.isProcessSecondaryStructure()) + // look at local setting for adding secondary tructure + if (predictSecondaryStructure) { createAnnotation(chainseq, chain, ms.at); } diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 2340283..497f0a5 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -72,7 +72,20 @@ public abstract class AlignFile extends FileParse long end; - private boolean parseCalled; + /** + * true if parse() has been called + */ + private boolean parseCalled = false; + + private boolean parseImmediately = true; + + /** + * @return if doParse() was called at construction time + */ + protected boolean isParseImmediately() + { + return parseImmediately; + } /** * Creates a new AlignFile object. @@ -153,6 +166,11 @@ public abstract class AlignFile extends FileParse { super(source); initData(); + + // stash flag in case parse needs to know if it has to autoconfigure or was + // configured after construction + this.parseImmediately = parseImmediately; + if (parseImmediately) { doParse(); diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index ad259fd..cd986c0 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -398,8 +398,11 @@ public class StructureSelectionManager { // FIXME if sourceType is not null, we've lost data here sourceType = AppletFormatAdapter.checkProtocol(pdbFile); - pdb = new JmolParser(pdbFile, sourceType); - + pdb = new JmolParser(false, pdbFile, sourceType); + pdb.addSettings(parseSecStr && processSecondaryStructure, + parseSecStr && addTempFacAnnot, + parseSecStr && secStructServices); + pdb.doParse(); if (pdb.getId() != null && pdb.getId().trim().length() > 0 && DataSourceType.FILE == sourceType) { diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java index 85aea40..4bee3f5 100644 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@ -260,6 +260,8 @@ public class Mapping @Test(groups = { "Functional" }) public void compareTransferredToRefPDBAnnot() throws Exception { + StructureImportSettings.setProcessSecondaryStructure(true); + StructureImportSettings.setVisibleChainAnnotation(true); StructureImportSettings.setShowSeqFeatures(true); AlignFrame ref = new FileLoader(false) .LoadFileWaitTillLoaded("test/jalview/ext/jmol/1QCF.pdb",