prototype DBRef and Feature Type semantics (for annotating coding regions and disting...
authorjprocter <Jim Procter>
Mon, 28 May 2007 11:15:40 +0000 (11:15 +0000)
committerjprocter <Jim Procter>
Mon, 28 May 2007 11:15:40 +0000 (11:15 +0000)
src/jalview/datamodel/DBRefSource.java
src/jalview/datamodel/FeatureProperties.java [new file with mode: 0644]
src/jalview/datamodel/xdb/embl/EmblEntry.java

index aaf0ada..9e394bb 100755 (executable)
@@ -44,4 +44,8 @@ public class DBRefSource
    * PFAM ID
    */
   public static String PFAM = "PFAM";
+  /**
+   * List of databases whose sequences might have coding regions annotated
+   */
+  public static final String[] DNACODINGDBS = { EMBL, EMBLCDS};
 }
diff --git a/src/jalview/datamodel/FeatureProperties.java b/src/jalview/datamodel/FeatureProperties.java
new file mode 100644 (file)
index 0000000..7eadf7b
--- /dev/null
@@ -0,0 +1,24 @@
+package jalview.datamodel;\r
+\r
+/**\r
+ * A set of feature property constants used by jalview\r
+ * @author JimP\r
+ *\r
+ */\r
+public class FeatureProperties\r
+{\r
+\r
+  public static final String EXONPOS = "exon number";\r
+  public static final String EXONPRODUCT = "product";\r
+  /**\r
+   * lookup feature type for a particular database to see if its a coding region feature\r
+   * @param dbrefsource\r
+   * @param string\r
+   * @return\r
+   */\r
+  public static boolean isCodingFeature(String dbrefsource, String type)\r
+  {\r
+    return ((dbrefsource==null || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL))\r
+            && type.equalsIgnoreCase("CDS"));\r
+  }\r
+}\r
index e6c7197..a22eff7 100644 (file)
@@ -1,6 +1,8 @@
 package jalview.datamodel.xdb.embl;
 
 import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.FeatureProperties;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
@@ -414,7 +416,7 @@ public class EmblEntry
               ;
           }
         }
-        if (feature.getName().equalsIgnoreCase("CDS"))
+        if (FeatureProperties.isCodingFeature(DBRefSource.EMBL, "CDS"))
         {
           // extract coding region(s)
           jalview.datamodel.Mapping map = null;
@@ -502,6 +504,8 @@ public class EmblEntry
               sf.setFeatureGroup(jalview.datamodel.DBRefSource.EMBL);
               sf.setDescription("Exon " + (1 + xint) + " for protein '"
                       + prname + "' EMBLCDS:" + prid);
+              sf.setValue(FeatureProperties.EXONPOS, new Integer(1+xint));
+              sf.setValue(FeatureProperties.EXONPRODUCT, prname);
               if (vals != null && vals.size() > 0)
               {
                 Enumeration kv = vals.elements();
@@ -523,6 +527,7 @@ public class EmblEntry
               DBRefEntry ref = (DBRefEntry) dbr.next();
               ref.setSource(jalview.util.DBRefUtils.getCanonicalName(ref
                       .getSource()));
+              // Hard code the kind of protein product accessions that EMBL cite
               if (ref.getSource().equals(
                       jalview.datamodel.DBRefSource.UNIPROT))
               {