X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequence.java;h=2f1da7f9ad9c125d334178b5e34a4bbc40422b24;hb=f1e2d882404c5cdc821a772f0bd6103a226822ac;hp=96a2fa17b5b6c3253130b8df9552b83cfc0a2ad8;hpb=bba9e58f08fc55c0f789f8354d1444e5c5e1b0e6;p=jalview.git diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 96a2fa1..2f1da7f 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -155,8 +155,8 @@ public class Sequence extends ASequence implements SequenceI { if (name == null) { - System.err - .println("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor."); + System.err.println( + "POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor."); name = ""; } // Does sequence have the /start-end signature? @@ -1364,8 +1364,9 @@ public class Sequence extends ASequence implements SequenceI @Override public AlignmentAnnotation[] getAnnotation() { - return annotation == null ? null : annotation - .toArray(new AlignmentAnnotation[annotation.size()]); + return annotation == null ? null + : annotation + .toArray(new AlignmentAnnotation[annotation.size()]); } @Override @@ -1477,8 +1478,9 @@ public class Sequence extends ASequence implements SequenceI { if (datasetSequence == null) { - Sequence dsseq = new Sequence(getName(), AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, getSequenceAsString()), + Sequence dsseq = new Sequence(getName(), + AlignSeq.extractGaps(jalview.util.Comparison.GapChars, + getSequenceAsString()), getStart(), getEnd()); datasetSequence = dsseq; @@ -1620,7 +1622,7 @@ public class Sequence extends ASequence implements SequenceI List sfs = entry.getSequenceFeatures(); for (SequenceFeature feature : sfs) { - SequenceFeature sf[] = (mp != null) ? mp.locateFeature(feature) + SequenceFeature sf[] = (mp != null) ? mp.locateFeature(feature) : new SequenceFeature[] { new SequenceFeature(feature) }; if (sf != null) { @@ -1777,8 +1779,8 @@ public class Sequence extends ASequence implements SequenceI } } // whilst it looks like it is a primary ref, we also sanity check type - if (DBRefUtils.getCanonicalName(DBRefSource.PDB).equals( - DBRefUtils.getCanonicalName(ref.getSource()))) + if (DBRefUtils.getCanonicalName(DBRefSource.PDB) + .equals(DBRefUtils.getCanonicalName(ref.getSource()))) { // PDB dbrefs imply there should be a PDBEntry associated // TODO: tighten PDB dbrefs @@ -1821,12 +1823,11 @@ public class Sequence extends ASequence implements SequenceI endPos, types); /* - * if the start or end column is gapped, startPos or endPos may be to the - * left or right, and we may have included adjacent or enclosing features; - * remove any that are not enclosing features + * if end column is gapped, endPos may be to the right, + * and we may have included adjacent or enclosing features; + * remove any that are not enclosing, non-contact features */ - if (endPos > this.end || Comparison.isGap(sequence[fromColumn - 1]) - || Comparison.isGap(sequence[toColumn - 1])) + if (endPos > this.end || Comparison.isGap(sequence[toColumn - 1])) { ListIterator it = result.listIterator(); while (it.hasNext()) @@ -1847,6 +1848,13 @@ public class Sequence extends ASequence implements SequenceI { it.remove(); } + else if (featureEndColumn > toColumn && sf.isContactFeature()) + { + /* + * remove an enclosing feature if it is a contact feature + */ + it.remove(); + } } } }