From: tcofoegbu Date: Thu, 30 Jun 2016 09:46:51 +0000 (+0100) Subject: JAL-1919 updated PDBSequenceFetcherTest and JMol parser config settings to enable... X-Git-Tag: Release_2_10_0~148 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=834ebffc22ed9e72b139cadf5652d1a7006da9b3 JAL-1919 updated PDBSequenceFetcherTest and JMol parser config settings to enable proper processing of mmCIF files --- diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 3b84ee3..073772a 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -357,18 +357,6 @@ public class PDBChain else { - // boolean baseDetected = false; - // for (Atom resAtom : resAtoms) - // { - // if (resAtom.insCode == ' ') - // { - // baseDetected = true; - // } - // } - // if (!baseDetected) - // { - // continue; - // } // Make a new Residue object with the new atoms vector residues.addElement(new Residue(resAtoms, resNumber - 1, count)); @@ -378,7 +366,6 @@ public class PDBChain SequenceFeature sf = new SequenceFeature("RESNUM", tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset + count, offset + count, pdbid); - // MCview.PDBChain.PDBFILEFEATURE); resFeatures.addElement(sf); resAnnotation.addElement(new Annotation(tmpat.tfactor)); // Keep totting up the sequence diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 38aa55f..dde67de 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -21,7 +21,7 @@ package jalview.bin; import jalview.datamodel.DBRefSource; -import jalview.ws.dbsources.Pdb; +import jalview.structure.StructureViewSettings; import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.dbsources.das.datamodel.DasSourceRegistry; import jalview.ws.sifts.SiftsSettings; @@ -426,7 +426,8 @@ public class Cache System.out .println("Jalview Version: " + codeVersion + codeInstallation); - Pdb.setCurrentDefaultFormat(jalview.bin.Cache.getDefault( + StructureViewSettings.setCurrentDefaultFormat(jalview.bin.Cache + .getDefault( "DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT)); // jnlpVersion will be null if we're using InstallAnywhere // Dont do this check if running in headless mode diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index 0cbd620..31ed1b7 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -206,6 +206,12 @@ public class JmolParser extends StructureFile implements JmolStatusListener List significantAtoms = new ArrayList(); for (org.jmol.modelset.Atom atom : ms.at) { + System.out.println("Seq Id : " + atom.getSeqID()); + System.out.println("To String : " + atom.toString()); + if (atom.isHetero()) + { + continue; + } if (atom.getAtomName().equalsIgnoreCase("CA") || atom.getAtomName().equalsIgnoreCase("P")) { diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 1a639f1..42a8ead 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -280,7 +280,8 @@ public class AppletFormatAdapter { // TODO obtain config value from preference settings. // Set value to 'true' to test PDB processing with Jmol: JAL-1213 - boolean isParseWithJMOL = false; + boolean isParseWithJMOL = !StructureViewSettings + .getCurrentDefaultFormat().equalsIgnoreCase("PDB"); if (isParseWithJMOL) { StructureViewSettings.addSettings(annotFromStructure, @@ -291,6 +292,8 @@ public class AppletFormatAdapter } else { + StructureViewSettings.addSettings(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct); StructureViewSettings.setShowSeqFeatures(true); alignFile = new MCview.PDBfile(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, inFile, diff --git a/src/jalview/structure/StructureViewSettings.java b/src/jalview/structure/StructureViewSettings.java index 2fcb3e5..5880d0f 100644 --- a/src/jalview/structure/StructureViewSettings.java +++ b/src/jalview/structure/StructureViewSettings.java @@ -1,5 +1,7 @@ package jalview.structure; +import jalview.datamodel.DBRefSource; + public class StructureViewSettings { private String dbRefType; @@ -24,6 +26,8 @@ public class StructureViewSettings private static boolean showSeqFeatures = true; + private static String currentDefaultFormat = DBRefSource.PDB; + public static void addSettings(boolean addAlignmentAnnotations, boolean predictSecStr, boolean externalSecStr) { @@ -76,4 +80,14 @@ public class StructureViewSettings StructureViewSettings.showSeqFeatures = showSeqFeatures; } + public static String getCurrentDefaultFormat() + { + return currentDefaultFormat; + } + + public static void setCurrentDefaultFormat(String currentDefaultFormat) + { + StructureViewSettings.currentDefaultFormat = currentDefaultFormat; + } + } diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index b0b5e92..d3a6238 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -30,6 +30,7 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.io.FormatAdapter; import jalview.io.PDBFeatureSettings; +import jalview.structure.StructureViewSettings; import jalview.util.MessageManager; import jalview.ws.ebi.EBIFetchClient; @@ -54,8 +55,6 @@ public class Pdb extends EbiFileRetrievedProxy public static final String FEATURE_RES_NUM = "RESNUM"; - private static String currentDefaultFormat = DBRefSource.PDB; - /* * (non-Javadoc) * @@ -133,11 +132,13 @@ public class Pdb extends EbiFileRetrievedProxy stopQuery(); return null; } - String ext = getCurrentDefaultFormat().equalsIgnoreCase("mmcif") ? ".cif" + String ext = StructureViewSettings.getCurrentDefaultFormat() + .equalsIgnoreCase("mmcif") ? ".cif" : ".xml"; EBIFetchClient ebi = new EBIFetchClient(); file = ebi.fetchDataAsFile("pdb:" + id, - getCurrentDefaultFormat().toLowerCase(), ext) + StructureViewSettings.getCurrentDefaultFormat().toLowerCase(), + ext) .getAbsolutePath(); stopQuery(); if (file == null) @@ -149,7 +150,7 @@ public class Pdb extends EbiFileRetrievedProxy pdbAlignment = new FormatAdapter().readFile(file, jalview.io.AppletFormatAdapter.FILE, - getCurrentDefaultFormat()); + StructureViewSettings.getCurrentDefaultFormat()); if (pdbAlignment != null) { List toremove = new ArrayList(); @@ -264,15 +265,6 @@ public class Pdb extends EbiFileRetrievedProxy return 0; } - public static String getCurrentDefaultFormat() - { - return currentDefaultFormat; - } - - public static void setCurrentDefaultFormat(String currentDefaultFomart) - { - Pdb.currentDefaultFormat = currentDefaultFomart; - } /** * Returns a descriptor for suitable feature display settings with diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index b560f01..27d2643 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -25,6 +25,7 @@ import static org.testng.AssertJUnit.assertTrue; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; +import jalview.structure.StructureViewSettings; import jalview.ws.seqfetcher.DbSourceProxy; import java.util.List; @@ -60,6 +61,10 @@ public class PDBSequenceFetcherTest @Test(groups = { "Network" }, enabled = true) public void testRnaSeqRetrieve() throws Exception { + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("DEFAULT_STRUCTURE_FORMAT", + "PDB"); List sps = sf.getSourceProxy("PDB"); AlignmentI response = sps.get(0).getSequenceRecords("2GIS"); assertTrue(response != null); @@ -81,6 +86,8 @@ public class PDBSequenceFetcherTest { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", Boolean.TRUE.toString()); + StructureViewSettings.setCurrentDefaultFormat("PDB"); + testRetrieveProteinSeqFromPDB(); } @@ -88,7 +95,8 @@ public class PDBSequenceFetcherTest public void testmmCifSeqRetrieve() throws Exception { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", - Boolean.FALSE.toString()); + Boolean.TRUE.toString()); + StructureViewSettings.setCurrentDefaultFormat("mmCIF"); testRetrieveProteinSeqFromPDB(); }