From ee942237fe5155b25f5419ece71a4084a47e2f41 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 2 Nov 2021 12:10:08 +0000 Subject: [PATCH] JAL-3875 test case and patch to verify the query 3d beacons button is shown for proteins with uniprot ids but no canonical accessions --- src/jalview/gui/StructureChooser.java | 15 ++++++++++++++- test/jalview/gui/StructureChooserTest.java | 25 +++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 09eb7af..e400b51 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -168,7 +168,8 @@ public class StructureChooser extends GStructureChooser canQueryTDB = true; if (needCanonical) { - notQueriedTDBYet = false; + // triggers display of the 'Query TDB' button + notQueriedTDBYet = true; } } }; @@ -1503,4 +1504,16 @@ public class StructureChooser extends GStructureChooser && mainFrame.isVisible() && cmb_filterOption.getSelectedItem() != null; } + /** + * + * @return true if the 3D-Beacons query button will/has been displayed + */ + public boolean isCanQueryTDB() { + return canQueryTDB; + } + + public boolean isNotQueriedTDBYet() + { + return notQueriedTDBYet; + } } diff --git a/test/jalview/gui/StructureChooserTest.java b/test/jalview/gui/StructureChooserTest.java index a87e1c6..f183e5c 100644 --- a/test/jalview/gui/StructureChooserTest.java +++ b/test/jalview/gui/StructureChooserTest.java @@ -58,7 +58,7 @@ public class StructureChooserTest JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); } - Sequence seq,upSeq; + Sequence seq,upSeq,upSeq_nocanonical; @BeforeMethod(alwaysRun = true) public void setUp() throws Exception @@ -111,9 +111,15 @@ public class StructureChooserTest + "GTGVHPIVVVQPDAWTEDNGFHAIGQMCEAPVVTREWVLDSVALYQCQELDTYLIPQIPHSHY\n" + "", 1, 1863); - upSeq.createDatasetSequence(); upSeq.setDescription("Breast cancer type 1 susceptibility protein"); + upSeq_nocanonical = new Sequence(upSeq); + upSeq.createDatasetSequence(); upSeq.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,true)); + + upSeq_nocanonical.createDatasetSequence(); + // not a canonical reference + upSeq_nocanonical.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,false)); + } @AfterMethod(alwaysRun = true) @@ -121,6 +127,7 @@ public class StructureChooserTest { seq = null; upSeq=null; + upSeq_nocanonical=null; } @Test(groups = { "Functional" }) @@ -163,6 +170,20 @@ public class StructureChooserTest } + @Test(groups = { "Functional" }) + public void displayTDBQueryTest() throws InterruptedException + { + TDBeaconsFTSRestClientTest.setMock(); + PDBFTSRestClientTest.setMock(); + + SequenceI[] selectedSeqs = new SequenceI[] { upSeq_nocanonical }; + StructureChooser sc = new StructureChooser(selectedSeqs, upSeq_nocanonical, null); + // mock so should be quick. Exceptions from mocked PDBFTS are expected too + ThreadwaitFor(500, sc); + + assertTrue(sc.isCanQueryTDB() && sc.isNotQueriedTDBYet()); + } + @Test(groups = { "Network" }) public void fetchStructuresInfoTest() { -- 1.7.10.2