X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fstructure%2FMapping.java;h=f1fecedd8c67474db176fc463c00143656d32374;hb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;hp=4bee3f5ad73614f1912c83110d8b78e4e9592cdc;hpb=e7338a61f3ce96dadf44ac80b2b32cc5ba4b94c8;p=jalview.git diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java index 4bee3f5..f1feced 100644 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@ -72,12 +72,14 @@ public class Mapping // original numbers taken from // http://www.ebi.ac.uk/pdbe-srv/view/entry/1qcf/secondary.html // these are in numbering relative to the subsequence above - int coils[] = { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[] - { 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 }; + int coils[] = { 266, 275, 278, 287, 289, 298, 302, 316 }, + helices[] = new int[] + { 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 }; StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); StructureFile pmap = ssm.setMapping(true, new SequenceI[] { uprot }, - new String[] { "A" }, "test/jalview/ext/jmol/1QCF.pdb", + new String[] + { "A" }, "test/jalview/ext/jmol/1QCF.pdb", DataSourceType.FILE); assertTrue(pmap != null); SequenceI protseq = pmap.getSeqsAsArray()[0]; @@ -107,10 +109,10 @@ public class Mapping char expected = 'H'; for (int p : helices) { - Annotation a = ss.annotations[op = (uprot.findIndex(offset + p) - 1)]; - assertTrue( - "Expected a helix at position " + p + uprot.getCharAt(op) - + " but got coil", a != null); + Annotation a = ss.annotations[op = (uprot.findIndex(offset + p) + - 1)]; + assertTrue("Expected a helix at position " + p + + uprot.getCharAt(op) + " but got coil", a != null); assertEquals("Expected a helix at position " + p, a.secondaryStructure, expected); } @@ -118,8 +120,7 @@ public class Mapping for (int p : sheets) { Annotation a = ss.annotations[uprot.findIndex(offset + p) - 1]; - assertTrue( - "Expected a strand at position " + p + " but got coil", + assertTrue("Expected a strand at position " + p + " but got coil", a != null); assertEquals("Expected a strand at position " + p, a.secondaryStructure, expected); @@ -139,8 +140,7 @@ public class Mapping public void testPDBentryMapping() throws Exception { Assert.fail("This test intentionally left to fail"); - Sequence sq = new Sequence( - "1GAQ A subseq 126 to 219", + Sequence sq = new Sequence("1GAQ A subseq 126 to 219", "EIVKGVCSNFLCDLQPGDNVQITGPVGKEMLMPKDPNATIIMLATGTGIAPFRSFLWKMFFEKHDDYKFNGLGWLFLGVPTSSSLLYKEEFGKM"); Sequence sq1 = new Sequence(sq); String inFile; @@ -149,7 +149,7 @@ public class Mapping // source StructureFile pde = ssm.setMapping(true, new SequenceI[] { sq }, new String[] - { "A" }, inFile = "examples/1gaq.txt", DataSourceType.FILE); + { "A" }, inFile = "examples/1gaq.txt", DataSourceType.FILE); assertTrue("PDB File couldn't be found", pde != null); StructureMapping[] mp = ssm.getMapping(inFile); assertTrue("No mappings made.", mp != null && mp.length > 0); @@ -178,8 +178,8 @@ public class Mapping if (origMap.getSequence() == sq) { assertEquals("Mapping was incomplete.", sq.getLength() - 1, - (origMap.getPDBResNum(sq.getEnd()) - origMap - .getPDBResNum(sq.getStart()))); + (origMap.getPDBResNum(sq.getEnd()) + - origMap.getPDBResNum(sq.getStart()))); // sanity check - if this fails, mapping from first position in sequence // we want to transfer to is not where we expect assertEquals(1, origMap.getSeqPos(126)); @@ -198,8 +198,8 @@ public class Mapping { // walk along the pdb chain's jalview sequence int rseqpos; - int fpos = origMap.getSeqPos(rseqpos = firstChain - .findPosition(p)); + int fpos = origMap + .getSeqPos(rseqpos = firstChain.findPosition(p)); // only look at positions where there is a corresponding position in // mapping if (fpos < 1) @@ -217,10 +217,13 @@ public class Mapping break; } - Annotation a = transfer.annotations[tanpos], b = alan.annotations[p]; - assertEquals("Non-equivalent annotation element at " + p + "(" - + rseqpos + ")" + " expected at " + fpos + " (alIndex " - + tanpos + ")", a == null ? a : a.toString(), + Annotation a = transfer.annotations[tanpos], + b = alan.annotations[p]; + assertEquals( + "Non-equivalent annotation element at " + p + "(" + + rseqpos + ")" + " expected at " + fpos + + " (alIndex " + tanpos + ")", + a == null ? a : a.toString(), b == null ? b : b.toString()); System.out.print("(" + a + "|" + b + ")"); } @@ -238,15 +241,14 @@ public class Mapping @Test(groups = { "Functional" }) public void mapFer1From3W5V() throws Exception { - AlignFrame seqf = new FileLoader(false) - .LoadFileWaitTillLoaded( - ">FER1_MAIZE/1-150 Ferredoxin-1, chloroplast precursor\nMATVLGSPRAPAFFFSSSSLRAAPAPTAVALPAAKVGIMGRSASSRRRLRAQATYNVKLITPEGEVELQVPD\nDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKE\nEELTGA", - DataSourceType.PASTE, FileFormat.Fasta); + AlignFrame seqf = new FileLoader(false).LoadFileWaitTillLoaded( + ">FER1_MAIZE/1-150 Ferredoxin-1, chloroplast precursor\nMATVLGSPRAPAFFFSSSSLRAAPAPTAVALPAAKVGIMGRSASSRRRLRAQATYNVKLITPEGEVELQVPD\nDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKE\nEELTGA", + DataSourceType.PASTE, FileFormat.Fasta); SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0); StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq }, - new String[] { null }, "examples/3W5V.pdb", - DataSourceType.FILE); + new String[] + { null }, "examples/3W5V.pdb", DataSourceType.FILE); if (pmap == null) { AssertJUnit.fail("Couldn't make a mapping for 3W5V to FER1_MAIZE"); @@ -263,9 +265,8 @@ public class Mapping StructureImportSettings.setProcessSecondaryStructure(true); StructureImportSettings.setVisibleChainAnnotation(true); StructureImportSettings.setShowSeqFeatures(true); - AlignFrame ref = new FileLoader(false) - .LoadFileWaitTillLoaded("test/jalview/ext/jmol/1QCF.pdb", - DataSourceType.FILE); + AlignFrame ref = new FileLoader(false).LoadFileWaitTillLoaded( + "test/jalview/ext/jmol/1QCF.pdb", DataSourceType.FILE); SequenceI refseq = ref.getViewport().getAlignment().getSequenceAt(0); SequenceI newseq = new Sequence(refseq.getName() + "Copy", refseq.getSequenceAsString()); @@ -276,7 +277,8 @@ public class Mapping ssm.setProcessSecondaryStructure(true); ssm.setAddTempFacAnnot(true); StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq }, - new String[] { null }, "test/jalview/ext/jmol/1QCF.pdb", + new String[] + { null }, "test/jalview/ext/jmol/1QCF.pdb", DataSourceType.FILE); assertTrue(pmap != null); assertEquals("Original and copied sequence of different lengths.", @@ -291,9 +293,10 @@ public class Mapping { for (int p = 0, pSize = refseq.getLength(); p < pSize; p++) { - Annotation orig = oannot.annotations[p], tran = tannot.annotations[p]; - assertTrue("Mismatch: coil and non coil site " + p, orig == tran - || orig != null && tran != null); + Annotation orig = oannot.annotations[p], + tran = tannot.annotations[p]; + assertTrue("Mismatch: coil and non coil site " + p, + orig == tran || orig != null && tran != null); if (tran != null) { assertEquals("Mismatch in secondary structure at site " + p,