From ce6f02a53c98e51cb96533d40db5f94d1bfea00a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 16 Sep 2016 10:31:11 +0100 Subject: [PATCH] JAL-2164 removed unused parameters from JmolParser constructor --- src/jalview/ext/jmol/JmolParser.java | 6 ++---- src/jalview/io/AppletFormatAdapter.java | 22 +++++--------------- src/jalview/io/StructureFile.java | 9 ++++---- .../structure/StructureSelectionManager.java | 4 ++-- test/MCview/PDBfileTest.java | 18 ++++++++++++++++ test/jalview/ext/jmol/JmolParserTest.java | 20 +++++------------- .../jmol/JmolVsJalviewPDBParserEndToEndTest.java | 3 +-- 7 files changed, 37 insertions(+), 45 deletions(-) diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index ddb4492..cef552f 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -61,15 +61,13 @@ public class JmolParser extends StructureFile implements JmolStatusListener { Viewer viewer = null; - public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr, - boolean externalSecStr, String inFile, String type) + public JmolParser(String inFile, String type) throws IOException { super(inFile, type); } - public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr, - boolean externalSecStr, FileParse fp) throws IOException + public JmolParser(FileParse fp) throws IOException { super(fp); } diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index da7eb1d..552f00e 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -27,6 +27,7 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; import jalview.datamodel.PDBEntry.Type; +import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; import jalview.util.MessageManager; @@ -277,22 +278,11 @@ public class AppletFormatAdapter alignFile = new JPredFile(inFile, type); ((JPredFile) alignFile).removeNonSequences(); } - else if (format.equals("PDB")) - { - - StructureImportSettings.addSettings(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct); - alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct, inFile, - type); - ((StructureFile) alignFile).setDbRefType(format); - } - else if (format.equalsIgnoreCase("mmCIF")) + else if (format.equals("PDB") || format.equalsIgnoreCase("mmCIF")) { StructureImportSettings.addSettings(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct); - alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct, inFile, type); + alignFile = new JmolParser(inFile, type); ((StructureFile) alignFile).setDbRefType(format); } else if (format.equals("STH")) @@ -426,8 +416,7 @@ public class AppletFormatAdapter { StructureImportSettings.addSettings(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct); - alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct, source); + alignFile = new JmolParser(source); } else { @@ -441,8 +430,7 @@ public class AppletFormatAdapter { StructureImportSettings.addSettings(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct); - alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct, source); + alignFile = new JmolParser(source); ((StructureFile) alignFile).setDbRefType(Type.MMCIF); } else if (format.equals("STH")) diff --git a/src/jalview/io/StructureFile.java b/src/jalview/io/StructureFile.java index 4a6a1c2..0bc6a73 100644 --- a/src/jalview/io/StructureFile.java +++ b/src/jalview/io/StructureFile.java @@ -285,11 +285,10 @@ public abstract class StructureFile extends AlignFile Class cl = Class.forName("jalview.ext.jmol.JmolParser"); if (cl != null) { - final Constructor constructor = cl.getConstructor(new Class[] { - boolean.class, boolean.class, boolean.class, FileParse.class }); - final Object[] args = new Object[] { visibleChainAnnotation, - predictSecondaryStructure, externalSecondaryStructure, - new FileParse(getDataName(), type) }; + final Constructor constructor = cl + .getConstructor(new Class[] { FileParse.class }); + final Object[] args = new Object[] { new FileParse(getDataName(), + type) }; StructureImportSettings.setShowSeqFeatures(false); StructureImportSettings.setVisibleChainAnnotation(false); diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 7db85ff..7b103be 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -32,6 +32,7 @@ import jalview.datamodel.Annotation; import jalview.datamodel.PDBEntry; import jalview.datamodel.SearchResults; import jalview.datamodel.SequenceI; +import jalview.ext.jmol.JmolParser; import jalview.gui.IProgressIndicator; import jalview.io.AppletFormatAdapter; import jalview.io.StructureFile; @@ -384,8 +385,7 @@ public class StructureSelectionManager boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts(); try { - pdb = new jalview.ext.jmol.JmolParser(addTempFacAnnot, parseSecStr, - secStructServices, pdbFile, protocol); + pdb = new JmolParser(pdbFile, protocol); if (pdb.getId() != null && pdb.getId().trim().length() > 0 && AppletFormatAdapter.FILE.equals(protocol)) diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index a6a1de4..8e2e2fe 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -26,6 +26,7 @@ import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; +import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -33,10 +34,12 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.io.AppletFormatAdapter; +import jalview.structure.StructureImportSettings; import java.io.IOException; import java.util.List; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PDBfileTest @@ -307,4 +310,19 @@ public class PDBfileTest pf.addAnnotations(al); return al.getAlignmentAnnotation(); } + + //@formatter:on + + @BeforeMethod(alwaysRun = true) + public void setUp() + { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_TEMPFACT_ANN", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); + StructureImportSettings.setDefaultStructureFileFormat("PDB"); + } } diff --git a/test/jalview/ext/jmol/JmolParserTest.java b/test/jalview/ext/jmol/JmolParserTest.java index 43b23a2..8788609 100644 --- a/test/jalview/ext/jmol/JmolParserTest.java +++ b/test/jalview/ext/jmol/JmolParserTest.java @@ -114,8 +114,7 @@ public class JmolParserTest { PDBfile mctest = new PDBfile(false, false, false, pdbStr, AppletFormatAdapter.FILE); - JmolParser jtest = new JmolParser(false, false, false, pdbStr, - jalview.io.AppletFormatAdapter.FILE); + JmolParser jtest = new JmolParser(pdbStr, AppletFormatAdapter.FILE); Vector seqs = jtest.getSeqs(), mcseqs = mctest.getSeqs(); assertTrue( @@ -182,13 +181,8 @@ public class JmolParserTest PDBfile mctest = new PDBfile(false, false, false, pastePDBDataWithChainBreak, AppletFormatAdapter.PASTE); - boolean annotFromStructure = false; - boolean localSecondaryStruct = false; - boolean serviceSecondaryStruct = false; - JmolParser jtest = new JmolParser(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct, - pastePDBDataWithChainBreak, - jalview.io.AppletFormatAdapter.PASTE); + JmolParser jtest = new JmolParser(pastePDBDataWithChainBreak, + AppletFormatAdapter.PASTE); Vector seqs = jtest.getSeqs(); Vector mcseqs = mctest.getSeqs(); @@ -210,12 +204,8 @@ public class JmolParserTest { PDBfile mctest = new PDBfile(false, false, false, pdbWithAltLoc, AppletFormatAdapter.PASTE); - boolean annotFromStructure = false; - boolean localSecondaryStruct = false; - boolean serviceSecondaryStruct = false; - JmolParser jtest = new JmolParser(annotFromStructure, - localSecondaryStruct, serviceSecondaryStruct, pdbWithAltLoc, - jalview.io.AppletFormatAdapter.PASTE); + JmolParser jtest = new JmolParser(pdbWithAltLoc, + AppletFormatAdapter.PASTE); Vector seqs = jtest.getSeqs(); Vector mcseqs = mctest.getSeqs(); diff --git a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java index 8a89830..c984b3a 100644 --- a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java +++ b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java @@ -53,8 +53,7 @@ public class JmolVsJalviewPDBParserEndToEndTest { mctest = new PDBfile(false, false, false, testFile, AppletFormatAdapter.FILE); - jtest = new JmolParser(false, false, false, testFile, - jalview.io.AppletFormatAdapter.FILE); + jtest = new JmolParser(testFile, AppletFormatAdapter.FILE); } catch (IOException e) { System.err.println("Exception thrown while parsing : " + pdbStr); -- 1.7.10.2