From: James Procter Date: Thu, 18 May 2023 18:42:19 +0000 (+0100) Subject: JAL-4134 colour by annotation needs distinct annotation elements to hold colours X-Git-Tag: Release_2_11_3_0~14^2~3^2^2~23 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bc71cfb740ebb5788ed0d2eb4de5337c1337525e;p=jalview.git JAL-4134 colour by annotation needs distinct annotation elements to hold colours --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 1ec702c..89ec5ad 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -2101,8 +2101,7 @@ public class Alignment implements AlignmentI, AutoCloseable AlignmentAnnotation aa = cmholder.addContactList(cm); Annotation _aa[] = new Annotation[getWidth()]; - Annotation dummy = new Annotation(0.0f); - for (int i = 0; i < _aa.length; _aa[i++] = dummy) + for (int i = 0; i < _aa.length; _aa[i++] = new Annotation(0.0f)) { ; } diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 2b331d7..cbd17c8 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -2145,8 +2145,8 @@ public class Sequence extends ASequence implements SequenceI AlignmentAnnotation aa = cmholder.addContactList(cm); Annotation _aa[] = new Annotation[getLength()]; - Annotation dummy = new Annotation(0.0f); - for (int i = 0; i < _aa.length; _aa[i++] = dummy) + + for (int i = 0; i < _aa.length; _aa[i++] = new Annotation(0.0f)) { ; } diff --git a/test/jalview/datamodel/PAEContactMatrixTest.java b/test/jalview/datamodel/PAEContactMatrixTest.java index 71e824e..9b95164 100644 --- a/test/jalview/datamodel/PAEContactMatrixTest.java +++ b/test/jalview/datamodel/PAEContactMatrixTest.java @@ -55,13 +55,25 @@ public class PAEContactMatrixTest assertEquals(cm.getContactAt(seq.getStart()),1d); verifyPAEmatrix(seq, aa, 0,0,4); + // Now associated with sequence not starting at 1 seq = new Sequence("Seq/5-9","ASDQE"); ContactMatrixI paematrix = new PAEContactMatrix(seq, PAEdata); aa = seq.addContactList(paematrix); + assertNotNull(aa); + // individual annotation elements need to be distinct for Matrix associated rows + Annotation ae5=aa.getAnnotationForPosition(5); + Annotation ae6=aa.getAnnotationForPosition(6); + assertNotNull(ae5); + assertNotNull(ae6); + assertTrue(ae5!=ae6); + cm = seq.getContactListFor(aa, 0); assertEquals(cm.getContactAt(0),1d); verifyPAEmatrix(seq, aa, 0, 0, 4); + + // test clustering + paematrix.setGroupSet(GroupSet.makeGroups(paematrix, 0.1f, false)); // remap - test the MappableContactMatrix.liftOver method SequenceI newseq = new Sequence("Seq","ASDQEASDQEASDQE");