From: Jim Procter Date: Tue, 5 Apr 2016 17:25:27 +0000 (+0100) Subject: JAL-2046 simpler deriveSequence - promote to dataset and initSeqFrom or defer to... X-Git-Tag: Release_2_10_0~249^2~31^2~9 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1fa2ed36e9e3e7304d3d27866f7b1aeacf3eefb5;p=jalview.git JAL-2046 simpler deriveSequence - promote to dataset and initSeqFrom or defer to copy constructor --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index fbe3670..d9b810d 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -1056,31 +1056,24 @@ public class Sequence extends ASequence implements SequenceI @Override public SequenceI deriveSequence() { - SequenceI seq = new Sequence(this); - if (datasetSequence != null) - { - // duplicate current sequence with same dataset - seq.setDatasetSequence(datasetSequence); - } - else + Sequence seq=null; + if (datasetSequence == null) { if (isValidDatasetSequence()) { // Use this as dataset sequence + seq = new Sequence(getName(), "", 1, -1); seq.setDatasetSequence(this); + seq.initSeqFrom(this, getAnnotation()); + return seq; } else { // Create a new, valid dataset sequence - SequenceI ds = seq; - ds.setSequence(AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, new String(sequence))); - setDatasetSequence(ds); - ds.setSequenceFeatures(getSequenceFeatures()); - seq = this; // and return this sequence as the derived sequence. + createDatasetSequence(); } } - return seq; + return new Sequence(this); } /*