From: amwaterhouse Date: Fri, 29 Jul 2005 09:48:19 +0000 (+0000) Subject: if endRes <1, calc the endRes X-Git-Tag: Release_2_03~79 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=125558efe064046d68cc2ac5d2aeeb4875198d5b;p=jalview.git if endRes <1, calc the endRes --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 34c1cd9..824a33b 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -18,8 +18,6 @@ */ package jalview.datamodel; -import MCview.*; - import jalview.analysis.*; import java.awt.*; @@ -57,10 +55,30 @@ public class Sequence implements SequenceI */ public Sequence(String name, String sequence, int start, int end) { - this.name = name; - this.sequence = sequence; - this.start = start; - this.end = end; + this.name = name; + this.sequence = sequence; + this.start = start; + this.end = end; + + if (end < 1) + { + int endRes = 0; + char ch; + for (int j = 0; j < sequence.length(); j++) + { + ch = sequence.charAt(j); + if (!jalview.util.Comparison.isGap( (ch))) + { + endRes++; + } + } + if (endRes > 0) + { + endRes += start - 1; + } + + this.end = endRes; + } setDisplayId(); }