\r
// We make a DBRefEtntry because we have obtained the PDB file from a verifiable source\r
// JBPNote - PDB DBRefEntry should also carry the chain and mapping information\r
- DBRefEntry dbentry = new DBRefEntry("PDB","0",pdbid);\r
+ DBRefEntry dbentry = new DBRefEntry(jalview.datamodel.DBRefSource.PDB,"0",pdbid);\r
sequences[i].getDatasetSequence().addDBRef(dbentry);\r
}\r
else\r
while (seqIndex < sequences.size())\r
{\r
Sequence sequence = (Sequence) sequences.get(seqIndex);\r
- Vector uprefs = jalview.util.DBRefUtils.selectRefs(sequence.getDBRef(), new String[] {"DBREF"});\r
+ Vector uprefs = jalview.util.DBRefUtils.selectRefs(sequence.getDBRef(),\r
+ new String[] {\r
+ jalview.datamodel.DBRefSource.PDB,\r
+ jalview.datamodel.DBRefSource.UNIPROT});\r
\r
for(int sourceIndex=0; sourceIndex<selectedSources.size(); sourceIndex++)\r
{\r
// we know the id for this entry, so don't note its ID in the unknownSequences list\r
for (int j = 0, k = uprefs.size(); j < k; j++)\r
{\r
-\r
- createFeatureFetcher(sequence,\r
- dasSource.getUrl(),\r
- ( (DBRefEntry) uprefs.get(j)).getAccessionId(),\r
- dasSource.getNickname());\r
+ // Will have to pass any mapping information to the fetcher - the start/end for the DBRefEntry may not be the same as the sequence's start/end\r
+ org.biojava.services.das.registry.DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();\r
+ for (int l=0; l<cs.length; l++) {\r
+ if (jalview.util.DBRefUtils.isDasCoordinateSystem(cs[l].getName(), (DBRefEntry)\r
+ uprefs.get(j)))\r
+ {\r
+ Cache.log.debug("Launched fetcher for coordinate system " +\r
+ cs[l].getName());\r
+ createFeatureFetcher(sequence,\r
+ dasSource.getUrl(),\r
+ ( (DBRefEntry) uprefs.get(j)).\r
+ getAccessionId(),\r
+ dasSource.getNickname());\r
+ }\r
+ }\r
}\r
}\r
else\r
{\r
// JBPNote PDB dbRefEntry needs properties to propagate onto ModellerField\r
// JBPNote Need to get info from the user about whether the sequence is the one being modelled, or if it is a template.\r
- if (dref.getSource().equals("PDB"))\r
+ if (dref.getSource().equals(jalview.datamodel.DBRefSource.PDB))\r
{\r
fields.put(Fields[LOCALID], dref.getAccessionId());\r
t = 2;\r
seqIndex++, i++)\r
{\r
Sequence sequence = (Sequence) sequences.get(seqIndex);\r
- Vector uprefs = jalview.util.DBRefUtils.selectRefs(sequence.getDBRef(), new String[] { "Uniprot"});\r
+ Vector uprefs = jalview.util.DBRefUtils.selectRefs(sequence.getDBRef(), new String[] {\r
+ jalview.datamodel.DBRefSource.UNIPROT});\r
if (uprefs!=null)\r
{\r
// we know the id for this entry, so don't note its ID in the unknownSequences list\r
{\r
DBRefEntry entry = (DBRefEntry) entries.elementAt(0);\r
oldseq.addDBRef(new jalview.datamodel.\r
- DBRefEntry("UNIPROT",\r
+ DBRefEntry(jalview.datamodel.DBRefSource.UNIPROT,\r
"0",\r
entry.getAccessionId()));\r
}\r
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;
// 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;
}
+}