From faaea5e75f32c615b8f7d5adbd8468118cfb8c3a Mon Sep 17 00:00:00 2001 From: James Procter Date: Thu, 2 Feb 2023 16:51:41 +0000 Subject: [PATCH] =?utf8?q?JAL-4119=20JAL-2144=20=E2=80=98invalid=E2=80=99=20?= =?utf8?q?DBRefEntry=20has=20a=20null=20version=20field=20-=20never=20candid?= =?utf8?q?ate=20for=20a=20primary=20sequence=20accession?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/datamodel/DBRefSource.java | 5 +++++ test/jalview/ws/sifts/SiftsClientTest.java | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index f384b1e..3b1757b 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -154,6 +154,11 @@ public class DBRefSource public static boolean isPrimaryCandidate(String ucversion) { + if (ucversion==null) + { + // Null/empty version is not a real reference ? + return false; + } // tricky - this test really needs to search the sequence's set of dbrefs to // see if there is a primary reference that derived this reference. for (int i = allSources.length; --i >= 0;) diff --git a/test/jalview/ws/sifts/SiftsClientTest.java b/test/jalview/ws/sifts/SiftsClientTest.java index b003cb5..0f5bd4d 100644 --- a/test/jalview/ws/sifts/SiftsClientTest.java +++ b/test/jalview/ws/sifts/SiftsClientTest.java @@ -195,8 +195,10 @@ public class SiftsClientTest SiftsSettings.setCacheThresholdInDays("2"); SiftsSettings.setFailSafePIDThreshold("70"); PDBfile pdbFile; + pdbFile = new PDBfile(false, false, false, "test/jalview/io/" + testPDBId + ".pdb", DataSourceType.FILE); + // TODO: this uses a network connection - we should mock the sifts testPDBId.xml.gz siftsClient = new SiftsClient(pdbFile); } @@ -221,7 +223,7 @@ public class SiftsClientTest long t1 = siftsFile.lastModified(); // re-read file should be returned from cache - siftsFile = SiftsClient.downloadSiftsFile(testPDBId); + siftsFile = SiftsClient.getSiftsFile(testPDBId); FileAssert.assertFile(siftsFile); long t2 = siftsFile.lastModified(); assertEquals(t1, t2); @@ -374,7 +376,7 @@ public class SiftsClientTest { SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); DBRefEntry invalidDBRef = new DBRefEntry(); - invalidDBRef.setAccessionId("BLAR"); + invalidDBRef.setAccessionId("BLAR"); // note no version is set, so also invalid invalidTestSeq.addDBRef(invalidDBRef); siftsClient.getValidSourceDBRef(invalidTestSeq); } -- 1.7.10.2