Merge branch 'develop' into features/JAL-3010ontologyFeatureSettings
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 19 Sep 2018 14:26:17 +0000 (15:26 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 19 Sep 2018 14:26:17 +0000 (15:26 +0100)
Conflicts:
src/jalview/gui/FeatureSettings.java
src/jalview/gui/FeatureTypeSettings.java

1  2 
src/jalview/bin/Jalview.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/FeatureTypeSettings.java
src/jalview/gui/SequenceFetcher.java

@@@ -70,7 -70,14 +70,14 @@@ import groovy.util.GroovyScriptEngine
  /**
   * Main class for Jalview Application <br>
   * <br>
-  * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview
+  * start with: java -classpath "$PATH_TO_LIB$/*:$PATH_TO_CLASSES$" \
+  * jalview.bin.Jalview
+  * 
+  * or on Windows: java -classpath "$PATH_TO_LIB$/*;$PATH_TO_CLASSES$" \
+  * jalview.bin.Jalview jalview.bin.Jalview
+  * 
+  * (ensure -classpath arg is quoted to avoid shell expansion of '*' and do not
+  * embellish '*' to e.g. '*.jar')
   * 
   * @author $author$
   * @version $Revision$
@@@ -149,7 -156,6 +156,6 @@@ public class Jalvie
            af.setProgressBar(MessageManager
                    .getString("status.das_features_being_retrived"), id);
            af.featureSettings_actionPerformed(null);
-           af.featureSettings.fetchDasFeatures(dasSources, true);
            af.setProgressBar(null, id);
            synchronized (us)
            {
      {
        error.printStackTrace();
        System.out.println("\nEssential logging libraries not found."
-               + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
+               + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview");
        System.exit(0);
      }
  
       * configure 'full' SO model if preferences say to, 
       * else use the default (SO Lite)
       */
 -    if (Cache.getDefault("USE_FULL_SO", false))
 +    if (Cache.getDefault("USE_FULL_SO", true))
      {
        SequenceOntologyFactory.setInstance(new SequenceOntology());
      }
@@@ -5305,6 -5305,10 +5305,10 @@@ public class AlignFrame extends GAlignF
    {
      if (avc.createGroup())
      {
+       if (applyAutoAnnotationSettings.isSelected())
+       {
+         alignPanel.updateAnnotation(true, false);
+       }
        alignPanel.alignmentChanged();
      }
    }
    }
  
    /**
 -   * Hides columns containing (or not containing) a specified feature, provided
 -   * that would not leave all columns hidden
 +   * Hides columns containing (or not containing) the specified feature(s),
 +   * provided that would not leave all columns hidden
     * 
 -   * @param featureType
     * @param columnsContaining
 +   * @param featureTypes
 +   * 
     * @return
     */
 -  public boolean hideFeatureColumns(String featureType,
 -          boolean columnsContaining)
 +  public boolean hideFeatureColumns(boolean columnsContaining,
 +          String... featureTypes)
    {
      boolean notForHiding = avc.markColumnsContainingFeatures(
 -            columnsContaining, false, false, featureType);
 +            columnsContaining, false, false, featureTypes);
      if (notForHiding)
      {
        if (avc.markColumnsContainingFeatures(!columnsContaining, false,
 -              false, featureType))
 +              false, featureTypes))
        {
          getViewport().hideSelectedColumns();
          return true;
@@@ -27,21 -27,16 +27,18 @@@ import jalview.datamodel.SequenceI
  import jalview.datamodel.features.FeatureMatcherI;
  import jalview.datamodel.features.FeatureMatcherSet;
  import jalview.datamodel.features.FeatureMatcherSetI;
 +import jalview.datamodel.ontology.OntologyI;
  import jalview.gui.Help.HelpId;
  import jalview.io.JalviewFileChooser;
  import jalview.io.JalviewFileView;
 +import jalview.io.gff.SequenceOntologyFactory;
  import jalview.schemabinding.version2.Filter;
  import jalview.schemabinding.version2.JalviewUserColours;
  import jalview.schemabinding.version2.MatcherSet;
  import jalview.schemes.FeatureColour;
  import jalview.util.MessageManager;
  import jalview.util.Platform;
- import jalview.viewmodel.AlignmentViewport;
  import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean;
- import jalview.ws.DasSequenceFeatureFetcher;
- import jalview.ws.dbsources.das.api.jalviewSourceI;
  
  import java.awt.BorderLayout;
  import java.awt.Color;
@@@ -67,7 -62,6 +64,7 @@@ import java.io.FileOutputStream
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.io.PrintWriter;
 +import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Comparator;
  import java.util.HashMap;
@@@ -77,7 -71,6 +74,6 @@@ import java.util.Iterator
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
- import java.util.Vector;
  
  import javax.help.HelpSetException;
  import javax.swing.AbstractCellEditor;
@@@ -98,22 -91,17 +94,21 @@@ import javax.swing.JScrollPane
  import javax.swing.JSlider;
  import javax.swing.JTable;
  import javax.swing.ListSelectionModel;
 +import javax.swing.RowFilter;
  import javax.swing.SwingConstants;
- import javax.swing.SwingUtilities;
  import javax.swing.event.ChangeEvent;
  import javax.swing.event.ChangeListener;
  import javax.swing.table.AbstractTableModel;
  import javax.swing.table.TableCellEditor;
  import javax.swing.table.TableCellRenderer;
  import javax.swing.table.TableColumn;
 +import javax.swing.table.TableRowSorter;
  
  public class FeatureSettings extends JPanel
          implements FeatureSettingsControllerI
  {
 +  private static final Font VERDANA_12 = new Font("Verdana", Font.PLAIN, 12);
 +
    private static final String SEQUENCE_FEATURE_COLOURS = MessageManager
            .getString("label.sequence_feature_colours");
  
  
    private static final int MIN_HEIGHT = 400;
  
-   DasSourceBrowser dassourceBrowser;
-   DasSequenceFeatureFetcher dasFeatureFetcher;
-   JPanel dasSettingsPane = new JPanel();
    final FeatureRenderer fr;
  
    public final AlignFrame af;
  
    int selectedRow = -1;
  
--  JButton fetchDAS = new JButton();
--
--  JButton saveDAS = new JButton();
--
--  JButton cancelDAS = new JButton();
--
    boolean resettingTable = false;
  
    /*
     */
    Map<String, float[]> typeWidth = null;
  
 +  /*
 +   * if true, 'child' feature types are not displayed
 +   */
 +  JCheckBox summaryView;
 +
 +  /*
 +   * those feature types that do not have a parent feature type present
 +   * (as determined by an Ontology relationship)
 +   */
 +  List<String> topLevelTypes;
 +
    /**
     * Constructor
     * 
  
      originalFilters = new HashMap<>(fr.getFeatureFilters()); // shallow copy
  
 +    topLevelTypes = new ArrayList<>();
 +
      try
      {
        jbInit();
        ex.printStackTrace();
      }
  
 +    initTable();
 +
 +    scrollPane.setViewportView(table);
 +
-     dassourceBrowser = new DasSourceBrowser(this);
-     dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER);
 +    if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder())
 +    {
 +      fr.findAllFeatures(true); // display everything!
 +    }
 +
 +    discoverAllFeatureData();
 +    final PropertyChangeListener change;
 +    final FeatureSettings fs = this;
 +    fr.addPropertyChangeListener(change = new PropertyChangeListener()
 +    {
 +      @Override
 +      public void propertyChange(PropertyChangeEvent evt)
 +      {
 +        if (!fs.resettingTable && !fs.handlingUpdate)
 +        {
 +          fs.handlingUpdate = true;
 +          fs.resetTable(null);
 +          // new groups may be added with new sequence feature types only
 +          fs.handlingUpdate = false;
 +        }
 +      }
 +    });
 +
 +    frame = new JInternalFrame();
 +    frame.setContentPane(this);
 +    if (Platform.isAMac())
 +    {
 +      Desktop.addInternalFrame(frame,
 +              MessageManager.getString("label.sequence_feature_settings"),
 +              600, 480);
 +    }
 +    else
 +    {
 +      Desktop.addInternalFrame(frame,
 +              MessageManager.getString("label.sequence_feature_settings"),
 +              600, 450);
 +    }
 +    frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
 +
 +    frame.addInternalFrameListener(
 +            new javax.swing.event.InternalFrameAdapter()
 +            {
 +              @Override
 +              public void internalFrameClosed(
 +                      javax.swing.event.InternalFrameEvent evt)
 +              {
 +                fr.removePropertyChangeListener(change);
-                 dassourceBrowser.fs = null;
 +              };
 +            });
 +    frame.setLayer(JLayeredPane.PALETTE_LAYER);
 +    inConstruction = false;
 +  }
 +
 +  /**
 +   * Constructs and configures the JTable which displays columns of data for
 +   * each feature type
 +   */
 +  protected void initTable()
 +  {
      table = new JTable()
      {
        @Override
          switch (column)
          {
          case TYPE_COLUMN:
 -          tip = JvSwingUtils.wrapTooltip(true, MessageManager
 +          /*
 +           * drag to reorder not enabled in Summary View
 +           */
 +          tip = summaryView.isSelected()
 +                  ? MessageManager.getString(
 +                          "label.feature_settings_select_columns")
 +                  : JvSwingUtils.wrapTooltip(true, MessageManager
                    .getString("label.feature_settings_click_drag"));
            break;
          case FILTER_COLUMN:
          return tip;
        }
      };
 -    table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
 -    table.setFont(new Font("Verdana", Font.PLAIN, 12));
 +    table.getTableHeader().setFont(VERDANA_12);
 +    table.setFont(VERDANA_12);
  
 -    // table.setDefaultRenderer(Color.class, new ColorRenderer());
 -    // table.setDefaultEditor(Color.class, new ColorEditor(this));
 -    //
      table.setDefaultEditor(FeatureColour.class, new ColorEditor(this));
      table.setDefaultRenderer(FeatureColour.class, new ColorRenderer());
  
          if (evt.isPopupTrigger())
          {
            Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN);
 -          popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(),
 -                  evt.getY());
 +          popupMenu(selectedRow, type, colour, evt.getX(), evt.getY());
          }
          else if (evt.getClickCount() == 2)
          {
            boolean invertSelection = evt.isAltDown();
            boolean toggleSelection = Platform.isControlDown(evt);
            boolean extendSelection = evt.isShiftDown();
 +          String[] terms = getTermsInScope(type);
            fr.ap.alignFrame.avc.markColumnsContainingFeatures(
 -                  invertSelection, extendSelection, toggleSelection, type);
 +                  invertSelection, extendSelection, toggleSelection, terms);
          }
        }
  
          {
            String type = (String) table.getValueAt(selectedRow, TYPE_COLUMN);
            Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN);
 -          popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(),
 -                  evt.getY());
 +          popupMenu(selectedRow, type, colour, evt.getX(), evt.getY());
          }
        }
      });
        public void mouseDragged(MouseEvent evt)
        {
          int newRow = table.rowAtPoint(evt.getPoint());
 -        if (newRow != selectedRow && selectedRow != -1 && newRow != -1)
 -        {
 -          /*
 -           * reposition 'selectedRow' to 'newRow' (the dragged to location)
 -           * this could be more than one row away for a very fast drag action
 -           * so just swap it with adjacent rows until we get it there
 -           */
 -          Object[][] data = ((FeatureTableModel) table.getModel())
 -                  .getData();
 -          int direction = newRow < selectedRow ? -1 : 1;
 -          for (int i = selectedRow; i != newRow; i += direction)
 -          {
 -            Object[] temp = data[i];
 -            data[i] = data[i + direction];
 -            data[i + direction] = temp;
 -          }
 -          updateFeatureRenderer(data);
 -          table.repaint();
 -          selectedRow = newRow;
 -        }
 +        dragRow(newRow);
        }
      });
 -    // table.setToolTipText(JvSwingUtils.wrapTooltip(true,
 -    // MessageManager.getString("label.feature_settings_click_drag")));
 -    scrollPane.setViewportView(table);
 +  }
  
 -    if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder())
 +  /**
 +   * Answers an array consisting of the given type, and also (if 'Summary View'
 +   * is selected), any child terms in the sequence ontology
 +   * 
 +   * @param type
 +   * @return
 +   */
 +  protected String[] getTermsInScope(String type)
 +  {
 +    if (!summaryView.isSelected())
      {
 -      fr.findAllFeatures(true); // display everything!
 +      return new String[] { type };
      }
  
 -    discoverAllFeatureData();
 -    final PropertyChangeListener change;
 -    final FeatureSettings fs = this;
 -    fr.addPropertyChangeListener(change = new PropertyChangeListener()
 -    {
 -      @Override
 -      public void propertyChange(PropertyChangeEvent evt)
 -      {
 -        if (!fs.resettingTable && !fs.handlingUpdate)
 -        {
 -          fs.handlingUpdate = true;
 -          fs.resetTable(null);
 -          // new groups may be added with new sequence feature types only
 -          fs.handlingUpdate = false;
 -        }
 -      }
 +    List<String> terms = new ArrayList<>();
 +    terms.add(type);
  
 -    });
 +    OntologyI so = SequenceOntologyFactory.getInstance();
  
 -    frame = new JInternalFrame();
 -    frame.setContentPane(this);
 -    if (Platform.isAMac())
 -    {
 -      Desktop.addInternalFrame(frame,
 -              MessageManager.getString("label.sequence_feature_settings"),
 -              600, 480);
 -    }
 -    else
 +    Object[][] data = ((FeatureTableModel) table.getModel()).getData();
 +    for (Object[] row : data)
      {
 -      Desktop.addInternalFrame(frame,
 -              MessageManager.getString("label.sequence_feature_settings"),
 -              600, 450);
 +      String type2 = (String) row[TYPE_COLUMN];
 +      if (!type2.equals(type) && so.isA(type2, type))
 +      {
 +        terms.add(type2);
 +      }
      }
 -    frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
 -
 -    frame.addInternalFrameListener(
 -            new javax.swing.event.InternalFrameAdapter()
 -            {
 -              @Override
 -              public void internalFrameClosed(
 -                      javax.swing.event.InternalFrameEvent evt)
 -              {
 -                fr.removePropertyChangeListener(change);
 -              };
 -            });
 -    frame.setLayer(JLayeredPane.PALETTE_LAYER);
 -    inConstruction = false;
 +    return terms.toArray(new String[terms.size()]);
    }
  
 -  protected void popupSort(final int rowSelected, final String type,
 -          final Object typeCol, final Map<String, float[][]> minmax, int x,
 -          int y)
 +  protected void popupMenu(final int rowSelected, final String type,
 +          final Object typeCol, int x, int y)
    {
      final FeatureColourI featureColour = (FeatureColourI) typeCol;
  
      final FeatureSettings me = this;
      scr.addActionListener(new ActionListener()
      {
        @Override
        public void actionPerformed(ActionEvent e)
        {
 -        me.af.avc
 -                .sortAlignmentByFeatureScore(Arrays.asList(new String[]
 -                { type }));
 +        String[] types = getTermsInScope(type);
 +        me.af.avc.sortAlignmentByFeatureScore(Arrays.asList(types));
        }
 -
      });
      JMenuItem dens = new JMenuItem(
              MessageManager.getString("label.sort_by_density"));
      dens.addActionListener(new ActionListener()
      {
        @Override
        public void actionPerformed(ActionEvent e)
        {
 -        me.af.avc
 -                .sortAlignmentByFeatureDensity(Arrays.asList(new String[]
 -                { type }));
 +        String[] types = getTermsInScope(type);
 +        me.af.avc.sortAlignmentByFeatureDensity(Arrays.asList(types));
        }
 -
      });
      men.add(dens);
  
            }
          }
        }
 -
      });
  
      JMenuItem selCols = new JMenuItem(
        @Override
        public void actionPerformed(ActionEvent arg0)
        {
 +        String[] types = getTermsInScope(type);
          fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false,
 -                false, type);
 +                false, types);
        }
      });
      JMenuItem clearCols = new JMenuItem(MessageManager
        @Override
        public void actionPerformed(ActionEvent arg0)
        {
 +        String[] types = getTermsInScope(type);
          fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false,
 -                false, type);
 +                false, types);
        }
      });
      JMenuItem hideCols = new JMenuItem(
        @Override
        public void actionPerformed(ActionEvent arg0)
        {
 -        fr.ap.alignFrame.hideFeatureColumns(type, true);
 +        String[] types = getTermsInScope(type);
 +        fr.ap.alignFrame.hideFeatureColumns(true, types);
        }
      });
      JMenuItem hideOtherCols = new JMenuItem(
        @Override
        public void actionPerformed(ActionEvent arg0)
        {
 -        fr.ap.alignFrame.hideFeatureColumns(type, false);
 +        String[] types = getTermsInScope(type);
 +        fr.ap.alignFrame.hideFeatureColumns(false, types);
        }
      });
      men.add(selCols);
         */
        Set<String> types = seq.getFeatures().getFeatureTypesForGroups(true,
                visibleGroups.toArray(new String[visibleGroups.size()]));
 +
        for (String type : types)
        {
          displayableTypes.add(type);
        }
      }
  
 +    /*
 +     * enable 'Summary View' if some types are sub-types of others
 +     */
 +    Set<String> parents = SequenceOntologyFactory.getInstance()
 +            .getParentTerms(displayableTypes);
 +    summaryView.setEnabled(parents.size() < displayableTypes.size());
 +
      Object[][] data = new Object[displayableTypes.size()][COLUMN_COUNT];
      int dataIndex = 0;
  
          {
            continue;
          }
 -
          data[dataIndex][TYPE_COLUMN] = type;
          data[dataIndex][COLOUR_COLUMN] = fr.getFeatureStyle(type);
          FeatureMatcherSetI featureFilter = fr.getFeatureFilter(type);
        updateOriginalData(data);
      }
  
 -    table.setModel(new FeatureTableModel(data));
 +    /*
 +     * recreate the table model
 +     */
 +    FeatureTableModel dataModel = new FeatureTableModel(data);
 +    table.setModel(dataModel);
 +
 +    /*
 +     * we want to be able to filter out rows for sub-types, but not to sort 
 +     * rows, so have to add a RowFilter to a disabled TableRowSorter (!)
 +     */
 +    final TableRowSorter<FeatureTableModel> sorter = new TableRowSorter<>(
 +            dataModel);
 +    for (int i = 0; i < table.getColumnCount(); i++)
 +    {
 +      sorter.setSortable(i, false);
 +    }
 +
 +    /*
 +     * filter rows to only top-level Ontology types if requested
 +     */
 +    sorter.setRowFilter(new RowFilter<FeatureTableModel, Integer>()
 +    {
 +      @Override
 +      public boolean include(
 +              Entry<? extends FeatureTableModel, ? extends Integer> entry)
 +      {
 +        if (!summaryView.isSelected())
 +        {
 +          return true;
 +        }
 +        int row = entry.getIdentifier(); // this is model, not view, row number
 +        String featureType = (String) entry.getModel().getData()[row][TYPE_COLUMN];
 +        return parents.contains(featureType);
 +      }
 +    });
 +    table.setRowSorter(sorter);
 +
      table.getColumnModel().getColumn(0).setPreferredWidth(200);
  
      groupPanel.setLayout(
      JPanel settingsPane = new JPanel();
      settingsPane.setLayout(new BorderLayout());
  
-     dasSettingsPane.setLayout(new BorderLayout());
      JPanel bigPanel = new JPanel();
      bigPanel.setLayout(new BorderLayout());
  
        }
      });
  
 +    summaryView = new JCheckBox(
 +            MessageManager.getString("label.summary_view"));
 +    summaryView
 +            .setToolTipText(
 +                    MessageManager.getString("label.summary_view_tip"));
 +    summaryView.addActionListener(new ActionListener()
 +    {
 +      @Override
 +      public void actionPerformed(ActionEvent e)
 +      {
 +        resetTable(null);
 +      }
 +    });
 +
      transparency.setMaximum(70);
      transparency.setToolTipText(
              MessageManager.getString("label.transparency_tip"));
-     fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
-     fetchDAS.addActionListener(new ActionListener()
-     {
-       @Override
-       public void actionPerformed(ActionEvent e)
-       {
-         fetchDAS_actionPerformed(e);
-       }
-     });
-     saveDAS.setText(MessageManager.getString("action.save_as_default"));
-     saveDAS.addActionListener(new ActionListener()
-     {
-       @Override
-       public void actionPerformed(ActionEvent e)
-       {
-         saveDAS_actionPerformed(e);
-       }
-     });
-     JPanel dasButtonPanel = new JPanel();
-     dasButtonPanel.setBorder(BorderFactory.createEtchedBorder());
-     dasSettingsPane.setBorder(null);
-     cancelDAS.setEnabled(false);
-     cancelDAS.setText(MessageManager.getString("action.cancel_fetch"));
-     cancelDAS.addActionListener(new ActionListener()
-     {
-       @Override
-       public void actionPerformed(ActionEvent e)
-       {
-         cancelDAS_actionPerformed(e);
-       }
-     });
  
 -    JPanel transPanel = new JPanel(new GridLayout(1, 2));
 -    bigPanel.add(transPanel, BorderLayout.SOUTH);
 +    JPanel lowerPanel = new JPanel(new GridLayout(1, 2));
 +    bigPanel.add(lowerPanel, BorderLayout.SOUTH);
  
      JPanel transbuttons = new JPanel(new GridLayout(5, 1));
      transbuttons.add(optimizeOrder);
      transbuttons.add(sortByScore);
      transbuttons.add(sortByDens);
      transbuttons.add(help);
 +    JPanel transPanel = new JPanel(new GridLayout(3, 1));
 +    transPanel.add(summaryView);
 +    transPanel.add(new JLabel(" Colour transparency" + ":"));
      transPanel.add(transparency);
 -    transPanel.add(transbuttons);
 +    lowerPanel.add(transPanel);
 +    lowerPanel.add(transbuttons);
  
      JPanel buttonPanel = new JPanel();
      buttonPanel.add(ok);
      buttonPanel.add(loadColours);
      buttonPanel.add(saveColours);
      bigPanel.add(scrollPane, BorderLayout.CENTER);
-     dasSettingsPane.add(dasButtonPanel, BorderLayout.SOUTH);
-     dasButtonPanel.add(fetchDAS);
-     dasButtonPanel.add(cancelDAS);
-     dasButtonPanel.add(saveDAS);
      settingsPane.add(bigPanel, BorderLayout.CENTER);
      settingsPane.add(buttonPanel, BorderLayout.SOUTH);
      this.add(settingsPane);
    }
  
-   public void fetchDAS_actionPerformed(ActionEvent e)
-   {
-     fetchDAS.setEnabled(false);
-     cancelDAS.setEnabled(true);
-     dassourceBrowser.setGuiEnabled(false);
-     Vector<jalviewSourceI> selectedSources = dassourceBrowser
-             .getSelectedSources();
-     doDasFeatureFetch(selectedSources, true, true);
-   }
-   /**
-    * get the features from selectedSources for all or the current selection
-    * 
-    * @param selectedSources
-    * @param checkDbRefs
-    * @param promptFetchDbRefs
-    */
-   private void doDasFeatureFetch(List<jalviewSourceI> selectedSources,
-           boolean checkDbRefs, boolean promptFetchDbRefs)
-   {
-     SequenceI[] dataset, seqs;
-     int iSize;
-     AlignmentViewport vp = af.getViewport();
-     if (vp.getSelectionGroup() != null
-             && vp.getSelectionGroup().getSize() > 0)
-     {
-       iSize = vp.getSelectionGroup().getSize();
-       dataset = new SequenceI[iSize];
-       seqs = vp.getSelectionGroup().getSequencesInOrder(vp.getAlignment());
-     }
-     else
-     {
-       iSize = vp.getAlignment().getHeight();
-       seqs = vp.getAlignment().getSequencesArray();
-     }
-     dataset = new SequenceI[iSize];
-     for (int i = 0; i < iSize; i++)
-     {
-       dataset[i] = seqs[i].getDatasetSequence();
-     }
-     cancelDAS.setEnabled(true);
-     dasFeatureFetcher = new jalview.ws.DasSequenceFeatureFetcher(dataset,
-             this, selectedSources, checkDbRefs, promptFetchDbRefs);
-     af.getViewport().setShowSequenceFeatures(true);
-     af.showSeqFeatures.setSelected(true);
-   }
-   /**
-    * blocking call to initialise the das source browser
-    */
-   public void initDasSources()
-   {
-     dassourceBrowser.initDasSources();
-   }
-   /**
-    * examine the current list of das sources and return any matching the given
-    * nicknames in sources
-    * 
-    * @param sources
-    *          Vector of Strings to resolve to DAS source nicknames.
-    * @return sources that are present in source list.
-    */
-   public List<jalviewSourceI> resolveSourceNicknames(Vector<String> sources)
-   {
-     return dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
-   }
-   /**
-    * get currently selected das sources. ensure you have called initDasSources
-    * before calling this.
-    * 
-    * @return vector of selected das source nicknames
-    */
-   public Vector<jalviewSourceI> getSelectedSources()
-   {
-     return dassourceBrowser.getSelectedSources();
-   }
-   /**
-    * properly initialise DAS fetcher and then initiate a new thread to fetch
-    * features from the named sources (rather than any turned on by default)
-    * 
-    * @param sources
-    * @param block
-    *          if true then runs in same thread, otherwise passes to the Swing
-    *          executor
-    */
-   public void fetchDasFeatures(Vector<String> sources, boolean block)
-   {
-     initDasSources();
-     List<jalviewSourceI> resolved = dassourceBrowser.sourceRegistry
-             .resolveSourceNicknames(sources);
-     if (resolved.size() == 0)
-     {
-       resolved = dassourceBrowser.getSelectedSources();
-     }
-     if (resolved.size() > 0)
-     {
-       final List<jalviewSourceI> dassources = resolved;
-       fetchDAS.setEnabled(false);
-       // cancelDAS.setEnabled(true); doDasFetch does this.
-       Runnable fetcher = new Runnable()
-       {
-         @Override
-         public void run()
-         {
-           doDasFeatureFetch(dassources, true, false);
-         }
-       };
-       if (block)
-       {
-         fetcher.run();
-       }
-       else
-       {
-         SwingUtilities.invokeLater(fetcher);
-       }
-     }
-   }
-   public void saveDAS_actionPerformed(ActionEvent e)
-   {
-     dassourceBrowser
-             .saveProperties(jalview.bin.Cache.applicationProperties);
-   }
-   public void complete()
-   {
-     fetchDAS.setEnabled(true);
-     cancelDAS.setEnabled(false);
-     dassourceBrowser.setGuiEnabled(true);
-   }
-   public void cancelDAS_actionPerformed(ActionEvent e)
-   {
-     if (dasFeatureFetcher != null)
-     {
-       dasFeatureFetcher.cancel();
-     }
-     complete();
-   }
-   public void noDasSourceActive()
-   {
-     complete();
-     JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
-             MessageManager.getString("label.no_das_sources_selected_warn"),
-             MessageManager.getString("label.no_das_sources_selected_title"),
-             JvOptionPane.DEFAULT_OPTION, JvOptionPane.INFORMATION_MESSAGE);
-   }
 +  /**
 +   * Reorders features by 'dragging' selectedRow to 'newRow'
 +   * 
 +   * @param newRow
 +   */
 +  protected void dragRow(int newRow)
 +  {
 +    if (summaryView.isSelected())
 +    {
 +      // no drag while in summary view
 +      return;
 +    }
 +
 +    if (newRow != selectedRow && selectedRow != -1 && newRow != -1)
 +    {
 +      /*
 +       * reposition 'selectedRow' to 'newRow' (the dragged to location)
 +       * this could be more than one row away for a very fast drag action
 +       * so just swap it with adjacent rows until we get it there
 +       */
 +      Object[][] data = ((FeatureTableModel) table.getModel())
 +              .getData();
 +      int direction = newRow < selectedRow ? -1 : 1;
 +      for (int i = selectedRow; i != newRow; i += direction)
 +      {
 +        Object[] temp = data[i];
 +        data[i] = data[i + direction];
 +        data[i + direction] = temp;
 +      }
 +      updateFeatureRenderer(data);
 +      table.repaint();
 +      selectedRow = newRow;
 +    }
 +  }
 +
 +  protected void refreshTable()
 +  {
 +    Object[][] data = ((FeatureTableModel) table.getModel()).getData();
 +    for (Object[] row : data)
 +    {
 +      String type = (String) row[TYPE_COLUMN];
 +      FeatureColourI colour = fr.getFeatureColours().get(type);
 +      FeatureMatcherSetI filter = fr.getFeatureFilter(type);
 +      if (filter == null)
 +      {
 +        filter = new FeatureMatcherSet();
 +      }
 +      row[COLOUR_COLUMN] = colour;
 +      row[FILTER_COLUMN] = filter;
 +    }
 +    repaint();
 +  }
 +
    // ///////////////////////////////////////////////////////////////////////
    // http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    // ///////////////////////////////////////////////////////////////////////
        return v == null ? null : v.getClass();
      }
  
 +    /**
 +     * Answers true for all columns except Feature Type
 +     */
      @Override
      public boolean isCellEditable(int row, int col)
      {
 -      return col == 0 ? false : true;
 +      return col != TYPE_COLUMN;
      }
  
 +    /**
 +     * Sets the value in the model for a given row and column. If Visibility
 +     * (Show/Hide) is being set, and the table is in Summary View, then it is
 +     * set also on any sub-types of the row's feature type.
 +     */
      @Override
      public void setValueAt(Object value, int row, int col)
      {
        data[row][col] = value;
        fireTableCellUpdated(row, col);
 +      if (summaryView.isSelected() && col == SHOW_COLUMN)
 +      {
 +        setSubtypesVisibility(row, (Boolean) value);
 +      }
        updateFeatureRenderer(data);
      }
  
 +    /**
 +     * Sets the visibility of any feature types which are sub-types of the type
 +     * in the given row of the table
 +     * 
 +     * @param row
 +     * @param value
 +     */
 +    protected void setSubtypesVisibility(int row, Boolean value)
 +    {
 +      String type = (String) data[row][TYPE_COLUMN];
 +      OntologyI so = SequenceOntologyFactory.getInstance();
 +
 +      for (int r = 0; r < data.length; r++)
 +      {
 +        if (r != row)
 +        {
 +          String type2 = (String) data[r][TYPE_COLUMN];
 +          if (so.isA(type2, type))
 +          {
 +            data[r][SHOW_COLUMN] = value;
 +            fireTableCellUpdated(r, SHOW_COLUMN);
 +          }
 +        }
 +      }
 +    }
    }
  
    class ColorRenderer extends JLabel implements TableCellRenderer
  
      String type;
  
 -    JButton button;
 +    JButton colourButton;
  
      JColorChooser colorChooser;
  
        // which is a button.
        // This button brings up the color chooser dialog,
        // which is the editor from the user's point of view.
 -      button = new JButton();
 -      button.setActionCommand(EDIT);
 -      button.addActionListener(this);
 -      button.setBorderPainted(false);
 +      colourButton = new JButton();
 +      colourButton.setActionCommand(EDIT);
 +      colourButton.addActionListener(this);
 +      colourButton.setBorderPainted(false);
        // Set up the dialog that the button brings up.
        colorChooser = new JColorChooser();
 -      dialog = JColorChooser.createDialog(button,
 +      dialog = JColorChooser.createDialog(colourButton,
                MessageManager.getString("label.select_colour"), true, // modal
                colorChooser, this, // OK button handler
                null); // no CANCEL button handler
          if (currentColor.isSimpleColour())
          {
            // bring up simple color chooser
 -          button.setBackground(currentColor.getColour());
 +          colourButton.setBackground(currentColor.getColour());
            colorChooser.setColor(currentColor.getColour());
            dialog.setVisible(true);
          }
          {
            // bring up graduated chooser.
            chooser = new FeatureTypeSettings(me.fr, type);
 -          /**
 -           * @j2sNative
 -           */
 -          {
 -            chooser.setRequestFocusEnabled(true);
 -            chooser.requestFocus();
 -          }
 +          chooser.setRequestFocusEnabled(true);
 +          chooser.requestFocus();
            chooser.addActionListener(this);
-           chooser.showTab(true);
+           // Make the renderer reappear.
+           fireEditingStopped();
          }
-         // Make the renderer reappear.
-         fireEditingStopped();
        }
        else
        {
             * (or filters!) are already set in FeatureRenderer, so just
             * update table data without triggering updateFeatureRenderer
             */
 -          currentColor = fr.getFeatureColours().get(type);
 -          FeatureMatcherSetI currentFilter = me.fr.getFeatureFilter(type);
 -          if (currentFilter == null)
 -          {
 -            currentFilter = new FeatureMatcherSet();
 -          }
 -          Object[] data = ((FeatureTableModel) table.getModel())
 -                  .getData()[rowSelected];
 -          data[COLOUR_COLUMN] = currentColor;
 -          data[FILTER_COLUMN] = currentFilter;
 +          refreshTable();
          }
          fireEditingStopped();
          me.table.validate();
        currentColor = (FeatureColourI) value;
        this.rowSelected = row;
        type = me.table.getValueAt(row, TYPE_COLUMN).toString();
 -      button.setOpaque(true);
 -      button.setBackground(me.getBackground());
 +      colourButton.setOpaque(true);
 +      colourButton.setBackground(me.getBackground());
        if (!currentColor.isSimpleColour())
        {
          JLabel btn = new JLabel();
 -        btn.setSize(button.getSize());
 +        btn.setSize(colourButton.getSize());
          FeatureSettings.renderGraduatedColor(btn, currentColor);
 -        button.setBackground(btn.getBackground());
 -        button.setIcon(btn.getIcon());
 -        button.setText(btn.getText());
 +        colourButton.setBackground(btn.getBackground());
 +        colourButton.setIcon(btn.getIcon());
 +        colourButton.setText(btn.getText());
        }
        else
        {
 -        button.setText("");
 -        button.setIcon(null);
 -        button.setBackground(currentColor.getColour());
 +        colourButton.setText("");
 +        colourButton.setIcon(null);
 +        colourButton.setBackground(currentColor.getColour());
        }
 -      return button;
 +      return colourButton;
      }
    }
  
  
      String type;
  
 -    JButton button;
 +    JButton filterButton;
  
      protected static final String EDIT = "edit";
  
      public FilterEditor(FeatureSettings me)
      {
        this.me = me;
 -      button = new JButton();
 -      button.setActionCommand(EDIT);
 -      button.addActionListener(this);
 -      button.setBorderPainted(false);
 +      filterButton = new JButton();
 +      filterButton.setActionCommand(EDIT);
 +      filterButton.addActionListener(this);
 +      filterButton.setBorderPainted(false);
      }
  
      /**
      @Override
      public void actionPerformed(ActionEvent e)
      {
 -      if (button == e.getSource())
 +      if (filterButton == e.getSource())
        {
          FeatureTypeSettings chooser = new FeatureTypeSettings(me.fr, type);
          chooser.addActionListener(this);
                    chooser.getWidth(), chooser.getHeight());
            chooser.validate();
          }
-         chooser.showTab(false);
          fireEditingStopped();
        }
        else if (e.getSource() instanceof Component)
        {
 -
          /*
           * after OK in variable colour dialog, any changes to filter
           * (or colours!) are already set in FeatureRenderer, so just
           * update table data without triggering updateFeatureRenderer
           */
 -        FeatureColourI currentColor = fr.getFeatureColours().get(type);
 -        currentFilter = me.fr.getFeatureFilter(type);
 -        if (currentFilter == null)
 -        {
 -          currentFilter = new FeatureMatcherSet();
 -        }
 -        Object[] data = ((FeatureTableModel) table.getModel())
 -                .getData()[rowSelected];
 -        data[COLOUR_COLUMN] = currentColor;
 -        data[FILTER_COLUMN] = currentFilter;
 +        refreshTable();
          fireEditingStopped();
          me.table.validate();
        }
        currentFilter = (FeatureMatcherSetI) value;
        this.rowSelected = row;
        type = me.table.getValueAt(row, TYPE_COLUMN).toString();
 -      button.setOpaque(true);
 -      button.setBackground(me.getBackground());
 -      button.setText(currentFilter.toString());
 -      button.setToolTipText(currentFilter.toString());
 -      button.setIcon(null);
 -      return button;
 +      filterButton.setOpaque(true);
 +      filterButton.setBackground(me.getBackground());
 +      filterButton.setText(currentFilter.toString());
 +      filterButton.setToolTipText(currentFilter.toString());
 +      filterButton.setIcon(null);
 +      return filterButton;
      }
    }
  }
  
  class FeatureIcon implements Icon
  {
 +  private static final Font VERDANA_9 = new Font("Verdana", Font.PLAIN, 9);
 +
    FeatureColourI gcol;
  
    Color backg;
        // need an icon here.
        g.setColor(gcol.getMaxColour());
  
 -      g.setFont(new Font("Verdana", Font.PLAIN, 9));
 +      g.setFont(VERDANA_9);
  
        // g.setFont(g.getFont().deriveFont(
        // AffineTransform.getScaleInstance(
@@@ -29,7 -29,6 +29,7 @@@ import jalview.datamodel.features.Featu
  import jalview.datamodel.features.FeatureMatcherI;
  import jalview.datamodel.features.FeatureMatcherSet;
  import jalview.datamodel.features.FeatureMatcherSetI;
 +import jalview.io.gff.SequenceOntologyFactory;
  import jalview.schemes.FeatureColour;
  import jalview.util.ColorUtils;
  import jalview.util.MessageManager;
@@@ -50,11 -49,7 +50,11 @@@ import java.awt.event.MouseAdapter
  import java.awt.event.MouseEvent;
  import java.text.DecimalFormat;
  import java.util.ArrayList;
 +import java.util.Collections;
 +import java.util.HashMap;
  import java.util.List;
 +import java.util.Map;
 +import java.util.Map.Entry;
  
  import javax.swing.BorderFactory;
  import javax.swing.BoxLayout;
@@@ -67,7 -62,6 +67,6 @@@ import javax.swing.JLabel
  import javax.swing.JPanel;
  import javax.swing.JRadioButton;
  import javax.swing.JSlider;
- import javax.swing.JTabbedPane;
  import javax.swing.JTextField;
  import javax.swing.SwingConstants;
  import javax.swing.border.LineBorder;
@@@ -112,7 -106,8 +111,8 @@@ public class FeatureTypeSettings extend
    /*
     * FeatureRenderer holds colour scheme and filters for feature types
     */
-   private final FeatureRenderer fr; // todo refactor to allow interface type here
+   private final FeatureRenderer fr; // todo refactor to allow interface type
+                                     // here
  
    /*
     * the view panel to update when settings change
  
    /*
     * the colour and filters to reset to on Cancel
 +   * (including feature sub-types if modified)
     */
 -  private final FeatureColourI originalColour;
 +  private Map<String, FeatureColourI> originalColours;
  
 -  private final FeatureMatcherSetI originalFilter;
 +  private Map<String, FeatureMatcherSetI> originalFilters;
  
    /*
     * set flag to true when setting values programmatically,
  
    private JRadioButton graduatedColour = new JRadioButton();
  
-   private JPanel singleColour = new JPanel();
+   /**
+    * colours and filters are shown in tabbed view or single content pane
+    */
+   JPanel coloursPanel, filtersPanel;
+   JPanel singleColour = new JPanel();
  
    private JPanel minColour = new JPanel();
  
     */
    private List<FeatureMatcherI> filters;
  
-   // set white normally, black to debug layout
-   private Color debugBorderColour = Color.white;
    private JPanel chooseFiltersPanel;
  
-   private JTabbedPane tabbedPane;
 +  /*
 +   * feature types present in Feature Renderer which are
 +   * sub-types of the one this editor is acting on
 +   */
 +  private final List<String> subTypes;
 +
 +  /*
 +   * if true, filter or colour settings are also applied to 
 +   * any feature sub-types in the Sequence Ontology
 +   */
 +  private boolean applyFiltersToSubtypes;
 +
 +  private boolean applyColourToSubtypes;
 +
    /**
     * Constructor
     * 
      this.fr = frender;
      this.featureType = theType;
      ap = fr.ap;
 -    originalFilter = fr.getFeatureFilter(theType);
 -    originalColour = fr.getFeatureColours().get(theType);
 +
 +    /*
 +     * determine sub-types (if any) of this feature type
 +     */
 +    List<String> types = fr.getRenderOrder();
 +    subTypes = SequenceOntologyFactory.getInstance()
 +            .getChildTerms(this.featureType, types);
 +    Collections.sort(subTypes); // sort for ease of reading in tooltip
 +
 +    /*
 +     * save original colours and filters for this feature type
 +     * and any sub-types, to restore on Cancel
 +     */
 +    originalFilters = new HashMap<>();
 +    originalFilters.put(theType, fr.getFeatureFilter(theType));
 +    originalColours = new HashMap<>();
 +    originalColours.put(theType, fr.getFeatureColours().get(theType));
 +    for (String child : subTypes)
 +    {
 +      originalFilters.put(child, fr.getFeatureFilter(child));
 +      originalColours.put(child, fr.getFeatureColours().get(child));
 +    }
  
      adjusting = true;
  
      String title = MessageManager
              .formatMessage("label.display_settings_for", new String[]
              { theType });
-     initDialogFrame(this, true, blocking, title, 600, 360);
+     initDialogFrame(this, true, blocking, title, 500, 500);
  
      waitForInput();
    }
    private void initialise()
    {
      this.setLayout(new BorderLayout());
-     tabbedPane = new JTabbedPane();
-     this.add(tabbedPane, BorderLayout.CENTER);
  
      /*
       * an ActionListener that applies colour changes
      };
  
      /*
-      * first tab: colour options
+      * first panel/tab: colour options
       */
      JPanel coloursPanel = initialiseColoursPanel();
-     tabbedPane.addTab(MessageManager.getString("action.colour"),
-             coloursPanel);
+     this.add(coloursPanel, BorderLayout.NORTH);
  
      /*
-      * second tab: filter options
+      * second panel/tab: filter options
       */
      JPanel filtersPanel = initialiseFiltersPanel();
-     tabbedPane.addTab(MessageManager.getString("label.filters"),
-             filtersPanel);
+     this.add(filtersPanel, BorderLayout.CENTER);
  
      JPanel okCancelPanel = initialiseOkCancelPanel();
  
    private JPanel initialiseColoursPanel()
    {
      JPanel colourByPanel = new JPanel();
+     colourByPanel.setBackground(Color.white);
      colourByPanel.setLayout(new BoxLayout(colourByPanel, BoxLayout.Y_AXIS));
+     JvSwingUtils.createTitledBorder(colourByPanel,
+             MessageManager.getString("action.colour"), true);
  
      /*
 +     * option to apply colour to sub-types as well (if there are any)
 +     */
 +    if (!subTypes.isEmpty())
 +    {
 +      applyColourToSubtypes = false;
 +      colourByPanel.add(initSubtypesPanel(false));
 +    }
 +
 +    /*
       * simple colour radio button and colour picker
       */
      JPanel simpleColourPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
      simpleColourPanel.setBackground(Color.white);
-     JvSwingUtils.createTitledBorder(simpleColourPanel,
-             MessageManager.getString("label.simple"), true);
+ //    JvSwingUtils.createTitledBorder(simpleColourPanel,
+ //            MessageManager.getString("label.simple"), true);
      colourByPanel.add(simpleColourPanel);
  
      simpleColour = new JRadioButton(
        }
  
      });
-     
      singleColour.setFont(JvSwingUtils.getLabelFont());
      singleColour.setBorder(BorderFactory.createLineBorder(Color.black));
      singleColour.setPreferredSize(new Dimension(40, 20));
      return colourByPanel;
    }
  
 +  /**
 +   * Constructs and returns a panel with a checkbox for the option to apply any
 +   * changes also to sub-types of the feature type
 +   * 
 +   * @return
 +   */
 +  protected JPanel initSubtypesPanel(final boolean forFilters)
 +  {
 +    JPanel toSubtypes = new JPanel(new FlowLayout(FlowLayout.LEFT));
 +    toSubtypes.setBackground(Color.WHITE);
 +    JCheckBox applyToSubtypesCB = new JCheckBox(MessageManager
 +            .formatMessage("label.apply_to_subtypes", featureType));
 +    applyToSubtypesCB.setToolTipText(getSubtypesTooltip());
 +    applyToSubtypesCB.addActionListener(new ActionListener()
 +    {
 +      /*
 +       * reset and reapply settings on toggle of checkbox
 +       */
 +      @Override
 +      public void actionPerformed(ActionEvent e)
 +      {
 +        if (forFilters)
 +        {
 +          applyFiltersToSubtypes = applyToSubtypesCB.isSelected();
 +          restoreOriginalFilters();
 +          filtersChanged();
 +        }
 +        else
 +        {
 +          applyColourToSubtypes = applyToSubtypesCB.isSelected();
 +          restoreOriginalColours();
 +          colourChanged(true);
 +        }
 +      }
 +    });
 +    toSubtypes.add(applyToSubtypesCB);
 +
 +    return toSubtypes;
 +  }
 +
    private void showColourChooser(JPanel colourPanel, String key)
    {
      Color col = JColorChooser.showDialog(this,
    }
  
    /**
-    * Constructs and sets the selected colour options as the colour for the feature
-    * type, and repaints the alignment, and optionally the Overview and/or
-    * structure viewer if open
+    * Constructs and sets the selected colour options as the colour for the
+    * feature type, and repaints the alignment, and optionally the Overview
+    * and/or structure viewer if open
     * 
     * @param updateStructsAndOverview
     */
      FeatureColourI acg = makeColourFromInputs();
  
      /*
 -     * save the colour, and repaint stuff
 +     * save the colour, and set on subtypes if selected
       */
      fr.setColour(featureType, acg);
 +    if (applyColourToSubtypes)
 +    {
 +      for (String child : subTypes)
 +      {
 +        fr.setColour(child, acg);
 +      }
 +    }
 +    refreshFeatureSettings();
      ap.paintAlignment(updateStructsAndOverview, updateStructsAndOverview);
  
      updateColoursTab();
    @Override
    protected void raiseClosed()
    {
 +    refreshFeatureSettings();
 +  }
 +
 +  protected void refreshFeatureSettings()
 +  {
      if (this.featureSettings != null)
      {
 -      featureSettings.actionPerformed(new ActionEvent(this, 0, "CLOSED"));
 +      featureSettings.actionPerformed(new ActionEvent(this, 0, "REFRESH"));
      }
    }
  
  
    /**
     * Action on Cancel is to restore colour scheme and filters as they were when
 -   * the dialog was opened
 +   * the dialog was opened (including any feature sub-types that may have been
 +   * changed)
     */
    @Override
    public void cancelPressed()
    {
 -    fr.setColour(featureType, originalColour);
 -    fr.setFeatureFilter(featureType, originalFilter);
 +    restoreOriginalColours();
 +    restoreOriginalFilters();
      ap.paintAlignment(true, true);
    }
  
 +  protected void restoreOriginalFilters()
 +  {
 +    for (Entry<String, FeatureMatcherSetI> entry : originalFilters
 +            .entrySet())
 +    {
 +      fr.setFeatureFilter(entry.getKey(), entry.getValue());
 +    }
 +  }
 +
 +  protected void restoreOriginalColours()
 +  {
 +    for (Entry<String, FeatureColourI> entry : originalColours.entrySet())
 +    {
 +      fr.setColour(entry.getKey(), entry.getValue());
 +    }
 +  }
 +
    /**
     * Action on text entry of a threshold value
     */
  
    /**
     * Converts the slider value to its absolute value by dividing by the
-    * scaleFactor. Rounding errors are squashed by forcing min/max of slider range
-    * to the actual min/max of feature score range
+    * scaleFactor. Rounding errors are squashed by forcing min/max of slider
+    * range to the actual min/max of feature score range
     * 
     * @return
     */
    }
  
    /**
-    * A helper method to build the drop-down choice of attributes for a feature. If
-    * 'withRange' is true, then Score, and any attributes with a min-max range, are
-    * added. If 'withText' is true, Label and any known attributes are added. This
-    * allows 'categorical numerical' attributes e.g. codon position to be coloured
-    * by text.
+    * A helper method to build the drop-down choice of attributes for a feature.
+    * If 'withRange' is true, then Score, and any attributes with a min-max
+    * range, are added. If 'withText' is true, Label and any known attributes are
+    * added. This allows 'categorical numerical' attributes e.g. codon position
+    * to be coloured by text.
     * <p>
     * Where metadata is available with a description for an attribute, that is
     * added as a tooltip.
    {
      filters = new ArrayList<>();
  
 +    JPanel outerPanel = new JPanel();
 +    outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
 +    outerPanel.setBackground(Color.white);
 +
 +    /*
 +     * option to apply colour to sub-types as well (if there are any)
 +     */
 +    if (!subTypes.isEmpty())
 +    {
 +      applyFiltersToSubtypes = false;
 +      outerPanel.add(initSubtypesPanel(true));
 +    }
 +
      JPanel filtersPanel = new JPanel();
      filtersPanel.setLayout(new BoxLayout(filtersPanel, BoxLayout.Y_AXIS));
      filtersPanel.setBackground(Color.white);
      JvSwingUtils.createTitledBorder(filtersPanel,
              MessageManager.getString("label.filters"), true);
 +    outerPanel.add(filtersPanel);
  
      JPanel andOrPanel = initialiseAndOrPanel();
      filtersPanel.add(andOrPanel);
      chooseFiltersPanel.setBackground(Color.white);
      filtersPanel.add(chooseFiltersPanel);
  
 -    return filtersPanel;
 +    return outerPanel;
    }
  
    /**
     */
    private JPanel initialiseAndOrPanel()
    {
 -    JPanel andOrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
 +    JPanel andOrPanel = new JPanel(new BorderLayout());
      andOrPanel.setBackground(Color.white);
-     JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
-     andOrPanel.add(panel1, BorderLayout.WEST);
-     panel1.setBackground(Color.white);
-     panel1.setBorder(BorderFactory.createLineBorder(debugBorderColour));
++//<<<<<<< HEAD
++//    JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
++//    andOrPanel.add(panel1, BorderLayout.WEST);
++//    panel1.setBackground(Color.white);
++//    panel1.setBorder(BorderFactory.createLineBorder(debugBorderColour));
++//=======
++//>>>>>>> refs/heads/develop
      andFilters = new JRadioButton(MessageManager.getString("label.and"));
      orFilters = new JRadioButton(MessageManager.getString("label.or"));
      ActionListener actionListener = new ActionListener()
      andOr.add(andFilters);
      andOr.add(orFilters);
      andFilters.setSelected(true);
-     panel1.add(
+     andOrPanel.add(
              new JLabel(MessageManager.getString("label.join_conditions")));
-     panel1.add(andFilters);
-     panel1.add(orFilters);
+     andOrPanel.add(andFilters);
+     andOrPanel.add(orFilters);
 +
      return andOrPanel;
    }
  
    /**
 +   * Builds a tooltip for the 'Apply to subtypes' checkbox with a list of
 +   * subtypes of this feature type
 +   * 
 +   * @return
 +   */
 +  protected String getSubtypesTooltip()
 +  {
 +    StringBuilder sb = new StringBuilder(20 * subTypes.size());
 +    sb.append(MessageManager.getString("label.apply_also_to"));
 +    for (String child : subTypes)
 +    {
 +      sb.append("<br>").append(child);
 +    }
 +    String tooltip = JvSwingUtils.wrapTooltip(true, sb.toString());
 +    return tooltip;
 +  }
 +
 +  /**
     * Refreshes the display to show any filters currently configured for the
     * selected feature type (editable, with 'remove' option), plus one extra row
     * for adding a condition. This should be called after a filter has been
      for (FeatureMatcherI filter : filters)
      {
        JPanel row = addFilter(filter, attNames, filterIndex);
-       row.setBorder(BorderFactory.createLineBorder(debugBorderColour));
        chooseFiltersPanel.add(row);
        filterIndex++;
      }
    /**
     * A helper method that constructs a row (panel) with one filter condition:
     * <ul>
-    * <li>a drop-down list of Label, Score and attribute names to choose from</li>
+    * <li>a drop-down list of Label, Score and attribute names to choose
+    * from</li>
     * <li>a drop-down list of conditions to choose from</li>
     * <li>a text field for input of a match pattern</li>
     * <li>optionally, a 'remove' button</li>
     * @param selectedCondition
     * @param patternField
     */
-   private void setNumericHints(String attName,
-           Condition selectedCondition, JTextField patternField)
+   private void setNumericHints(String attName, Condition selectedCondition,
+           JTextField patternField)
    {
      patternField.setToolTipText("");
  
    }
  
    /**
-    * Populates the drop-down list of comparison conditions for the given attribute
-    * name. The conditions added depend on the datatype of the attribute values.
-    * The supplied condition is set as the selected item in the list, provided it
-    * is in the list. If the pattern is now invalid (non-numeric pattern for a
-    * numeric condition), it is cleared.
+    * Populates the drop-down list of comparison conditions for the given
+    * attribute name. The conditions added depend on the datatype of the
+    * attribute values. The supplied condition is set as the selected item in the
+    * list, provided it is in the list. If the pattern is now invalid
+    * (non-numeric pattern for a numeric condition), it is cleared.
     * 
     * @param attName
     * @param cond
    }
  
    /**
-    * Answers true unless a numeric condition has been selected with a non-numeric
-    * value. Sets the value field to RED with a tooltip if in error.
+    * Answers true unless a numeric condition has been selected with a
+    * non-numeric value. Sets the value field to RED with a tooltip if in error.
     * <p>
-    * If the pattern is expected but is empty, this method returns false, but does
-    * not mark the field as invalid. This supports selecting an attribute for a new
-    * condition before a match pattern has been entered.
+    * If the pattern is expected but is empty, this method returns false, but
+    * does not mark the field as invalid. This supports selecting an attribute
+    * for a new condition before a match pattern has been entered.
     * 
     * @param value
     * @param condCombo
  
    /**
     * Constructs a filter condition from the given input fields, and replaces the
-    * condition at filterIndex with the new one. Does nothing if the pattern field
-    * is blank (unless the match condition is one that doesn't require a pattern,
-    * e.g. 'Is present'). Answers true if the filter was updated, else false.
+    * condition at filterIndex with the new one. Does nothing if the pattern
+    * field is blank (unless the match condition is one that doesn't require a
+    * pattern, e.g. 'Is present'). Answers true if the filter was updated, else
+    * false.
     * <p>
     * This method may update the tooltip on the filter value field to show the
-    * value range, if a numeric condition is selected. This ensures the tooltip is
-    * updated when a numeric valued attribute is chosen on the last 'add a filter'
-    * row.
+    * value range, if a numeric condition is selected. This ensures the tooltip
+    * is updated when a numeric valued attribute is chosen on the last 'add a
+    * filter' row.
     * 
     * @param attCombo
     * @param condCombo
    }
  
    /**
-    * Makes the dialog visible, at the Feature Colour tab or at the Filters tab
-    * 
-    * @param coloursTab
-    */
-   public void showTab(boolean coloursTab)
-   {
-     setVisible(true);
-     tabbedPane.setSelectedIndex(coloursTab ? 0 : 1);
-   }
-   /**
     * Action on any change to feature filtering, namely
     * <ul>
     * <li>change of selected attribute</li>
     * <li>change of match pattern</li>
     * <li>removal of a condition</li>
     * </ul>
-    * The inputs are parsed into a combined filter and this is set for the feature
-    * type, and the alignment redrawn.
+    * The inputs are parsed into a combined filter and this is set for the
+    * feature type, and the alignment redrawn.
     */
    protected void filtersChanged()
    {
       * (note this might now be an empty filter with no conditions)
       */
      fr.setFeatureFilter(featureType, combined.isEmpty() ? null : combined);
 +    if (applyFiltersToSubtypes)
 +    {
 +      for (String child : subTypes)
 +      {
 +        fr.setFeatureFilter(child, combined.isEmpty() ? null : combined);
 +      }
 +    }
 +
 +    refreshFeatureSettings();
      ap.paintAlignment(true, true);
  
      updateFiltersTab();
@@@ -34,7 -34,6 +34,6 @@@ import jalview.io.gff.SequenceOntologyI
  import jalview.util.DBRefUtils;
  import jalview.util.MessageManager;
  import jalview.util.Platform;
- import jalview.ws.dbsources.das.api.DasSourceRegistryI;
  import jalview.ws.seqfetcher.DbSourceProxy;
  
  import java.awt.BorderLayout;
@@@ -111,10 -110,6 +110,6 @@@ public class SequenceFetcher extends JP
  
    private static jalview.ws.SequenceFetcher sfetch = null;
  
-   private static long lastDasSourceRegistry = -3;
-   private static DasSourceRegistryI dasRegistry = null;
    private static boolean _initingFetcher = false;
  
    private static Thread initingThread = null;
                  Thread.currentThread().hashCode());
        }
      }
-     if (sfetch == null || dasRegistry != Cache.getDasSourceRegistry()
-             || lastDasSourceRegistry != (Cache.getDasSourceRegistry()
-                     .getDasRegistryURL()
-                     + Cache.getDasSourceRegistry().getLocalSourceString())
-                             .hashCode())
+     if (sfetch == null)
      {
        _initingFetcher = true;
        initingThread = Thread.currentThread();
                          "status.init_sequence_database_fetchers"),
                  Thread.currentThread().hashCode());
        }
-       dasRegistry = Cache.getDasSourceRegistry();
-       dasRegistry.refreshSources();
  
        jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
        if (guiWindow != null)
        {
          guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
        }
-       lastDasSourceRegistry = (dasRegistry.getDasRegistryURL()
-               + dasRegistry.getLocalSourceString()).hashCode();
        sfetch = sf;
        _initingFetcher = false;
        initingThread = null;
        dbeg.setText(MessageManager.formatMessage("label.example_query_param",
                new String[]
                { eq }));
+       // TODO this should be a property of the SequenceFetcher whether commas are and
+       // colons are allowed in the IDs...
        boolean enablePunct = !(eq != null && eq.indexOf(",") > -1);
-       for (DbSourceProxy dbs : database.getSelectedSources())
-       {
-         if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
-         {
-           enablePunct = false;
-           break;
-         }
-       }
        replacePunctuation.setEnabled(enablePunct);
  
      } catch (Exception ex)
          }
          if (Cache.getDefault("HIDE_INTRONS", true))
          {
 -          af.hideFeatureColumns(SequenceOntologyI.EXON, false);
 +          af.hideFeatureColumns(false, SequenceOntologyI.EXON);
          }
          if (newAlframes != null)
          {