5 import jalview.datamodel.*;
7 public class DBRefUtils
10 * Utilities for handling DBRef objects and their collections.
14 * @param dbrefs Vector of DBRef objects to search
15 * @param sources String[] array of source DBRef IDs to retrieve
18 public static Vector selectRefs(java.util.Vector dbrefs, String[] sources) {
23 Hashtable srcs = new Hashtable();
24 Vector res=new Vector();
25 for (int i=0; i<sources.length; i++)
26 srcs.put(new String(sources[i]), new Integer(i));
27 for (int i=0, j=dbrefs.size(); i<j; i++)
28 if (dbrefs.get(i) instanceof jalview.datamodel.DBRefEntry) {
29 jalview.datamodel.DBRefEntry entry = (jalview.datamodel.DBRefEntry) dbrefs.get(i);
30 if (srcs.containsKey(entry.getSource()))
36 // there are probable memory leaks in the hashtable!
41 * isDasCoordinateSystem
43 * @param string String
44 * @param dBRefEntry DBRefEntry
45 * @return boolean true if Source DBRefEntry is compatible with DAS CoordinateSystem name
47 public static Hashtable DasCoordinateSystemsLookup = null;
48 public static boolean isDasCoordinateSystem(String string,
49 DBRefEntry dBRefEntry)
51 if (DasCoordinateSystemsLookup==null)
53 DasCoordinateSystemsLookup = new Hashtable();
54 DasCoordinateSystemsLookup.put("pdbresnum",
55 jalview.datamodel.DBRefSource.PDB);
56 DasCoordinateSystemsLookup.put("uniprot",
57 jalview.datamodel.DBRefSource.UNIPROT);
60 String coordsys = (String) DasCoordinateSystemsLookup.get(string.toLowerCase());
62 return coordsys.equals(dBRefEntry.getSource());