X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=95f578051e5b41c685feb674b683b077c3df8317;hb=85299bc2db43c8b108169661ebc1c4d9b2d3d2e5;hp=4d3d5787566a502bd9d0dbe1c2edecfcd13cebef;hpb=fdde9a078d7bdb46ed9fb7fe115ea83c84a19c81;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 4d3d578..95f5780 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1830,7 +1830,13 @@ public class Alignment implements AlignmentI, AutoCloseable { return AlignmentUtils.alignCdsAsProtein(this, al); } - return AlignmentUtils.alignAs(this, al); + else if (thatIsProtein && !thisIsNucleotide) + { + // honour sense we were called - align this according to al + return AlignmentUtils.alignAs(this, al); + } + // otherwise doing a DNA to DNA alignment - so use legacy obverse sense + return AlignmentUtils.alignAs(this,al); } /** @@ -2057,7 +2063,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 +2075,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 +2087,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 +2112,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)) { ; }