From b46275c83e658850adedf791696f3453aa1f9cb0 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 15 Nov 2024 11:27:09 +0000 Subject: [PATCH] JAL-3914 infer TFType from the 3d-beacons metadata, and store/restore TFType in PDBEntry --- src/jalview/datamodel/PDBEntry.java | 78 ++++++++++++++++++++ .../ThreeDBStructureChooserQuerySource.java | 40 ++++++++++ 2 files changed, 118 insertions(+) diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index b6b13c9..9246744 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -25,6 +25,7 @@ import java.util.Enumeration; import java.util.Hashtable; import jalview.io.StructureFile; +import jalview.structure.StructureImportSettings.TFType; import jalview.util.CaseInsensitiveString; public class PDBEntry @@ -562,6 +563,15 @@ public class PDBEntry private static final String PROVIDERCATEGORY = "PROVIDERCATEGORY"; + private static final String TEMPFACTYPE = "TEMPFACTYPE"; + + private static final String MODELCONFIDENCE = "MODELCONFIDENCE"; + + private static final String MODELCONFTYPE = "MODELCONFTYPE"; + + private static final String MODELCONFVER = "MODELCONFVER"; + + /** * Permanent URI for retrieving the original structure data * @@ -662,4 +672,72 @@ public class PDBEntry return _hasProperty(PROVIDERCATEGORY); } + public void setTempFacType(TFType tempfactype) + { + setProperty(TEMPFACTYPE, tempfactype); + } + + /** + * String version of TFType enum + * @return + */ + public String getTempFacType() + { + return (String) getProperty(TEMPFACTYPE); + } + public TFType getTempFacTypeTFType() + { + return TFType.valueOf((String) getProperty(TEMPFACTYPE)); + } + + public boolean hasTempFacType() + { + return _hasProperty(TEMPFACTYPE); + } + + public void setModelConfidenceType(String modelConfType2) + { + setProperty(MODELCONFTYPE, modelConfType2); + } + + public boolean hasModelConfidenceType() + { + return _hasProperty(MODELCONFTYPE); + } + + public String getModelConfidenceType() + { + return (String) getProperty(MODELCONFTYPE); + } + + public void setModelConfidenceVersion(String modelConfVer2) + { + setProperty(MODELCONFVER, modelConfVer2); + } + + public boolean hasModelConfidenceVersion() + { + return _hasProperty(MODELCONFVER); + } + + public String getModelConfidenceVersion() + { + return (String) getProperty(MODELCONFVER); + } + + public void setModelConfidence(Double modelConf) + { + setProperty(MODELCONFIDENCE, modelConf); + } + + public boolean hasModelConfidence() + { + return _hasProperty(MODELCONFIDENCE); + } + + public Double getModelConfidence() + { + return (Double) getProperty(MODELCONFIDENCE); + } + } diff --git a/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java b/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java index 2bd5a91..5c0d425 100644 --- a/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java +++ b/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java @@ -47,6 +47,7 @@ import jalview.fts.core.FTSRestResponse; import jalview.fts.service.threedbeacons.TDB_FTSData; import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient; import jalview.jbgui.FilterOption; +import jalview.structure.StructureImportSettings.TFType; /** * logic for querying the 3DBeacons API for structures of sequences @@ -388,6 +389,11 @@ public class ThreeDBStructureChooserQuerySource int humanUrl = restable.getColumn("Page URL").getModelIndex(); int modelformat = restable.getColumn("Model Format").getModelIndex(); int idx_mcat = restable.getColumn("Model Category").getModelIndex(); + int idx_mqual = restable.getColumn("Confidence").getModelIndex(); + int idx_mqualtype = restable.getColumn("Confidence Score Type").getModelIndex(); + int idx_mqualtypever = restable.getColumn("Confidence Score Version").getModelIndex(); + + final int up_start_idx = restable.getColumn("Uniprot Start") .getModelIndex(); @@ -429,6 +435,29 @@ public class ThreeDBStructureChooserQuerySource String modelCategory = idx_mcat < 1 ? null : (String) restable.getValueAt(row, idx_mcat); + + Double modelConf = idx_mqual < 1 ? null + : (Double) restable.getValueAt(row, idx_mqual); + + String modelConfType = idx_mqualtype < 1 ? null + : (String) restable.getValueAt(row, idx_mqualtype); + String modelConfVer = idx_mqualtypever < 1 ? null + : (String) restable.getValueAt(row, idx_mqualtypever); + + String tftype = modelConfType.toUpperCase(Locale.ROOT); + TFType tempfacType = (tftype==null) ? null : TFType.valueOf(tftype); + if (tftype==null || "".equals(tftype) || TFType.valueOf(tftype) == null ) + { + // TODO maintain mappings between confidence types and tempfactypes + if (typeColumn.toLowerCase(Locale.ROOT).startsWith("alpha") || tftype.startsWith("ALPHAFOLD")) { + tftype = TFType.PLDDT.toString(); + modelConfVer = null; + } + if (!typeColumn.toLowerCase(Locale.ROOT).startsWith("pdbe")) { + tftype = TFType.QMEANDISCO.toString(); + } + } + String strucFormat = restable.getValueAt(row, modelformat).toString(); SequenceI selectedSeq = (SequenceI) restable.getValueAt(row, @@ -464,6 +493,17 @@ public class ThreeDBStructureChooserQuerySource pdbEntry.setProviderPage(modelPage); } pdbEntry.setProviderCategory(modelCategory); + pdbEntry.setTempFacType(tempfacType); + if (modelConf != null) { + pdbEntry.setModelConfidence(modelConf); + } + if (modelConfType != null) { + pdbEntry.setModelConfidenceType(modelConfType); + } + if (modelConfVer != null) { + pdbEntry.setModelConfidenceVersion(modelConfVer); + } + selectedSeq.getDatasetSequence().addPDBId(pdbEntry); } pdbEntriesToView[count++] = pdbEntry; -- 1.7.10.2