* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
-package jalview.io;
+package jalview.ws.sifts;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.Sequence;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.PrintStream;
+import java.util.HashMap;
import org.testng.Assert;
import org.testng.FileAssert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import MCview.PDBfile;
+
public class SiftsClientTest
{
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
+ "AYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDD"
+ "QSFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEELTA.", 1, 147);
- int[][] expectedMapping = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
- { 0, 4 }, { 0, 5 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 },
- { 0, 10 }, { 0, 11 }, { 0, 12 }, { 0, 13 }, { 0, 14 }, { 0, 15 },
- { 0, 16 }, { 0, 17 }, { 0, 18 }, { 0, 19 }, { 0, 20 }, { 0, 21 },
- { 0, 22 }, { 0, 23 }, { 0, 24 }, { 0, 25 }, { 0, 26 }, { 0, 27 },
- { 0, 28 }, { 0, 29 }, { 0, 30 }, { 0, 31 }, { 0, 32 }, { 0, 33 },
- { 0, 34 }, { 0, 35 }, { 0, 36 }, { 0, 37 }, { 0, 38 }, { 0, 39 },
- { 0, 40 }, { 0, 41 }, { 0, 42 }, { 0, 43 }, { 0, 44 }, { 0, 45 },
- { 0, 46 }, { 0, 47 }, { 0, 48 }, { 0, 49 }, { 0, 50 }, { 1, 51 },
- { 2, 52 }, { 3, 53 }, { 4, 54 }, { 5, 55 }, { 6, 56 }, { 7, 57 },
- { 8, 58 }, { 9, 59 }, { 10, 60 }, { 11, 61 }, { 12, 62 }, { 13, 63 },
- { 14, 64 }, { 15, 65 }, { 16, 66 }, { 17, 67 }, { 18, 68 },
- { 19, 69 }, { 20, 70 }, { 21, 71 }, { 22, 72 }, { 23, 73 },
- { 24, 74 }, { 25, 75 }, { 26, 76 }, { 27, 77 }, { 28, 78 },
- { 29, 79 }, { 30, 80 }, { 31, 81 }, { 32, 82 }, { 33, 83 },
- { 34, 84 }, { 35, 85 }, { 36, 86 }, { 37, 87 }, { 38, 88 },
- { 39, 89 }, { 40, 90 }, { 41, 91 }, { 42, 92 }, { 43, 93 },
- { 44, 94 }, { 45, 95 }, { 46, 96 }, { 47, 97 }, { 48, 98 },
- { 49, 99 }, { 50, 100 }, { 51, 101 }, { 52, 102 }, { 53, 103 },
- { 54, 104 }, { 55, 105 }, { 56, 106 }, { 57, 107 }, { 58, 108 },
- { 59, 109 }, { 60, 110 }, { 61, 111 }, { 62, 112 }, { 63, 113 },
- { 64, 114 }, { 65, 115 }, { 66, 116 }, { 67, 117 }, { 68, 118 },
- { 69, 119 }, { 70, 120 }, { 71, 121 }, { 72, 122 }, { 73, 123 },
- { 74, 124 }, { 75, 125 }, { 76, 126 }, { 77, 127 }, { 78, 128 },
- { 79, 129 }, { 80, 130 }, { 81, 131 }, { 82, 132 }, { 83, 133 },
- { 84, 134 }, { 85, 135 }, { 86, 136 }, { 87, 137 }, { 88, 138 },
- { 89, 139 }, { 90, 140 }, { 91, 141 }, { 92, 142 }, { 93, 143 },
- { 94, 144 }, { 95, 145 }, { 96, 146 } };
+ int u = SiftsClient.UNASSIGNED;
+
+ HashMap<Integer, int[]> expectedMapping = new HashMap<Integer, int[]>();
@BeforeTest(alwaysRun = true)
- public void setUpSiftsClient()
+ public void populateExpectedMapping() throws SiftsException
+ {
+ for (int x = 1; x <= 97; x++)
+ {
+ expectedMapping.put(50 + x, new int[] { x, u });
+ }
+ }
+
+ @BeforeTest(alwaysRun = true)
+ public void setUpSiftsClient() throws SiftsException
{
// SIFTs entries are updated weekly - so use saved SIFTs file to enforce
// test reproducibility
File testSiftsFile = new File("test/jalview/io/" + testPDBId
+ ".xml.gz");
- siftsClient = new SiftsClient(testPDBId, testSiftsFile);
+ PDBfile pdbFile = new PDBfile(false, false, false);
+ siftsClient = new SiftsClient(pdbFile, testSiftsFile);
}
@AfterTest(alwaysRun = true)
}
@Test(groups = { "Functional" })
- public void getSIFTsFileTest()
+ public void getSIFTsFileTest() throws SiftsException
{
Assert.assertTrue(SiftsClient.deleteSiftsFileByPDBId(testPDBId));
SiftsClient.getSiftsFile(testPDBId);
}
@Test(groups = { "Functional" })
- public void downloadSiftsFileTest()
+ public void downloadSiftsFileTest() throws SiftsException
{
// Assert that file isn't yet downloaded - if already downloaded, assert it
// is deleted
try
{
- int[][] actualMapping = siftsClient.getGreedyMapping("A", testSeq,
+ HashMap<Integer, int[]> actualMapping = siftsClient.getGreedyMapping(
+ "A", testSeq,
null);
Assert.assertEquals(actualMapping, expectedMapping);
Assert.assertEquals(testSeq.getStart(), 1);
}
@Test(groups = { "Functional" })
+ private void getAtomIndexTest()
+ {
+ // siftsClient.getAtomIndex(1, null);
+ // Assert.assertTrue(true);
+ }
+
+ @Test(
+ groups = { "Functional" },
+ expectedExceptions = IllegalArgumentException.class)
+ private void getAtomIndexNullTest()
+ {
+ siftsClient.getAtomIndex(1, null);
+ }
+
+ @Test(groups = { "Functional" })
+ private void padWithGapsTest()
+ {
+
+ }
+
+ @Test(groups = { "Functional" })
+ private void populateAtomPositionsTest()
+ {
+
+ }
+
+ @Test(groups = { "Functional" })
public void getValidSourceDBRefTest()
{