1.1 methods
[jalview.git] / src / jalview / util / DBRefUtils.java
index 381ed70..3ea47f2 100755 (executable)
@@ -54,7 +54,7 @@ public class DBRefUtils
     {
       if (srcs.containsKey(dbrefs[i].getSource()))
       {
-        res.add(dbrefs[i]);
+        res.addElement(dbrefs[i]);
       }
     }
 
@@ -90,6 +90,10 @@ public class DBRefUtils
                                      jalview.datamodel.DBRefSource.PDB);
       DasCoordinateSystemsLookup.put("uniprot",
                                      jalview.datamodel.DBRefSource.UNIPROT);
+      DasCoordinateSystemsLookup.put("EMBL",
+              jalview.datamodel.DBRefSource.EMBL);
+      //DasCoordinateSystemsLookup.put("EMBL",
+      //        jalview.datamodel.DBRefSource.EMBLCDS);
     }
 
     String coordsys = (String) DasCoordinateSystemsLookup.get(string.
@@ -100,4 +104,27 @@ public class DBRefUtils
     }
     return false;
   }
+  public static Hashtable CanonicalSourceNameLookup=null;
+  /**
+   * look up source in an internal list of database reference sources
+   * and return the canonical jalview name for the source, or the original
+   * string if it has no canonical form.
+   * @param source
+   * @return canonical jalview source (one of jalview.datamodel.DBRefSource.*) or original source
+   */
+  public static String getCanonicalName(String source)
+  {
+    if (CanonicalSourceNameLookup==null) {
+      CanonicalSourceNameLookup = new Hashtable();
+      CanonicalSourceNameLookup.put("uniprotkb/swiss-prot", jalview.datamodel.DBRefSource.UNIPROT);
+      CanonicalSourceNameLookup.put("pdb", jalview.datamodel.DBRefSource.PDB);
+    }
+    String canonical = (String) CanonicalSourceNameLookup.get(source.
+        toLowerCase());
+    if (canonical==null)
+    {
+      return source;
+    }
+    return canonical;
+  }
 }