1 import jalview.analysis.*;
2 import jalview.datamodel.*;
3 import jalview.gui.AlignFrame;
4 import jalview.gui.AlignViewport;
5 import java.util.BitSet;
6 import javax.swing.JOptionPane;
7 import groovy.swing.SwingBuilder;
8 def toselect = getFeatureInput(); // change this to select the desired feature type
14 for (ala in Jalview.getAlignframes()) {
15 def al = ala.viewport.alignment;
18 BitSet bs = new BitSet();
19 SequenceI[] seqs = al.getSequencesArray();
24 SequenceFeature[] sf = sq.getDatasetSequence().getSequenceFeatures();
27 if (sfpos!=null && sfpos.getType().equals(toselect))
30 int i=sq.findIndex(sfpos.getBegin());
31 int ist=sq.findIndex(sq.getStart());
36 int j=sq.findIndex(sfpos.getEnd());
53 if (bs.cardinality()>0)
56 ColumnSelection cs = ala.viewport.getColumnSelection();
58 cs = new ColumnSelection();
60 for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
63 ala.viewport.setColumnSelection(cs);
64 ala.alignPanel.paintAlignment(true);
65 ala.statusBar.setText("Marked "+bs.cardinality()+" columns containing features of type "+toselect)
67 ala.statusBar.setText("No features of type "+toselect+" found.");
71 return "Found a total of ${nfeat} features across ${nseq} sequences in ${nal} alignments.";
73 String getFeatureInput(){
74 def swingBuilder = new SwingBuilder();
75 def response = JOptionPane.showInputDialog(
76 null, 'Select columns by feature by type','Enter type of feature', JOptionPane.OK_OPTION)