From: Jim Procter Date: Tue, 14 Sep 2021 14:51:39 +0000 (+0100) Subject: JAL-3855 detect an alphafold model and import its temperature factor as reliability X-Git-Tag: Release_2_11_2_0~37^2^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d46c8cbd1a5282ede9a0a94471f23ca002cf7df6;p=jalview.git JAL-3855 detect an alphafold model and import its temperature factor as reliability --- diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index a9c5f5c..ae8ff7a 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -45,6 +45,8 @@ import org.jmol.c.STR; import org.jmol.modelset.ModelSet; import org.jmol.viewer.Viewer; +import com.stevesoft.pat.Regex; + import mc_view.Atom; import mc_view.PDBChain; import mc_view.Residue; @@ -59,6 +61,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener { Viewer viewer = null; + private boolean alphaFoldModel; + public JmolParser(boolean immediate, Object inFile, DataSourceType sourceType) throws IOException { @@ -148,16 +152,26 @@ public class JmolParser extends StructureFile implements JmolStatusListener } return viewer; } + + public static Regex getNewAlphafoldValidator() + { + Regex validator = new Regex("(AF-[A-Z]+[0-9]+[A-Z0-9]+-F1)"); + validator.setIgnoreCase(true); + return validator; + } + public void transformJmolModelToJalview(ModelSet ms) throws IOException { try { + Regex alphaFold = getNewAlphafoldValidator(); String lastID = ""; List rna = new ArrayList(); List prot = new ArrayList(); PDBChain tmpchain; String pdbId = (String) ms.getInfo(0, "title"); + String isMMCIF = (String) ms.getInfo(0, "fileType"); if (pdbId == null) { @@ -168,6 +182,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener { setId(pdbId); setPDBIdAvailable(true); + alphaFoldModel = alphaFold.search(pdbId) && isMMCIF!=null && isMMCIF.equalsIgnoreCase("mmcif"); + } List significantAtoms = convertSignificantAtoms(ms); for (Atom tmpatom : significantAtoms) @@ -183,7 +199,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener tmpchain.atoms.addElement(tmpatom); } else { - tmpchain = new PDBChain(getId(), tmpatom.chain); + tmpchain = new PDBChain(getId(), tmpatom.chain,isAlphafoldModel()); getChains().add(tmpchain); tmpchain.atoms.addElement(tmpatom); } @@ -225,6 +241,11 @@ public class JmolParser extends StructureFile implements JmolStatusListener } } + private boolean isAlphafoldModel() + { + return alphaFoldModel; + } + private List convertSignificantAtoms(ModelSet ms) { List significantAtoms = new ArrayList(); @@ -351,7 +372,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener /** * Helper method that adds an AlignmentAnnotation for secondary structure to - * the sequence, provided at least one secondary structure prediction has been + * the sequence, provided at least one secondary structure assignment has been * made * * @param modelTitle diff --git a/src/mc_view/PDBChain.java b/src/mc_view/PDBChain.java index a3c8bee..60c289e 100755 --- a/src/mc_view/PDBChain.java +++ b/src/mc_view/PDBChain.java @@ -78,10 +78,11 @@ public class PDBChain public String pdbid = ""; - public PDBChain(String thePdbid, String theId) + public PDBChain(String thePdbid, String theId, boolean isAlphaFoldModel) { this.pdbid = thePdbid == null ? thePdbid : thePdbid.toLowerCase(); this.id = theId; + this.alphaFoldModel = isAlphaFoldModel; } /** @@ -91,6 +92,8 @@ public class PDBChain public Mapping shadowMap; + private boolean alphaFoldModel; + public void setNewlineString(String nl) { newline = nl; @@ -490,15 +493,24 @@ public class PDBChain min = Math.min(min, annots[i].value); resAnnotation.setElementAt(null, i); } - + String tfacName = "Temperature Factor"; + if (isAlphaFoldModel()) + { + tfacName = "Alphafold Reliability"; + } AlignmentAnnotation tfactorann = new AlignmentAnnotation( - "Temperature Factor", "Temperature Factor for " + pdbid + id, + tfacName, tfacName + " for " + pdbid + id, annots, min, max, AlignmentAnnotation.LINE_GRAPH); tfactorann.setSequenceRef(sequence); sequence.addAlignmentAnnotation(tfactorann); } } + private boolean isAlphaFoldModel() + { + return alphaFoldModel; + } + /** * Colour start/end of bonds by charge *
    diff --git a/src/mc_view/PDBfile.java b/src/mc_view/PDBfile.java index 04eda42..24e0435 100755 --- a/src/mc_view/PDBfile.java +++ b/src/mc_view/PDBfile.java @@ -154,7 +154,8 @@ public class PDBfile extends StructureFile tmpchain.atoms.addElement(tmpatom); } else { - tmpchain = new PDBChain(getId(), tmpatom.chain); + // PDBfile never handles alphafold models, so false + tmpchain = new PDBChain(getId(), tmpatom.chain, false); getChains().add(tmpchain); tmpchain.atoms.addElement(tmpatom); } diff --git a/test/mc_view/PDBChainTest.java b/test/mc_view/PDBChainTest.java index 0f748ce..14ec1e7 100644 --- a/test/mc_view/PDBChainTest.java +++ b/test/mc_view/PDBChainTest.java @@ -68,7 +68,7 @@ public class PDBChainTest { System.out.println("setup"); StructureImportSettings.setShowSeqFeatures(true); - c = new PDBChain("1GAQ", "A"); + c = new PDBChain("1GAQ", "A", false); } @Test(groups = { "Functional" })