From 3490e38574052242c9440d162a427f7c59234a0a Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 1 Jun 2018 14:57:08 +0100 Subject: [PATCH] JAL-1950 JAL-2937 allow copy of group without sequences being also copied to cloned group --- src/jalview/datamodel/SequenceGroup.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index cd2b137..cffe0d9 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -198,11 +198,27 @@ public class SequenceGroup implements AnnotatedCollectionI */ public SequenceGroup(SequenceGroup seqsel) { + this(seqsel, true); + } + + /** + * copy constructor + * + * @param seqsel + * @param keepsequences + * if false do not add sequences from seqsel to new instance + */ + public SequenceGroup(SequenceGroup seqsel, boolean keepsequences) + { this(); + if (seqsel != null) { sequences = new ArrayList<>(); - sequences.addAll(seqsel.sequences); + if (keepsequences) + { + sequences.addAll(seqsel.sequences); + } if (seqsel.groupName != null) { groupName = new String(seqsel.groupName); @@ -236,8 +252,10 @@ public class SequenceGroup implements AnnotatedCollectionI ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus; hmmIgnoreBelowBackground = seqsel.hmmIgnoreBelowBackground; hmmUseInfoLetterHeight = seqsel.hmmUseInfoLetterHeight; - if (seqsel.conservationData != null) + if (keepsequences && seqsel.conservationData != null) { + // todo avoid doing this if we don't actually want derived calculations + // ! recalcConservation(); // safer than // aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ?? } -- 1.7.10.2