- public void reportMapping() {\r
- if (mappings==null)\r
- {\r
- System.err.println("reportMapping: No PDB/Sequence mappings.");\r
- }else{\r
- System.err.println("reportMapping: There are "+mappings.length+" mappings.");\r
- for (int m=0;m<mappings.length;m++)\r
- {\r
- System.err.println("mapping "+m+" : "+mappings[m].pdbfile);\r
- }\r
- }\r
- }\r
- Hashtable mappingData = new Hashtable();
-
- public static StructureSelectionManager getStructureSelectionManager(StructureSelectionManagerProvider context)
+ public void reportMapping()
+ {
+ if (mappings.isEmpty())
+ {
+ System.err.println("reportMapping: No PDB/Sequence mappings.");
+ }
+ else
+ {
+ System.err.println("reportMapping: There are " + mappings.size()
+ + " mappings.");
+ int i = 0;
+ for (StructureMapping sm : mappings)
+ {
+ System.err.println("mapping " + i++ + " : " + sm.pdbfile);
+ }
+ }
+ }
+
+ /**
+ * map between the PDB IDs (or structure identifiers) used by Jalview and the
+ * absolute filenames for PDB data that corresponds to it
+ */
+ Map<String, String> pdbIdFileName = new HashMap<String, String>();
+
+ Map<String, String> pdbFileNameId = new HashMap<String, String>();
+
+ public void registerPDBFile(String idForFile, String absoluteFile)
+ {
+ pdbIdFileName.put(idForFile, absoluteFile);
+ pdbFileNameId.put(absoluteFile, idForFile);
+ }
+
+ public String findIdForPDBFile(String idOrFile)
+ {
+ String id = pdbFileNameId.get(idOrFile);
+ return id;
+ }
+
+ public String findFileForPDBId(String idOrFile)
+ {
+ String id = pdbIdFileName.get(idOrFile);
+ return id;
+ }
+
+ public boolean isPDBFileRegistered(String idOrFile)
+ {
+ return pdbFileNameId.containsKey(idOrFile)
+ || pdbIdFileName.containsKey(idOrFile);
+ }
+
+ private static StructureSelectionManager nullProvider = null;
+
+ public static StructureSelectionManager getStructureSelectionManager(
+ StructureSelectionManagerProvider context)