From a573d96362b36d935d1f809a565859e6b17afef8 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 1 Jun 2018 14:59:48 +0100 Subject: [PATCH] JAL-1950 JAL-2937 allow individual groups to be rematerialised from an alignment view --- src/jalview/datamodel/AlignmentView.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index 19ddff3..a3b2c45 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -25,6 +25,7 @@ import jalview.util.ShiftList; import java.io.PrintStream; import java.util.ArrayList; +import java.util.Collection; import java.util.List; /** @@ -114,6 +115,16 @@ public class AlignmentView { return seqs.size(); } + + public SequenceGroup getNewSequenceGroup(char c) + { + SequenceGroup newsg = new SequenceGroup(sg); + for (SeqCigar seq : seqs) + { + newsg.addSequence(seq.getSeq(c), false); + } + return newsg; + } } /** @@ -1238,4 +1249,21 @@ public class AlignmentView } } + + /** + * return pruned visible sequences in each group in alignment view + * + * @param c + * @return + */ + public Collection getVisibleGroups(char c) + { + ArrayList groups = new ArrayList<>(); + for (ScGroup sc : scGroups) + { + SequenceGroup sg = sc.getNewSequenceGroup(c); + groups.add(sg); + } + return groups; + } } -- 1.7.10.2