JAL-2755 add ENSEMBLGENOMES as a target for canonicalised database sources
authorJim Procter <jprocter@issues.jalview.org>
Thu, 20 Sep 2018 15:39:03 +0000 (16:39 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 20 Sep 2018 15:39:03 +0000 (16:39 +0100)
src/jalview/util/DBRefUtils.java

index 50a34fc..b9939e6 100755 (executable)
@@ -65,6 +65,9 @@ public class DBRefUtils
     canonicalSourceNameLookup.put("ensembl-tr", DBRefSource.ENSEMBL);
     canonicalSourceNameLookup.put("ensembl-gn", DBRefSource.ENSEMBL);
 
+    canonicalSourceNameLookup.put("ensemblgenomes",
+            DBRefSource.ENSEMBLGENOMES);
+
     // Make sure we have lowercase entries for all canonical string lookups
     Set<String> keys = canonicalSourceNameLookup.keySet();
     for (String k : keys)
@@ -160,6 +163,20 @@ public class DBRefUtils
       return null;
     }
     String canonical = canonicalSourceNameLookup.get(source.toLowerCase());
+    if (canonical==null)
+    {
+      if (source.toLowerCase().startsWith("ensembl"))
+      {
+        canonical = DBRefSource.ENSEMBL;
+        for (String ensembls: new String[] { "Protists","Plants","Bacteria","Fungi","Metazoa"})
+        {
+          if (source.toLowerCase().endsWith(ensembls.toLowerCase()))
+          {
+            canonical = DBRefSource.ENSEMBLGENOMES;
+          }
+        }
+      }
+    }
     return canonical == null ? source : canonical;
   }