From 76f854fb5352575ac0dcea0e01af34b6ef4b2e9c Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 27 Feb 2023 14:16:00 +0000 Subject: [PATCH] JAL-629 Guesstimate whether to set pLDDT with PDB file --- src/jalview/gui/StructureChooser.java | 10 ++++++++++ src/jalview/jbgui/GStructureChooser.java | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 11e50db..5612469 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -679,7 +679,17 @@ public class StructureChooser extends GStructureChooser { selectedPdbFileName = chooser.getSelectedFile().getPath(); Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName); + boolean guessTFType = localPdbPaeMatrixFileName == null; localPdbPaeMatrixFileName = guessPAEFilename(); + guessTFType |= localPdbPaeMatrixFileName != null; + if (guessTFType + && new File(selectedPdbFileName).getName().startsWith("AF-") + && !tempFacAsChanged) + { + // localPdbPaeMatrixFileName was null and now isn't and filename could + // well be AlphaFold and user hasn't adjusted the tempFacType + combo_tempFacAs.setSelectedItem(TFType.PLDDT); + } validateSelections(); } } diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index ac623bc..d317e97 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -133,6 +133,8 @@ public abstract class GStructureChooser extends JPanel protected JComboBox combo_tempFacAs = new JComboBox<>(); + protected boolean tempFacAsChanged = false; + protected JButton btn_paeMatrixFile = new JButton(); protected JLabel lbl_paeFile = new JLabel(); @@ -577,6 +579,15 @@ public abstract class GStructureChooser extends JPanel { combo_tempFacAs.addItem(t); } + combo_tempFacAs.addItemListener(new ItemListener() + { + @Override + public void itemStateChanged(ItemEvent e) + { + // used to determine if we should guess pLDDT or leave a user-choice + tempFacAsChanged = true; + } + }); btn_paeMatrixFile.setFont(VERDANA_12); btn_paeMatrixFile.setText(new StringBuilder() -- 1.7.10.2