X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FPAEContactMatrixTest.java;h=67edb37da53fef7cf3511f07fe8d5fe488b36752;hb=e8b8c8601ccdc2fdb2093c5228c071d14182004f;hp=8cc2ec4dbaa851ca64275c6fe674aecf136dfe1a;hpb=8a7a9401835f50b64bab13489de2781e8ced6ba8;p=jalview.git diff --git a/test/jalview/datamodel/PAEContactMatrixTest.java b/test/jalview/datamodel/PAEContactMatrixTest.java index 8cc2ec4..67edb37 100644 --- a/test/jalview/datamodel/PAEContactMatrixTest.java +++ b/test/jalview/datamodel/PAEContactMatrixTest.java @@ -206,4 +206,41 @@ public class PAEContactMatrixTest } } + /** + * check mapping and resolution methods work + */ + @Test(groups= {"Functional"}) + public void testMappableContactMatrix() { + SequenceI newseq = new Sequence("Seq", "ASDQEASDQEASDQE"); + MapList map = new MapList(new int[] + { 5, 9 }, new int[] { 1, 5 }, 1, 1); + AlignmentAnnotation aa = newseq + .addContactList(new PAEContactMatrix(newseq,map, PAEdata,null)); + ContactListI clist = newseq.getContactListFor(aa, 4); + assertNotNull(clist); + clist = newseq.getContactListFor(aa, 3); + assertNull(clist); + + ContactMatrixI cm = newseq.getContactMatrixFor(aa); + MappableContactMatrixI mcm = (MappableContactMatrixI) cm; + int[] pos = mcm.getMappedPositionsFor(newseq, 0); + assertNull(pos); + + pos = mcm.getMappedPositionsFor(newseq, 1); + assertNotNull(pos); + assertEquals(pos[0],4+newseq.getStart()); + + pos = mcm.getMappedPositionsFor(newseq, 6); // after end of matrix + assertNull(pos); + pos = mcm.getMappedPositionsFor(newseq, 5); // at end of matrix + assertNotNull(pos); + assertEquals(pos[0],8+newseq.getStart()); + SequenceI alseq = newseq.deriveSequence(); + alseq.insertCharAt(5,'-'); + pos = mcm.getMappedPositionsFor(alseq, 5); // at end of matrix + assertNotNull(pos); + assertEquals(pos[0],8+newseq.getStart()); + + + } }