From: James Procter Date: Sun, 14 May 2023 13:24:27 +0000 (+0100) Subject: JAL-2349 fix up tests for Java 11 compatibility and require sequence associated mappa... X-Git-Tag: Release_2_11_3_0~14^2~3^2^2~30 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4080955a4825b990ebfb1df6208ee1728bea360c;p=jalview.git JAL-2349 fix up tests for Java 11 compatibility and require sequence associated mappable matrix instance to have a mapping to the sequence it is associated with. --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 5ae7195..2b331d7 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -39,6 +39,7 @@ import jalview.util.Comparison; import jalview.util.DBRefUtils; import jalview.util.MapList; import jalview.util.StringUtils; +import jalview.ws.datamodel.alphafold.MappableContactMatrix; /** * @@ -2151,6 +2152,10 @@ public class Sequence extends ASequence implements SequenceI } aa.annotations = _aa; aa.setSequenceRef(this); + if (cm instanceof MappableContactMatrix && !((MappableContactMatrix) cm).hasReferenceSeq()) + { + ((MappableContactMatrix) cm).setRefSeq(this); + } aa.createSequenceMapping(this, getStart(), false); addAlignmentAnnotation(aa); return aa; diff --git a/src/jalview/ws/datamodel/alphafold/MappableContactMatrix.java b/src/jalview/ws/datamodel/alphafold/MappableContactMatrix.java index ae2b37c..9497d85 100644 --- a/src/jalview/ws/datamodel/alphafold/MappableContactMatrix.java +++ b/src/jalview/ws/datamodel/alphafold/MappableContactMatrix.java @@ -55,7 +55,11 @@ public abstract class MappableContactMatrix> return toSeq; } - protected void setRefSeq(SequenceI _refSeq) + /** + * set the reference sequence and construct the mapping between the start-end positions of given sequence and row/columns of contact matrix + * @param _refSeq + */ + public void setRefSeq(SequenceI _refSeq) { refSeq = _refSeq; while (refSeq.getDatasetSequence() != null) diff --git a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java index d496097..d48d539 100644 --- a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java +++ b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java @@ -382,7 +382,7 @@ public class PAEContactMatrix extends MappableContactMatrix im } } } - return ContactMatrixI.super.getGroupsFor(column); + return super.getGroupsFor(column); } HashMap colorMap = new HashMap<>(); diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index 4baa384..54093ee 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -2626,6 +2626,11 @@ public class AlignmentUtilsTests && al.getAlignmentAnnotation().length == 1); AlignmentAnnotation alan = al.findAnnotations(sq, null, cm_aan.label) .iterator().next(); + ContactMatrixI t_cm = al.getContactMatrixFor(alan); + assertNotNull("No contact map for the transferred annotation row.",t_cm); + assertTrue(t_cm instanceof SeqDistanceContactMatrix); + assertTrue(((SeqDistanceContactMatrix)t_cm).hasReferenceSeq()); + ContactListI cl = al.getContactListFor(alan, 1); assertNotNull( "No contact matrix recovered after reference annotation transfer",