X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraView.java;fp=test%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraView.java;h=7f9aa9bd3cc97ff6e202224192aceb8f4ef54bea;hb=3459a8a691cb22508d7067f240b7254e588e77d3;hp=e8b5bea8cf47ccbe9dd362cded257546455838be;hpb=5b27f1062b2203c4c31702e205f4c78e1992063e;p=jalview.git diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index e8b5bea..7f9aa9b 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -79,8 +79,10 @@ public class JalviewChimeraView @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - Jalview.main(new String[] { "-noquestionnaire", "-nonews", "-props", - "test/jalview/ext/rbvi/chimera/testProps.jvprops" }); + Jalview.main( + new String[] + { "-noquestionnaire", "-nonews", "-props", + "test/jalview/ext/rbvi/chimera/testProps.jvprops" }); Cache.setProperty(Preferences.STRUCTURE_DISPLAY, ViewerType.CHIMERA.name()); Cache.setProperty("SHOW_ANNOTATIONS", "false"); @@ -132,10 +134,11 @@ public class JalviewChimeraView assertEquals(pdbIds.size(), 1); PDBEntry pdbEntry = pdbIds.get(0); assertEquals(pdbEntry.getId(), "1GAQ"); - StructureViewer structureViewer = new StructureViewer(af.getViewport() - .getStructureSelectionManager()); + StructureViewer structureViewer = new StructureViewer( + af.getViewport().getStructureSelectionManager()); chimeraViewer = structureViewer.viewStructures(pdbEntry, - new SequenceI[] { sq }, af.getCurrentView().getAlignPanel()); + new SequenceI[] + { sq }, af.getCurrentView().getAlignPanel()); JalviewChimeraBinding binding = (JalviewChimeraBinding) chimeraViewer .getBinding(); @@ -150,7 +153,7 @@ public class JalviewChimeraView } catch (InterruptedException e) { } - } while (!binding.isFinishedInit() || !chimeraViewer.isVisible()); + } while (!binding.isFinishedInit() || !chimeraViewer.isVisible()); assertTrue(binding.isViewerRunning(), "Failed to start Chimera"); @@ -158,23 +161,30 @@ public class JalviewChimeraView assertTrue(chimeraViewer.hasViewerActionsMenu()); // now add another sequence and bind to view - // + // AlignmentI al = af.getViewport().getAlignment(); PDBEntry xpdb = al.getSequenceAt(0).getPDBEntry("1GAQ"); - sq = new Sequence("1GAQ", al.getSequenceAt(0).getSequence(25, 95).toString()); + sq = new Sequence("1GAQ", + al.getSequenceAt(0).getSequence(25, 95).toString()); al.addSequence(sq); - structureViewer.viewStructures(new PDBEntry[] { xpdb }, new SequenceI[] { sq }, af.getCurrentView().getAlignPanel()); + structureViewer.viewStructures(new PDBEntry[] { xpdb }, + new SequenceI[] + { sq }, af.getCurrentView().getAlignPanel()); /* * Wait for viewer load thread to complete */ - do + do { - try { + try + { Thread.sleep(1500); - } catch (InterruptedException q) {}; + } catch (InterruptedException q) + { + } + ; } while (!binding.isLoadingFinished()); - + // still just one PDB structure shown assertEquals(chimeraViewer.getBinding().getPdbCount(), 1); // and the viewer action menu should still be visible @@ -212,18 +222,18 @@ public class JalviewChimeraView /* * use local test PDB and SIFTS files */ - String pdbFilePath = new File( - "test/jalview/ext/rbvi/chimera/4zho.pdb").getPath(); + String pdbFilePath = new File("test/jalview/ext/rbvi/chimera/4zho.pdb") + .getPath(); PDBEntry pdbEntry = new PDBEntry("4ZHO", null, null, pdbFilePath); String siftsFilePath = new File( - "test/jalview/ext/rbvi/chimera/4zho.xml.gz") - .getPath(); + "test/jalview/ext/rbvi/chimera/4zho.xml.gz").getPath(); SiftsClient.setMockSiftsFile(new File(siftsFilePath)); - StructureViewer structureViewer = new StructureViewer(af.getViewport() - .getStructureSelectionManager()); + StructureViewer structureViewer = new StructureViewer( + af.getViewport().getStructureSelectionManager()); chimeraViewer = structureViewer.viewStructures(pdbEntry, - new SequenceI[] { sq }, af.getCurrentView().getAlignPanel()); + new SequenceI[] + { sq }, af.getCurrentView().getAlignPanel()); JalviewChimeraBinding binding = (JalviewChimeraBinding) chimeraViewer .getBinding(); @@ -273,11 +283,11 @@ public class JalviewChimeraView sq.addSequenceFeature(new SequenceFeature("metal ion-binding site", "Iron-Sulfur (2Fe-2S)", 96, 96, Float.NaN, null)); // on a sequence region that is partially mapped to structure: - sq.addSequenceFeature(new SequenceFeature("helix", null, 50, 60, - Float.NaN, null)); + sq.addSequenceFeature( + new SequenceFeature("helix", null, 50, 60, Float.NaN, null)); // and again: - sq.addSequenceFeature(new SequenceFeature("chain", null, 50, 70, - Float.NaN, null)); + sq.addSequenceFeature( + new SequenceFeature("chain", null, 50, 70, Float.NaN, null)); // add numeric valued features - score is set as attribute value sq.addSequenceFeature(new SequenceFeature("kd", "hydrophobicity", 62, 62, -2.1f, null)); @@ -340,14 +350,14 @@ public class JalviewChimeraView new StructureCommand("list resi att jv_metal_ion_binding_site"), true); assertEquals(reply.size(), 4); - assertTrue(reply - .contains("residue id #0:40.A jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 40")); - assertTrue(reply - .contains("residue id #0:45.A jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 45")); - assertTrue(reply - .contains("residue id #0:40.B jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 40")); - assertTrue(reply - .contains("residue id #0:45.B jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 45")); + assertTrue(reply.contains( + "residue id #0:40.A jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 40")); + assertTrue(reply.contains( + "residue id #0:45.A jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 45")); + assertTrue(reply.contains( + "residue id #0:40.B jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 40")); + assertTrue(reply.contains( + "residue id #0:45.B jv_metal_ion_binding_site \"Iron-Sulfur (2Fe-2S)\" index 45")); /* * check attributes with score values @@ -395,29 +405,28 @@ public class JalviewChimeraView SequenceI fer2Arath = af.getViewport().getAlignment() .findName("FER2_ARATH"); assertNotNull(fer2Arath, "Didn't find FER2_ARATH"); - + /* * need a Uniprot dbref for SIFTS mapping to work!! */ fer2Arath.addDBRef(new DBRefEntry("UNIPROT", "0", "P16972", null)); - + /* * use local test PDB and SIFTS files */ - String pdbFilePath = new File( - "test/jalview/ext/rbvi/chimera/4zho.pdb").getPath(); + String pdbFilePath = new File("test/jalview/ext/rbvi/chimera/4zho.pdb") + .getPath(); PDBEntry pdbEntry = new PDBEntry("4ZHO", null, null, pdbFilePath); String siftsFilePath = new File( - "test/jalview/ext/rbvi/chimera/4zho.xml.gz") - .getPath(); + "test/jalview/ext/rbvi/chimera/4zho.xml.gz").getPath(); SiftsClient.setMockSiftsFile(new File(siftsFilePath)); - - StructureViewer structureViewer = new StructureViewer(af.getViewport() - .getStructureSelectionManager()); + + StructureViewer structureViewer = new StructureViewer( + af.getViewport().getStructureSelectionManager()); chimeraViewer = structureViewer.viewStructures(pdbEntry, - new SequenceI[] { fer2Arath }, af.getCurrentView() - .getAlignPanel()); - + new SequenceI[] + { fer2Arath }, af.getCurrentView().getAlignPanel()); + JalviewChimeraBinding binding = (JalviewChimeraBinding) chimeraViewer .getBinding(); do @@ -429,19 +438,19 @@ public class JalviewChimeraView { } } while (!binding.isFinishedInit()); - + assertTrue(binding.isViewerRunning(), "Failed to launch Chimera"); - + assertEquals(binding.getPdbCount(), 1); - + /* * 'perform' menu action to copy Chimera attributes * to features in Jalview */ // TODO rename and pull up method to binding interface // once functionality is added for Jmol as well - binding.copyStructureAttributesToFeatures("isHelix", af.getViewport() - .getAlignPanel()); + binding.copyStructureAttributesToFeatures("isHelix", + af.getViewport().getAlignPanel()); /* * verify 22 residues have isHelix feature @@ -470,8 +479,8 @@ public class JalviewChimeraView /* * fetch a numeric valued attribute */ - binding.copyStructureAttributesToFeatures("phi", af.getViewport() - .getAlignPanel()); + binding.copyStructureAttributesToFeatures("phi", + af.getViewport().getAlignPanel()); fr.setVisible("phi"); List fs = fer2Arath.getFeatures().findFeatures(54, 54, "phi");