X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=514a32662fdf2318a146249c0c9346daf7e01c0f;hb=5830d3c07ab8e6597cd38b3370f0c4121348f771;hp=321eee3c5ab502839122a17286318fec97d94c6d;hpb=7420ce36f2b43280ef610e3743960207e4c2dbe3;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 321eee3..514a326 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -2050,14 +2050,14 @@ public class Alignment implements AlignmentI, AutoCloseable public ContactMatrixI getContactMatrixFor(AlignmentAnnotation _aa) { ContactMatrixI cm = cmholder.getContactMatrixFor(_aa); - if (cm==null && _aa.groupRef!=null) + if (cm == null && _aa.groupRef != null) { cm = _aa.groupRef.getContactMatrixFor(_aa); } - if (cm==null && _aa.sequenceRef!=null) + if (cm == null && _aa.sequenceRef != null) { cm = _aa.sequenceRef.getContactMatrixFor(_aa); - if (cm==null) + if (cm == null) { // TODO fix up this logic and unify with getContactListFor cm = _aa.sequenceRef.getDatasetSequence().getContactMatrixFor(_aa); @@ -2076,14 +2076,19 @@ public class Alignment implements AlignmentI, AutoCloseable } if (cl == null && _aa.sequenceRef != null) { - int spos = _aa.sequenceRef.findPosition(column); - if (spos >= _aa.sequenceRef.getStart() - && spos <= 1 + _aa.sequenceRef.getEnd()) + if (_aa.annotations[column] != null) { - cl = _aa.sequenceRef.getContactListFor(_aa, spos); + // sequence associated + cl = _aa.sequenceRef.getContactListFor(_aa, column); if (cl == null && _aa.sequenceRef.getDatasetSequence() != null) { - _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, spos); + 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()); + } } } } @@ -2096,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)) { ; }