X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FPDBEntry.java;h=c1dc77c1224570f11088a283ac837c458e4ea3c2;hb=0669bcd76c254141146c1fc2628812c782571c0b;hp=9c3a8e757ca000b01bcfcc72a322d3327a475d7d;hpb=c3b8fbc19c04c2daec702a2bffdfab5d10555143;p=jalview.git diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index 9c3a8e7..c1dc77c 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -46,7 +46,39 @@ public class PDBEntry 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 * @@ -77,7 +109,6 @@ public class PDBEntry } } - /** * Answers true if obj is a PDBEntry with the same id and chain code (both * ignoring case), file, type and properties @@ -121,7 +152,6 @@ public class PDBEntry { } - public PDBEntry(String pdbId, String chain, PDBEntry.Type type, String filePath) { @@ -134,7 +164,8 @@ public class PDBEntry * @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(); @@ -169,8 +200,8 @@ public class PDBEntry { if (!DBRefSource.PDB.equals(dbr.getSource())) { - throw new IllegalArgumentException("Invalid source: " - + dbr.getSource()); + throw new IllegalArgumentException( + "Invalid source: " + dbr.getSource()); } String pdbId = dbr.getAccessionId();