From 1fa2ed36e9e3e7304d3d27866f7b1aeacf3eefb5 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 5 Apr 2016 18:25:27 +0100 Subject: [PATCH] JAL-2046 simpler deriveSequence - promote to dataset and initSeqFrom or defer to copy constructor --- src/jalview/datamodel/Sequence.java | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) 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); } /* -- 1.7.10.2