From: Ben Soares Date: Mon, 27 Feb 2023 14:16:00 +0000 (+0000) Subject: JAL-629 Guesstimate whether to set pLDDT with PDB file X-Git-Tag: Release_2_11_4_0~467 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=76f854fb5352575ac0dcea0e01af34b6ef4b2e9c;p=jalview.git JAL-629 Guesstimate whether to set pLDDT with PDB file --- 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()