import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.api.DBRefEntryI;
-import jalview.bin.Cache;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
-import jalview.gui.JvOptionPane;
-import jalview.io.DataSourceType;
-import jalview.structure.StructureMapping;
-import jalview.xml.binding.sifts.Entry.Entity;
import java.io.File;
import java.io.IOException;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import jalview.api.DBRefEntryI;
+import jalview.bin.Cache;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.gui.JvOptionPane;
+import jalview.io.DataSourceType;
+import jalview.structure.StructureMapping;
+import jalview.xml.binding.sifts.Entry.Entity;
import mc_view.Atom;
import mc_view.PDBfile;
}
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;
Cache.loadProperties("test/jalview/io/testProps.jvprops");
// 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);
}
try
{
- HashMap<Integer, int[]> actualMapping = siftsClient
- .getGreedyMapping("A", testSeq, null);
+ HashMap<Integer, int[]> actualMapping = siftsClient.getGreedyMapping(
+ "A", testSeq, null);
Assert.assertEquals(testSeq.getStart(), 1);
Assert.assertEquals(testSeq.getEnd(), 147);
// Can't do Assert.assertEquals(actualMapping, expectedMapping);
atom.atomIndex = 7;
atoms.add(atom);
int actualAtomIndex = siftsClient.getAtomIndex(1, atoms);
- Assert.assertEquals(actualAtomIndex, siftsClient.UNASSIGNED);
+ Assert.assertEquals(actualAtomIndex, SiftsClient.UNASSIGNED);
actualAtomIndex = siftsClient.getAtomIndex(43, atoms);
Assert.assertEquals(actualAtomIndex, 7);
}
@Test(
- groups =
- { "Network" },
+ groups = { "Network" },
expectedExceptions = IllegalArgumentException.class)
private void getAtomIndexNullTest()
{
}
- @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
{
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");
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"
while (it.hasNext())
{
Map.Entry<Integer, int[]> 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());
}
}
@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");
}
@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
Assert.assertNull(entityP);
}
-
- @Test(groups = { "Network" })
- public void getLeadingIntegerFromString()
- {
- 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);
- }
}