CeCPMain extends CeMain { public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc, Atom[] ca1, Atom[] ca2duplicated) throws StructureException { return filterDuplicateAFPs(afpChain, ceCalc, ca1, ca2duplicated, DEFAULT_MIN_CP_LENGTH); } CeCPMain(); @Override String getAlgorithmName(); @Override String getVersion(); static void main(String[] args); @Override AFPChain align(Atom[] ca1, Atom[] ca2, Object param); static AFPChain postProcessAlignment(AFPChain afpChain, Atom[] ca1, Atom[] ca2m,CECalculator calculator ); static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc, Atom[] ca1, Atom[] ca2duplicated); static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc,
			Atom[] ca1, Atom[] ca2duplicated, int minCPlength); static final String algorithmName; static final int DEFAULT_MIN_CP_LENGTH; static final String version; }
@Test public void testFilterDuplicateAFPs() throws Exception { int[][][] dupAlign = new int[1][2][]; int ca2len = 12; dupAlign[0][0] = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13 }; dupAlign[0][1] = new int[] { 3, 5, 6, 7, 8, 9,10,11, 0+ca2len, 1+ca2len, 2+ca2len, 3+ca2len, 4+ca2len, 7+ca2len }; Atom[] ca1,ca2; ca1 = makeDummyCA(dupAlign[0][0].length); ca2 = makeDummyCA(ca2len); ca2 = StructureTools.duplicateCA2(ca2); AFPChain afp = makeDummyAFPChain(dupAlign, ca1, ca2); AFPChain newAFP = CeCPMain.filterDuplicateAFPs(afp, new CECalculator(null), ca1, ca2, 0); int[][][] align = newAFP.getOptAln(); int[] blkLen = newAFP.getOptLen(); int[][][] expected = new int[][][] { new int[][] { new int[] { 1, 2, 3, 4, 5, 6, 7, }, new int[] { 5, 6, 7, 8, 9, 10, 11, }, }, new int[][] { new int[] { 8, 9, 10, 11, 12, }, new int[] { 0, 1, 2, 3, 4, }, }, }; int[] expectedLen = new int[] { expected[0][0].length, expected[1][0].length }; assertTrue(Arrays.deepEquals(expected, align)); assertTrue(Arrays.equals(expectedLen, blkLen)); }
@Test public void testFilterDuplicateAFPsMinLenCTerm() throws PDBParseException, StructureException { int[][][] startAln, filteredAln; int[] filteredLen; int ca2len; ca2len = 10; startAln = new int[][][] { new int[][] { new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,}, new int[] { 0, 3, 5, 6, 7, 8, 9, 0+ca2len, 1+ca2len, 2+ca2len, 3+ca2len,}, }, }; Atom[] ca1, ca2; AFPChain afpChain,result; ca1 = makeDummyCA(startAln[0][0].length); ca2 = makeDummyCA(ca2len); ca2 = StructureTools.duplicateCA2(ca2); afpChain = makeDummyAFPChain(startAln, ca1, ca2); filteredAln = new int[][][] { new int[][] { new int[] { 1, 2, 3, 4, 5, 6,}, new int[] { 3, 5, 6, 7, 8, 9,}, }, new int[][] { new int[] { 7, 8, 9,}, new int[] { 0, 1, 2,}, }, }; filteredLen = new int[] { filteredAln[0][0].length, filteredAln[1][0].length }; int minCPlength; for(minCPlength=0;minCPlength<4;minCPlength++) { result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); } minCPlength=4; filteredAln = new int[][][] { new int[][] { new int[] { 2, 3, 4, 5, 6,}, new int[] { 5, 6, 7, 8, 9,}, }, new int[][] { new int[] { 7, 8, 9,10,}, new int[] { 0, 1, 2, 3,}, }, }; filteredLen = new int[] { filteredAln[0][0].length, filteredAln[1][0].length }; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); minCPlength=5; filteredAln = new int[][][] { new int[][] { new int[] { 0, 1, 2, 3, 4, 5, 6,}, new int[] { 0, 3, 5, 6, 7, 8, 9,}, }, }; filteredLen = new int[] { filteredAln[0][0].length }; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); minCPlength=7; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); minCPlength=8; filteredAln = new int[0][][]; filteredLen = new int[0]; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); }
@Test public void testFilterDuplicateAFPsMinLenNTerm() throws PDBParseException, StructureException { int[][][] startAln, filteredAln; int ca2len; ca2len = 10; startAln = new int[][][] { new int[][] { new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,}, new int[] { 6, 8, 9,10,11,12,13,14,16,17,19,}, }, }; filteredAln = new int[][][] { new int[][] { new int[] { 1, 2,}, new int[] { 8, 9,}, }, new int[][] { new int[] { 3, 4, 5, 6, 7, 8, 9,}, new int[] { 0, 1, 2, 3, 4, 6, 7,}, }, }; int[] filteredLen = new int[] { filteredAln[0][0].length, filteredAln[1][0].length }; Atom[] ca1, ca2; AFPChain afpChain,result; ca1 = makeDummyCA(startAln[0][0].length); ca2 = makeDummyCA(ca2len); ca2 = StructureTools.duplicateCA2(ca2); afpChain = makeDummyAFPChain(startAln, ca1, ca2); int minCPlength; for(minCPlength=0;minCPlength<3;minCPlength++) { result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); } minCPlength=3; filteredAln = new int[][][] { new int[][] { new int[] { 0, 1, 2,}, new int[] { 6, 8, 9,}, }, new int[][] { new int[] { 3, 4, 5, 6, 7,}, new int[] { 0, 1, 2, 3, 4,}, }, }; filteredLen = new int[] { filteredAln[0][0].length, filteredAln[1][0].length }; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); minCPlength=5; filteredAln = new int[][][] { new int[][] { new int[] { 3, 4, 5, 6, 7, 8, 9,10,}, new int[] { 0, 1, 2, 3, 4, 6, 7, 9,}, }, }; filteredLen = new int[] { filteredAln[0][0].length }; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); minCPlength=8; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); minCPlength=9; filteredAln = new int[0][][]; filteredLen = new int[0]; result = CeCPMain.filterDuplicateAFPs(afpChain, new CECalculator(null), ca1, ca2,minCPlength); assertTrue("Wrong optAln for minCPlength="+minCPlength,Arrays.deepEquals(filteredAln, result.getOptAln())); assertTrue("Wrong optLen for minCPlength="+minCPlength,Arrays.equals(filteredLen, result.getOptLen())); }