X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fsifts%2FSiftsClientTest.java;fp=test%2Fjalview%2Fws%2Fsifts%2FSiftsClientTest.java;h=44a6a0258fc378e6ae26f313ad4da00f5d7a8663;hb=3459a8a691cb22508d7067f240b7254e588e77d3;hp=6122d6d0ba61332b8d4b9faabac1ec8f71236892;hpb=5b27f1062b2203c4c31702e205f4c78e1992063e;p=jalview.git diff --git a/test/jalview/ws/sifts/SiftsClientTest.java b/test/jalview/ws/sifts/SiftsClientTest.java index 6122d6d..44a6a02 100644 --- a/test/jalview/ws/sifts/SiftsClientTest.java +++ b/test/jalview/ws/sifts/SiftsClientTest.java @@ -62,19 +62,18 @@ public class SiftsClientTest } public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System - .getProperty("user.home") - + File.separatorChar + .getProperty("user.home") + File.separatorChar + ".sifts_downloads" + File.separatorChar; private String testPDBId = "1a70"; private SiftsClient siftsClient = null; - SequenceI testSeq = new Sequence( - "P00221", + SequenceI testSeq = new Sequence("P00221", "MAAT..TTTMMG..MATTFVPKPQAPPMMAALPSNTGR..SLFGLKT.GSR..GGRMTMA" + "AYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDD" - + "QSFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEELTA.", 1, 147); + + "QSFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEELTA.", + 1, 147); int u = SiftsClient.UNASSIGNED; @@ -190,14 +189,14 @@ public class SiftsClientTest // SIFTs entries are updated weekly - so use saved SIFTs file to enforce // test reproducibility new SiftsSettings(); - SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault( - "sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); + SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache + .getDefault("sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); SiftsSettings.setMapWithSifts(true); SiftsSettings.setCacheThresholdInDays("2"); SiftsSettings.setFailSafePIDThreshold("70"); PDBfile pdbFile; - pdbFile = new PDBfile(false, false, false, "test/jalview/io/" - + testPDBId + ".pdb", DataSourceType.FILE); + pdbFile = new PDBfile(false, false, false, + "test/jalview/io/" + testPDBId + ".pdb", DataSourceType.FILE); siftsClient = new SiftsClient(pdbFile); } @@ -278,8 +277,8 @@ public class SiftsClientTest try { - HashMap actualMapping = siftsClient.getGreedyMapping( - "A", testSeq, null); + HashMap actualMapping = siftsClient + .getGreedyMapping("A", testSeq, null); Assert.assertEquals(testSeq.getStart(), 1); Assert.assertEquals(testSeq.getEnd(), 147); // Can't do Assert.assertEquals(actualMapping, expectedMapping); @@ -317,7 +316,8 @@ public class SiftsClientTest } @Test( - groups = { "Network" }, + groups = + { "Network" }, expectedExceptions = IllegalArgumentException.class) private void getAtomIndexNullTest() { @@ -330,18 +330,14 @@ public class SiftsClientTest } - @Test( -groups = { "Network" }, - expectedExceptions = SiftsException.class) + @Test(groups = { "Network" }, expectedExceptions = SiftsException.class) private void populateAtomPositionsNullTest1() throws IllegalArgumentException, SiftsException { siftsClient.populateAtomPositions(null, null); } - @Test( -groups = { "Network" }, - expectedExceptions = SiftsException.class) + @Test(groups = { "Network" }, expectedExceptions = SiftsException.class) private void populateAtomPositionsNullTest2() throws IllegalArgumentException, SiftsException { @@ -360,18 +356,14 @@ groups = { "Network" }, Assert.assertEquals(actualValidSrcDBRef, expectedDBRef); } - @Test( -groups = { "Network" }, - expectedExceptions = SiftsException.class) + @Test(groups = { "Network" }, expectedExceptions = SiftsException.class) public void getValidSourceDBRefExceptionTest() throws SiftsException { SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); siftsClient.getValidSourceDBRef(invalidTestSeq); } - @Test( -groups = { "Network" }, - expectedExceptions = SiftsException.class) + @Test(groups = { "Network" }, expectedExceptions = SiftsException.class) public void getValidSourceDBRefExceptionXTest() throws SiftsException { SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); @@ -395,11 +387,10 @@ groups = { "Network" }, public void getSiftsStructureMappingTest() throws SiftsException { Assert.assertTrue(SiftsSettings.isMapWithSifts()); - StructureMapping strucMapping = siftsClient.getSiftsStructureMapping( - testSeq, testPDBId, "A"); + StructureMapping strucMapping = siftsClient + .getSiftsStructureMapping(testSeq, testPDBId, "A"); String expectedMappingOutput = "\nSequence ⟷ Structure mapping details\n" - + "Method: SIFTS\n\n" - + "P00221 : 51 - 147 Maps to \n" + + "Method: SIFTS\n\n" + "P00221 : 51 - 147 Maps to \n" + "1A70|A : 1 - 97\n\n" + "P00221 AAYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLD\n" + " |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n" @@ -423,8 +414,8 @@ groups = { "Network" }, while (it.hasNext()) { Map.Entry pair = it.next(); - Assert.assertTrue(strucMapping.getMapping() - .containsKey(pair.getKey())); + Assert.assertTrue( + strucMapping.getMapping().containsKey(pair.getKey())); Assert.assertEquals(strucMapping.getMapping().get(pair.getKey()), pair.getValue()); } @@ -471,13 +462,13 @@ groups = { "Network" }, } @Test(groups = { "Network" }) - public void getEntityByMostOptimalMatchedIdTest1() throws IOException, - SiftsException + public void getEntityByMostOptimalMatchedIdTest1() + throws IOException, SiftsException { SiftsClient siftsClientX = null; PDBfile pdbFile; - pdbFile = new PDBfile(false, false, false, "test/jalview/io/2nq2" - + ".pdb", DataSourceType.FILE); + pdbFile = new PDBfile(false, false, false, + "test/jalview/io/2nq2" + ".pdb", DataSourceType.FILE); siftsClientX = new SiftsClient(pdbFile); Entity entityA = siftsClientX.getEntityByMostOptimalMatchedId("A"); Assert.assertEquals(entityA.getEntityId(), "A"); @@ -491,8 +482,8 @@ groups = { "Network" }, } @Test(groups = { "Network" }) - public void getEntityByMostOptimalMatchedIdTest2() throws IOException, - SiftsException + public void getEntityByMostOptimalMatchedIdTest2() + throws IOException, SiftsException { // This test is for a SIFTS file in which entity A should map to chain P for // the given PDB Id. All the other chains shouldn't be mapped as there are @@ -518,18 +509,14 @@ groups = { "Network" }, @Test(groups = { "Network" }) public void getLeadingIntegerFromString() { - Assert.assertEquals( - SiftsClient.getLeadingIntegerValue("1234abcd", -1), 1234); - Assert.assertEquals( - SiftsClient.getLeadingIntegerValue("1234", -1), + Assert.assertEquals(SiftsClient.getLeadingIntegerValue("1234abcd", -1), + 1234); + Assert.assertEquals(SiftsClient.getLeadingIntegerValue("1234", -1), 1234); - Assert.assertEquals( - SiftsClient.getLeadingIntegerValue("abcd", -1), -1); - Assert.assertEquals( - SiftsClient.getLeadingIntegerValue("abcd1234", -1), -1); - Assert.assertEquals( - SiftsClient.getLeadingIntegerValue("None", -1), -1); - Assert.assertEquals( - SiftsClient.getLeadingIntegerValue("Null", -1), -1); + Assert.assertEquals(SiftsClient.getLeadingIntegerValue("abcd", -1), -1); + Assert.assertEquals(SiftsClient.getLeadingIntegerValue("abcd1234", -1), + -1); + Assert.assertEquals(SiftsClient.getLeadingIntegerValue("None", -1), -1); + Assert.assertEquals(SiftsClient.getLeadingIntegerValue("Null", -1), -1); } }