Merge branch 'bug/JAL-2791selectVisibleFeatures' into
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 31 Oct 2017 18:12:36 +0000 (18:12 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 31 Oct 2017 18:12:36 +0000 (18:12 +0000)
features/JAL-1793VCF

Conflicts:
src/jalview/controller/AlignViewController.java

1  2 
src/jalview/controller/AlignViewController.java

@@@ -216,8 -216,9 +216,9 @@@ public class AlignViewController implem
  
    /**
     * Sets a bit in the BitSet for each column (base 0) in the sequence
-    * collection which includes the specified feature type. Returns the number of
-    * sequences which have the feature in the selected range.
+    * collection which includes a visible feature of the specified feature type.
+    * Returns the number of sequences which have the feature visible in the
+    * selected range.
     * 
     * @param featureType
     * @param sqcol
    int findColumnsWithFeature(String featureType,
            SequenceCollectionI sqcol, BitSet bs)
    {
-     FeatureRendererModel fr = (FeatureRendererModel) alignPanel
-             .getFeatureRenderer();
+     FeatureRendererModel fr = alignPanel == null ? null
+             : (FeatureRendererModel) alignPanel.getFeatureRenderer();
      List<String> visibleFeatures = fr.getDisplayedFeatureTypes();
  
      final int startColumn = sqcol.getStartRes() + 1; // converted to base 1
          List<SequenceFeature> sfs = sq.findFeatures(startColumn,
                  endColumn, featureType);
  
-         if (!sfs.isEmpty())
-         {
-           nseq++;
-         }
+         boolean found = false;
          for (SequenceFeature sf : sfs)
          {
 -          {
 -            if (!visibleFeatures.contains(sf.getType())
 -                    || fr.getColour(sf) == null) // could pull up getColour to
 -                                                 // FeatureRenderer interface
 -            {
 -              continue;
 +          { 
 +            if (!visibleFeatures.contains(sf.getType()) 
 +                    || fr.getColour(sf) == null) // could pull up getColour to FeatureRenderer interface 
 +            { 
 +              continue; 
              }
            }
+           if (!found)
+           {
+             nseq++;
+           }
+           found = true;
++
            int sfStartCol = sq.findIndex(sf.getBegin());
            int sfEndCol = sq.findIndex(sf.getEnd());