Merge branch 'develop' into features/JAL-3010ontologyFeatureSettings
[jalview.git] / src / jalview / gui / FeatureTypeSettings.java
index 538c93c..0dd0f1f 100644 (file)
@@ -22,7 +22,6 @@ package jalview.gui;
 
 import jalview.api.AlignmentViewPanel;
 import jalview.api.FeatureColourI;
-import jalview.bin.Cache;
 import jalview.datamodel.GraphLine;
 import jalview.datamodel.features.FeatureAttributes;
 import jalview.datamodel.features.FeatureAttributes.Datatype;
@@ -85,11 +84,6 @@ import javax.swing.plaf.basic.BasicArrowButton;
  */
 public class FeatureTypeSettings extends JalviewDialog
 {
-  /*
-   * 'top level' Sequence Ontology terms
-   */
-  private final static String SO_ROOTS = "sequence_variant,sequence_attribute,sequence_collection,sequence_feature";
-
   private final static String LABEL_18N = MessageManager
           .getString("label.label");
 
@@ -309,23 +303,15 @@ public class FeatureTypeSettings extends JalviewDialog
      * parent of the current type
      */
     SequenceOntologyI so = SequenceOntologyFactory.getInstance();
-    String[] roots = Cache.getDefault("SO_ROOTS", SO_ROOTS).split(",");
-    rootSOTerm = null;
-    for (String root : roots)
-    {
-      if (so.isA(featureType, root.trim()))
-      {
-        rootSOTerm = root;
-        break;
-      }
-    }
-    if (rootSOTerm == null)
+    List<String> roots = so.getRootParents(featureType);
+    if (roots == null || roots.size() > 1)
     {
       /*
-       * feature type is not an SO term
+       * feature type is not an SO term, or has ambiguous root
        */
       return peers;
     }
+    rootSOTerm = roots.get(0);
 
     List<String> types = fr.getRenderOrder();
     for (String type : types)