X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequence.java;h=7efd4ae91e3ec29592f9a28ee8fa907eb3645371;hb=24e842ef4b4fa929644b6ab4f79c7b61575c7b55;hp=257c8949231bc52150b23f7b99ee6177e85d9718;hpb=09d81d7aa46a618d636a8ca3fda75d4252650564;p=jalview.git diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 257c894..7efd4ae 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -90,20 +90,30 @@ public class Sequence extends ASequence implements SequenceI */ public Sequence(String name, String sequence, int start, int end) { - this.name = name; - this.sequence = sequence.toCharArray(); - this.start = start; - this.end = end; - parseId(); - checkValidRange(); + initSeqAndName(name, sequence.toCharArray(), start, end); } public Sequence(String name, char[] sequence, int start, int end) { - this.name = name; - this.sequence = sequence; - this.start = start; - this.end = end; + initSeqAndName(name, sequence, start, end); + } + + /** + * Stage 1 constructor - assign name, sequence, and set start and end fields. + * start and end are updated values from name2 if it ends with /start-end + * + * @param name2 + * @param sequence2 + * @param start2 + * @param end2 + */ + protected void initSeqAndName(String name2, char[] sequence2, int start2, + int end2) + { + this.name = name2; + this.sequence = sequence2; + this.start = start2; + this.end = end2; parseId(); checkValidRange(); } @@ -196,7 +206,15 @@ public class Sequence extends ASequence implements SequenceI */ public Sequence(SequenceI seq, AlignmentAnnotation[] alAnnotation) { - this(seq.getName(), seq.getSequence(), seq.getStart(), seq.getEnd()); + initSeqFrom(seq, alAnnotation); + + } + + protected void initSeqFrom(SequenceI seq, + AlignmentAnnotation[] alAnnotation) + { + initSeqAndName(seq.getName(), seq.getSequence(), seq.getStart(), + seq.getEnd()); description = seq.getDescription(); if (seq.getSequenceFeatures() != null) {