import jalview.util.Platform;
import jalview.viewmodel.ViewportListenerI;
import jalview.viewmodel.ViewportRanges;
+import jalview.ws.datamodel.MappableContactMatrixI;
import jalview.ws.datamodel.alphafold.PAEContactMatrix;
/**
if (matrix.hasGroups())
{
SequenceI rseq = clicked.sequenceRef;
- BitSet grp = matrix.getGroupsFor(currentX);
+ BitSet grp = new BitSet();
+ grp.or(matrix.getGroupsFor(currentX));
// TODO: cXci needs to be mapped to real groups
for (int c = fr; c <= to; c++)
{
BitSet additionalGrp = matrix.getGroupsFor(c);
grp.or(additionalGrp);
}
+
HiddenColumns hc = av.getAlignment().getHiddenColumns();
- for (int p = grp.nextSetBit(0); p >= 0; p = grp
+ ColumnSelection cs = av.getColumnSelection();
+
+ for (int p=grp.nextSetBit(0); p >= 0; p = grp
.nextSetBit(p + 1))
{
- int offp = (rseq != null)
- ? rseq.findIndex(rseq.getStart() - 1 + p)
- : p;
-
- if (!av.hasHiddenColumns() || hc.isVisible(offp))
+ if (matrix instanceof MappableContactMatrixI)
{
- av.getColumnSelection().addElement(offp);
+ // find the end of this run of set bits
+ int nextp = grp.nextClearBit(p)-1;
+ int[] pos = ((MappableContactMatrixI)matrix).getMappedPositionsFor(rseq, p,nextp);
+ p=nextp;
+
+ if (pos!=null)
+ {
+ for (int pos_p = pos[0];pos_p<=pos[1];pos_p++)
+ {
+ int col = rseq.findIndex(pos_p)-1;
+ if (col>=0 && (!av.hasHiddenColumns() || hc.isVisible(col)))
+ {
+ cs.addElement(col);
+ }
+ }
+ }
+ } else {
+ int offp = (rseq != null)
+ ? rseq.findIndex(rseq.getStart() - 1 + p)
+ : p;
+
+ if (!av.hasHiddenColumns() || hc.isVisible(offp))
+ {
+ cs.addElement(offp);
+ }
}
}
}
if (aa != null)
{
ContactMatrixI cm = av.getContactMatrix(aa);
+ // generally, we assume cm has 1:1 mapping to annotation row - probably wrong
+ // but.. if
if (cm instanceof MappableContactMatrixI)
{
+ int[] pos;
+ // use the mappable's mapping - always the case for PAE Matrices so good
+ // for 2.11.3
MappableContactMatrixI mcm = (MappableContactMatrixI) cm;
- int pos[]=mcm.getMappedPositionsFor(rseq, colm+1);
- if (pos!=null)
+ pos = mcm.getMappedPositionsFor(rseq, colm + 1);
+ // finally, look up the position of the column
+ if (pos != null)
{
- offp=rseq.findIndex(pos[0]);
+ offp = rseq.findIndex(pos[0]);
}
+ } else {
+ offp = colm;
}
}
if (offp<=0)
MapList getMapFor(SequenceI sequenceRef);
/**
- * Locate a position in the mapped sequence for a column in the matrix - use
+ * Locate a position in the mapped sequence for a single column in the matrix.
* this to resolve positions corresponding to column clusters
*
* @param localFrame
* @return sequence position(s) corresponding to column in contact matrix
*/
int[] getMappedPositionsFor(SequenceI localFrame, int column);
+
+ /**
+ * Locate a position in the mapped sequence for a contiguous range of columns in the matrix
+ * use this to resolve positions corresponding to column clusters
+ *
+ * @param localFrame
+ * - sequence derivced from reference sequence
+ * @param column
+ * - matrix row/column
+ * @return sequence position(s) corresponding to column in contact matrix
+ */
+ int[] getMappedPositionsFor(SequenceI localFrame, int from, int to);
}