From: James Procter Date: Thu, 2 Feb 2023 16:51:41 +0000 (+0000) Subject: JAL-4119 JAL-2144 ‘invalid’ DBRefEntry has a null version field - never candidate... X-Git-Tag: Release_2_11_4_0~243^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=faaea5e75f32c615b8f7d5adbd8468118cfb8c3a;p=jalview.git JAL-4119 JAL-2144 ‘invalid’ DBRefEntry has a null version field - never candidate for a primary sequence accession --- 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); }