JAL-1950 JAL-2937 allow individual groups to be rematerialised from an alignment...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 1 Jun 2018 13:59:48 +0000 (14:59 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 1 Jun 2018 13:59:48 +0000 (14:59 +0100)
src/jalview/datamodel/AlignmentView.java

index 19ddff3..a3b2c45 100644 (file)
@@ -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<? extends AnnotatedCollectionI> getVisibleGroups(char c)
+  {
+    ArrayList<SequenceGroup> groups = new ArrayList<>();
+    for (ScGroup sc : scGroups)
+    {
+      SequenceGroup sg = sc.getNewSequenceGroup(c);
+      groups.add(sg);
+    }
+    return groups;
+  }
 }