From 8cd5057436eed4be6dc5a2b9a4f1284725173104 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 19 Mar 2007 14:02:46 +0000 Subject: [PATCH] New method for mapping from common database sources to canonical jalview name. Added EMBL to list of mappings between internal DBRefSources and das coordinate system. --- src/jalview/util/DBRefUtils.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 381ed70..3587b83 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -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.*) + */ + 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; + } } -- 1.7.10.2