@Test(groups = "Functional")
public void testGetCodeTable()
{
- GeneticCodes codes = GeneticCodes.getInstance();
- assertEquals(codes.getStandardCodeTable().getName(), "Standard");
- assertEquals(codes.getStandardCodeTable().getId(), "1");
- assertSame(codes.getStandardCodeTable(), codes.getCodeTable("1"));
- assertEquals(codes.getCodeTable("2").getName(),
+ assertEquals(GeneticCodes.getStandardCodeTable().getName(), "Standard");
+ assertEquals(GeneticCodes.getStandardCodeTable().getId(), "1");
+ assertSame(GeneticCodes.getStandardCodeTable(),
+ GeneticCodes.getCodeTable("1"));
+ assertEquals(GeneticCodes.getCodeTable("2").getName(),
"Vertebrate Mitochondrial");
- assertEquals(codes.getCodeTable("11").getName(),
+ assertEquals(GeneticCodes.getCodeTable("11").getName(),
"Bacterial, Archaeal and Plant Plastid");
- assertEquals(codes.getCodeTable("31").getName(),
+ assertEquals(GeneticCodes.getCodeTable("31").getName(),
"Blastocrithidia Nuclear");
}
@Test(groups = "Functional")
public void testGetCodeTables()
{
- GeneticCodes codes = GeneticCodes.getInstance();
- Iterator<GeneticCodeI> tableIterator = codes.getCodeTables().iterator();
+ Iterator<GeneticCodeI> tableIterator = GeneticCodes.getCodeTables()
+ .iterator();
String[] ids = new String[] { "1", "2", "3", "4", "5", "6", "9", "10",
- "11", "12", "13", "14", "16", "21", "22", "23", "24", "25", "26",
- "27", "28", "29", "30", "31" };
+ "11", "12", "13", "14", "15", "16", "21", "22", "23", "24", "25",
+ "26", "27", "28", "29", "30", "31" };
for (int i = 0; i < ids.length; i++)
{
assertEquals(tableIterator.next().getId(), ids[i]);
@Test(groups = "Functional")
public void testTranslate()
{
- GeneticCodes codes = GeneticCodes.getInstance();
-
- GeneticCodeI gc = codes.getCodeTable("1");
+ GeneticCodeI gc = GeneticCodes.getCodeTable("1");
assertNull(gc.translate("XYZ"));
assertEquals(gc.translate("AGA"), "R");
- gc = codes.getCodeTable("2");
+ gc = GeneticCodes.getCodeTable("2");
assertEquals(gc.translate("AGA"), "*"); // variant
assertEquals(gc.translate("ttc"), "F"); // non-variant
// table 11 has no variant translations - should serve the standard values
- gc = codes.getCodeTable("11");
+ gc = GeneticCodes.getCodeTable("11");
assertEquals(gc.translate("ttc"), "F");
- gc = codes.getCodeTable("31");
+ gc = GeneticCodes.getCodeTable("31");
assertEquals(gc.translate("TGA"), "W"); // variant
assertEquals(gc.translate("tag"), "E"); // variant
assertEquals(gc.translate("AGC"), "S"); // non-variant
@Test(groups = { "Functional" })
public void testTranslate_standardTable()
{
- GeneticCodeI st = GeneticCodes.getInstance().getStandardCodeTable();
+ GeneticCodeI st = GeneticCodes.getStandardCodeTable();
assertEquals("F", st.translate("TTT"));
assertEquals("F", st.translate("TTC"));
assertEquals("L", st.translate("TTA"));
@Test(groups = { "Functional" })
public void testTranslate_standardTableAmbiguityCodes()
{
- GeneticCodeI st = GeneticCodes.getInstance().getStandardCodeTable();
+ GeneticCodeI st = GeneticCodes.getStandardCodeTable();
// Y is C or T
assertEquals("C", st.translate("TGY"));
// Phenylalanine first base variation
@Test(groups = { "Functional" })
public void testTranslate_nonStandardTableAmbiguityCodes()
{
- GeneticCodeI standard = GeneticCodes.getInstance()
+ GeneticCodeI standard = GeneticCodes
.getStandardCodeTable();
/*
* Vertebrate Mitochondrial (Table 2)
*/
- GeneticCodeI gc = GeneticCodes.getInstance().getCodeTable("2");
+ GeneticCodeI gc = GeneticCodes.getCodeTable("2");
// AGR is AGA or AGG - R in standard code, * in table 2
assertEquals(gc.translate("AGR"), "*");
assertEquals(standard.translate("AGR"), "R");
/*
* Yeast Mitochondrial (Table 3)
*/
- gc = GeneticCodes.getInstance().getCodeTable("3");
+ gc = GeneticCodes.getCodeTable("3");
// CTN is L in standard code, T in table 3
assertEquals(gc.translate("ctn"), "T");
assertEquals(standard.translate("CTN"), "L");
/*
* Alternative Yeast Nuclear (Table 12)
*/
- gc = GeneticCodes.getInstance().getCodeTable("12");
+ gc = GeneticCodes.getCodeTable("12");
// CTG is S; in the standard code CTN is L
assertEquals(gc.translate("CTG"), "S");
assertNull(gc.translate("CTK")); // K is G or T -> S or L
/*
* Trematode Mitochondrial (Table 21)
*/
- gc = GeneticCodes.getInstance().getCodeTable("21");
+ gc = GeneticCodes.getCodeTable("21");
// AAR is K in standard code, ambiguous in table 21 as AAA=N not K
assertNull(gc.translate("AAR"));
assertEquals(standard.translate("AAR"), "K");
@Test(groups = "Functional")
public void testTranslateCanonical()
{
- GeneticCodes codes = GeneticCodes.getInstance();
-
- GeneticCodeI gc = codes.getCodeTable("1");
+ GeneticCodeI gc = GeneticCodes.getCodeTable("1");
assertNull(gc.translateCanonical("XYZ"));
assertEquals(gc.translateCanonical("AGA"), "R");
// translateCanonical should not resolve ambiguity codes
assertNull(gc.translateCanonical("TGY"));
- gc = codes.getCodeTable("2");
+ gc = GeneticCodes.getCodeTable("2");
assertNull(gc.translateCanonical("AGR"));
assertEquals(gc.translateCanonical("AGA"), "*"); // variant
assertEquals(gc.translateCanonical("ttc"), "F"); // non-variant