public enum Type
{
- PDB, MMCIF, FILE;
+ // TODO is FILE needed; if not is this enum needed, or can we
+ // use FileFormatI for PDB, MMCIF?
+ PDB("pdb", "pdb"), MMCIF("mmcif", "cif"), FILE("?", "?");
+
+ /*
+ * file extension for cached structure file; must be one that
+ * is recognised by Chimera 'open' command
+ * @see https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/filetypes.html
+ */
+ String ext;
+
+ /*
+ * format specifier used in dbfetch request
+ * @see http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/dbfetch.databases#pdb
+ */
+ String format;
+
+ private Type(String fmt, String ex)
+ {
+ format = fmt;
+ ext = ex;
+ }
+
+ public String getFormat()
+ {
+ return format;
+ }
+
+ public String getExtension()
+ {
+ return ext;
+ }
+
/**
* case insensitive matching for Type enum
*
}
}
-
/**
* Answers true if obj is a PDBEntry with the same id and chain code (both
* ignoring case), file, type and properties
{
}
- /**
- * Constructor given file path and PDB id.
- *
- * @param filePath
- */
- // public PDBEntry(String filePath, String pdbId)
- // {
- // this.file = filePath;
- // this.id = pdbId;
- // }
-
public PDBEntry(String pdbId, String chain, PDBEntry.Type type,
String filePath)
{
* @param entryType
* @param filePath
*/
- void init(String pdbId, String chain, PDBEntry.Type entryType, String filePath)
+ void init(String pdbId, String chain, PDBEntry.Type entryType,
+ String filePath)
{
this.id = pdbId;
this.type = entryType == null ? null : entryType.toString();
{
if (!DBRefSource.PDB.equals(dbr.getSource()))
{
- throw new IllegalArgumentException("Invalid source: "
- + dbr.getSource());
+ throw new IllegalArgumentException(
+ "Invalid source: " + dbr.getSource());
}
String pdbId = dbr.getAccessionId();