X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=73ccdc53966e03e5303dabfa0072ed0cea2350e9;hb=eb3e681d6e82ccdd5d312d1981dfb306e7f479f0;hp=4d3d5787566a502bd9d0dbe1c2edecfcd13cebef;hpb=4b7d3640209c4434d569c746672cf9eed4250ace;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 4d3d578..73ccdc5 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -2057,7 +2057,7 @@ public class Alignment implements AlignmentI, AutoCloseable if (cm == null && _aa.sequenceRef != null) { cm = _aa.sequenceRef.getContactMatrixFor(_aa); - if (cm == null) + if (cm == null && _aa.sequenceRef.getDatasetSequence() != null) { // TODO fix up this logic and unify with getContactListFor cm = _aa.sequenceRef.getDatasetSequence().getContactMatrixFor(_aa); @@ -2069,6 +2069,11 @@ public class Alignment implements AlignmentI, AutoCloseable @Override public ContactListI getContactListFor(AlignmentAnnotation _aa, int column) { + if (_aa.annotations == null || column >= _aa.annotations.length + || column < 0) + { + return null; + } ContactListI cl = cmholder.getContactListFor(_aa, column); if (cl == null && _aa.groupRef != null) { @@ -2076,16 +2081,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 - _aa.sequenceRef.getStart()); + // sequence associated + cl = _aa.sequenceRef.getContactListFor(_aa, column); if (cl == null && _aa.sequenceRef.getDatasetSequence() != null) { - _aa.sequenceRef.getDatasetSequence().getContactListFor(_aa, - spos - _aa.sequenceRef.getStart()); + 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()); + } } } } @@ -2098,8 +2106,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)) { ; }