JAL-1645 Version-Rel Version 2.9 Year-Rel 2015 Licensing glob
[jalview.git] / src / jalview / datamodel / FeatureProperties.java
index b940eb1..17a2e64 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -29,6 +29,8 @@ package jalview.datamodel;
 public class FeatureProperties
 {
 
+  private static final String EMBL_CODING_FEATURE = "CDS";
+
   public static final String EXONPOS = "exon number";
 
   public static final String EXONPRODUCT = "product";
@@ -43,9 +45,29 @@ public class FeatureProperties
    */
   public static boolean isCodingFeature(String dbrefsource, String type)
   {
-    return ((dbrefsource == null
-            || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource
-              .equalsIgnoreCase(DBRefSource.EMBLCDS)) && type
-            .equalsIgnoreCase("CDS"));
+    if (type.equalsIgnoreCase(EMBL_CODING_FEATURE))
+    {
+      return (dbrefsource == null
+              || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource
+                .equalsIgnoreCase(DBRefSource.EMBLCDS));
+    }
+    return false;
+  }
+
+  /**
+   * Returns the coding feature name for a database source. Currently just
+   * hard-coded to return CDS for EMBL/EMBLCDS, else null.
+   * 
+   * @param dbrefsource
+   * @return
+   */
+  public static String getCodingFeature(String dbrefsource)
+  {
+    if (DBRefSource.EMBL.equalsIgnoreCase(dbrefsource)
+            || DBRefSource.EMBLCDS.equalsIgnoreCase(dbrefsource))
+    {
+      return EMBL_CODING_FEATURE;
+    }
+    return null;
   }
 }