X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=514a32662fdf2318a146249c0c9346daf7e01c0f;hb=80b889f0cca49103e1b20ed806755a0719789906;hp=3ae683195bd9a2d86a0a63df7108a0daaa19389a;hpb=51ff7ec3b6914f3c69b35e91e69d10c88aaf5270;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 3ae6831..514a326 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -2047,9 +2047,23 @@ public class Alignment implements AlignmentI, AutoCloseable } @Override - public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann) + public ContactMatrixI getContactMatrixFor(AlignmentAnnotation _aa) { - return cmholder.getContactMatrixFor(ann); + ContactMatrixI cm = cmholder.getContactMatrixFor(_aa); + if (cm == null && _aa.groupRef != null) + { + cm = _aa.groupRef.getContactMatrixFor(_aa); + } + if (cm == null && _aa.sequenceRef != null) + { + cm = _aa.sequenceRef.getContactMatrixFor(_aa); + if (cm == null) + { + // TODO fix up this logic and unify with getContactListFor + cm = _aa.sequenceRef.getDatasetSequence().getContactMatrixFor(_aa); + } + } + return cm; } @Override @@ -2062,10 +2076,20 @@ 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) + if (_aa.annotations[column] != null) { - _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, column); + // sequence associated + cl = _aa.sequenceRef.getContactListFor(_aa, column); + if (cl == null && _aa.sequenceRef.getDatasetSequence() != null) + { + int spos = _aa.sequenceRef.findPosition(column); + if (spos >= _aa.sequenceRef.getStart() + && spos <= 1 + _aa.sequenceRef.getEnd()) + { + cl = _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, + spos - _aa.sequenceRef.getStart()); + } + } } } return cl; @@ -2077,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)) { ; }