X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FPDBEntry.java;h=a966ca1390c8f0d2be2ece6e2a981ae6502c94d4;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=d0ab8bf3dc716190e94d0f727422acd05fbfddf5;hpb=49db0dff1da16c3355b43a41498c1fc93ef47e91;p=jalview.git diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index d0ab8bf..a966ca1 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -38,8 +38,18 @@ public class PDBEntry private static final int PDB_ID_LENGTH = 4; + /** + * property set when id is a 'manufactured' identifier from the structure + * data's filename + */ private static final String FAKED_ID = "faked_pdbid"; + /** + * property set when the id is authoritative, and should be used in preference + * to any identifiers in the structure data + */ + private static final String AUTHORITATIVE_ID = "authoritative_pdbid"; + private String file; private String type; @@ -50,7 +60,8 @@ public class PDBEntry { // TODO is FILE needed; if not is this enum needed, or can we // use FileFormatI for PDB, MMCIF? - PDB("pdb", "pdb"), MMCIF("mmcif", "cif"), BCIF("bcif","bcif"),FILE("?", "?"); + PDB("pdb", "pdb"), MMCIF("mmcif", "cif"), BCIF("bcif", "bcif"), + FILE("?", "?"); /* * file extension for cached structure file; must be one that @@ -438,7 +449,7 @@ public class PDBEntry // this shouldn't happen, but could do if the id from the // file is not the same as the id from the authority that provided // the file - if (!newEntry.fakedPDBId()) + if (!newEntry.fakedPDBId() && !isAuthoritative()) { return false; } // otherwise we can update @@ -506,7 +517,7 @@ public class PDBEntry */ String key = newProps.nextElement(); Object value = newEntry.getProperty(key); - if (FAKED_ID.equals(key)) + if (FAKED_ID.equals(key) || AUTHORITATIVE_ID.equals(key)) { // we never update the fake ID property continue; @@ -518,9 +529,29 @@ public class PDBEntry } return true; } - + + public void setAuthoritative(boolean isAuthoritative) + { + setProperty(AUTHORITATIVE_ID, Boolean.valueOf(isAuthoritative)); + } + + /** + * + * @return true if the identifier should be preferred over any identifiers + * embedded in the structure data + */ + public boolean isAuthoritative() + { + if (_hasProperty(AUTHORITATIVE_ID)) + { + return ((Boolean) getProperty(AUTHORITATIVE_ID)); + } + return false; + } + /** * set when Jalview has manufactured the ID using a local filename + * * @return */ public boolean fakedPDBId() @@ -531,15 +562,17 @@ public class PDBEntry } return false; } + public void setFakedPDBId(boolean faked) { if (faked) { setProperty(FAKED_ID, Boolean.TRUE); } - else + else { - if (properties!=null) { + if (properties != null) + { properties.remove(FAKED_ID); } }