From: James Procter Date: Thu, 11 Jan 2024 17:15:20 +0000 (+0000) Subject: JAL-4371 make the PDB fetcher use simple naming 1xyzA when retrieving 1xyz:A from... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6bb97547f79105416cba04239855de078ae5dfda;p=jalview.git JAL-4371 make the PDB fetcher use simple naming 1xyzA when retrieving 1xyz:A from PDBe - configure via PDB_CHAIN_NAME = (SIMPLE|LEGACY) --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index a64e869..da01018 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1654,6 +1654,8 @@ public class Cache private static final Collection bootstrapProperties = new ArrayList<>( Arrays.asList(JALVIEWLOGLEVEL, BOOTSTRAP_TEST)); + public static final String PDB_CHAIN_NAME = "PDB_CHAIN_NAME"; + public static Properties bootstrapProperties(String filename) { Properties bootstrapProps = new Properties(); diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index 797726f..62d4d68 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -22,6 +22,7 @@ package jalview.ws.dbsources; import jalview.api.FeatureSettingsModelI; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; @@ -41,6 +42,7 @@ import jalview.ws.ebi.EBIFetchClient; import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import com.stevesoft.pat.Regex; @@ -113,6 +115,7 @@ public class Pdb extends EbiFileRetrievedProxy @Override public AlignmentI getSequenceRecords(String queries) throws Exception { + updateConfiguration(); AlignmentI pdbAlignment = null; String chain = null; String id = null; @@ -189,8 +192,19 @@ public class Pdb extends EbiFileRetrievedProxy { // FIXME seems to result in 'PDB|1QIP|1qip|A' - 1QIP is redundant. // TODO: suggest simplify naming to 1qip|A as default name defined - pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id + if (legacyJalviewPDBeName) + { + pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id + SEPARATOR + pdbcs.getName()); + } else { + if (simpleChainName) + { + int sep_pos = pdbcs.getName().indexOf(SEPARATOR); + String cid = pdbcs.getName().substring(0,sep_pos); + cid = cid.toLowerCase(Locale.ROOT); + pdbcs.setName(cid+"_"+pdbcs.getName().substring(sep_pos+1)); + }; + } // Might need to add more metadata to the PDBEntry object // like below /* @@ -247,6 +261,22 @@ public class Pdb extends EbiFileRetrievedProxy } return pdbAlignment; } + + boolean simpleChainName=false; + boolean legacyJalviewPDBeName=true; + + private static String SIMPLE="SIMPLE"; + private static String LEGACY="LEGACY"; + + /** + * update the chain naming conventions based on the configuration + */ + private void updateConfiguration() + { + final String nameConf = Cache.getDefault(Cache.PDB_CHAIN_NAME, "SIMPLE"); + simpleChainName = SIMPLE.equals(nameConf); + legacyJalviewPDBeName = LEGACY.equals(nameConf); + } /* * (non-Javadoc)