X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FDBRefUtils.java;h=2f844dafb121c96fa0fff5ef17db88ef1dea5de7;hb=79cc40807a44006b6510d6533e57be05a66b760c;hp=86ab201843b94a6509d9ffd877e3d4247b375f50;hpb=869913baf5d81e99c37727bae7ca8652e6abfb8b;p=jalview.git diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 86ab201..2f844da 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -1,13 +1,20 @@ package jalview.util; -import java.util.Vector; -import java.util.Hashtable; +import java.util.*; + +import jalview.datamodel.*; public class DBRefUtils { /** * Utilities for handling DBRef objects and their collections. */ + /** + * + * @param dbrefs Vector of DBRef objects to search + * @param sources String[] array of source DBRef IDs to retrieve + * @return Vector + */ public static Vector selectRefs(java.util.Vector dbrefs, String[] sources) { if (dbrefs==null) return null; @@ -29,4 +36,30 @@ public class DBRefUtils // there are probable memory leaks in the hashtable! return null; } + + /** + * isDasCoordinateSystem + * + * @param string String + * @param dBRefEntry DBRefEntry + * @return boolean true if Source DBRefEntry is compatible with DAS CoordinateSystem name + */ + public static Hashtable DasCoordinateSystemsLookup = null; + public static boolean isDasCoordinateSystem(String string, + DBRefEntry dBRefEntry) + { + if (DasCoordinateSystemsLookup==null) + { // Initialise + DasCoordinateSystemsLookup = new Hashtable(); + DasCoordinateSystemsLookup.put("pdbresnum", + jalview.datamodel.DBRefSource.PDB); + DasCoordinateSystemsLookup.put("uniprot", + jalview.datamodel.DBRefSource.UNIPROT); + } + + String coordsys = (String) DasCoordinateSystemsLookup.get(string.toLowerCase()); + if (coordsys!=null) + return coordsys.equals(dBRefEntry.getSource()); + return false; } +}