From 912b741af87f3f714f9e01c5e450a2818d568317 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 20 Oct 2022 16:28:00 +0100 Subject: [PATCH] =?utf8?q?JAL-2349=20JAL-3855=20ContactListI.getPosition()=20?= =?utf8?q?to=20recover=20original=20position=20passed=20to=20ContactMatrixI.?= =?utf8?q?getContactListFor(..)=E2=80=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/datamodel/ContactListI.java | 1 - src/jalview/datamodel/ContactListImpl.java | 6 ++++++ src/jalview/datamodel/ContactListProviderI.java | 7 +++++++ src/jalview/datamodel/ContactMatrix.java | 6 ++++++ src/jalview/datamodel/SeqDistanceContactMatrix.java | 7 +++++++ src/jalview/gui/AnnotationPanel.java | 4 ++-- src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java | 6 ++++++ test/jalview/datamodel/ContactMatrixTest.java | 9 ++++++++- 8 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/jalview/datamodel/ContactListI.java b/src/jalview/datamodel/ContactListI.java index 72dbf2e..ac06adb 100644 --- a/src/jalview/datamodel/ContactListI.java +++ b/src/jalview/datamodel/ContactListI.java @@ -1,6 +1,5 @@ package jalview.datamodel; - public interface ContactListI extends ContactListProviderI { diff --git a/src/jalview/datamodel/ContactListImpl.java b/src/jalview/datamodel/ContactListImpl.java index 561048e..beb557f 100644 --- a/src/jalview/datamodel/ContactListImpl.java +++ b/src/jalview/datamodel/ContactListImpl.java @@ -21,6 +21,12 @@ public class ContactListImpl implements ContactListI } @Override + public int getPosition() + { + return clist.getPosition(); + } + + @Override public double getContactAt(int column) { return clist.getContactAt(column); diff --git a/src/jalview/datamodel/ContactListProviderI.java b/src/jalview/datamodel/ContactListProviderI.java index 37c4e07..f027e01 100644 --- a/src/jalview/datamodel/ContactListProviderI.java +++ b/src/jalview/datamodel/ContactListProviderI.java @@ -4,6 +4,13 @@ public interface ContactListProviderI { /** + * + * @return position index for this contact List (usually sequence position or + * alignment column) + */ + int getPosition(); + + /** * dimension of list where getContactAt(columnMean:" + cr.getMean(); + tooltip = "Contact from " + clist.getPosition() + ", [" + ci.cStart + + " - " + ci.cEnd + "]" + "
Mean:" + cr.getMean(); // ap.getStructureSelectionManager().mouseOverSequence(ann.sequenceRef, // new int[] {column, ci.cStart,ci.cEnd}, -1, null) diff --git a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java index 3a8e26a..8fde1e8 100644 --- a/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java +++ b/src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java @@ -126,6 +126,12 @@ public class PAEContactMatrix implements ContactMatrixI return new ContactListImpl(new ContactListProviderI() { @Override + public int getPosition() + { + return _column; + } + + @Override public int getContactHeight() { return maxcol - 1; diff --git a/test/jalview/datamodel/ContactMatrixTest.java b/test/jalview/datamodel/ContactMatrixTest.java index f0861e9..5d8b8d1 100644 --- a/test/jalview/datamodel/ContactMatrixTest.java +++ b/test/jalview/datamodel/ContactMatrixTest.java @@ -18,7 +18,8 @@ public class ContactMatrixTest /** * standard asserts for ContactMatrixI */ - public static void testContactMatrixI(ContactMatrixI cm, boolean symmetric) + public static void testContactMatrixI(ContactMatrixI cm, + boolean symmetric) { // assume contact matrix is square for text ContactListI clist = cm.getContactList(1); @@ -81,6 +82,12 @@ public class ContactMatrixTest double[] val = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 }; @Override + public int getPosition() + { + return 0; + } + + @Override public int getContactHeight() { return val.length; -- 1.7.10.2