From: Jim Procter Date: Thu, 20 Oct 2022 14:14:31 +0000 (+0100) Subject: JAL-3855 JAL-2349 AlignmentI.getContactList takes care of mapping columns to sequence... X-Git-Tag: Release_2_11_4_0~532 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b197088233e07bcdbf41a12e975185aee3efe146;p=jalview.git JAL-3855 JAL-2349 AlignmentI.getContactList takes care of mapping columns to sequence positions for sequence associated contact matrices. Need to map selected positions back for drag selects --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 3ae6831..fe65829 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -2062,10 +2062,15 @@ public class Alignment implements AlignmentI, AutoCloseable } if (cl == null && _aa.sequenceRef != null) { - cl = _aa.sequenceRef.getContactListFor(_aa, column); - if (cl == null && _aa.sequenceRef.getDatasetSequence() != null) + int spos = _aa.sequenceRef.findPosition(column) - 1; + if (spos >= _aa.sequenceRef.getStart() + && spos <= 1 + _aa.sequenceRef.getEnd()) { - _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, column); + cl = _aa.sequenceRef.getContactListFor(_aa, spos); + if (cl == null && _aa.sequenceRef.getDatasetSequence() != null) + { + _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, spos); + } } } return cl; diff --git a/src/jalview/datamodel/ContactMapHolder.java b/src/jalview/datamodel/ContactMapHolder.java index ac1b267..4b46d7d 100644 --- a/src/jalview/datamodel/ContactMapHolder.java +++ b/src/jalview/datamodel/ContactMapHolder.java @@ -28,6 +28,9 @@ public class ContactMapHolder implements ContactMapHolderI { return null; } + // TODO: could resolve sequence position to column position here + // TODO: what about for complexes - where contactMatrix may involve two or + // more sequences return cm.getContactList(column); } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index f0c2404..2149266 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -906,14 +906,30 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, System.err.println("Marking " + fr + " to " + to); for (int c = fr; c <= to; c++) { - av.getColumnSelection().addElement(c); + if (cma.sequenceRef != null) + { + int col = cma.sequenceRef.findIndex(c); + av.getColumnSelection().addElement(col); + } + else + { + av.getColumnSelection().addElement(c); + } } fr = Math.min(cXci.cStart, cXci.cEnd); to = Math.max(cXci.cStart, cXci.cEnd); System.err.println("Marking " + fr + " to " + to); for (int c = fr; c <= to; c++) { - av.getColumnSelection().addElement(c); + if (cma.sequenceRef != null) + { + int col = cma.sequenceRef.findIndex(c); + av.getColumnSelection().addElement(col); + } + else + { + av.getColumnSelection().addElement(c); + } } fr = Math.min(lastX, currentX); to = Math.max(lastX, currentX);