From 500bc57b2d6901ff09f6b1511289f85ba9dec823 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 14 Mar 2017 15:35:50 +0000 Subject: [PATCH] JAL-2136 JAL-2137 Improved STRUCTMODEL annotation syntax to reinstated fasta file specification, improved implementation to link the Fasta mapping file to Phyre2 model entry, and moved Phyre2 model info from sequence detail to PDBEntry properties --- .../phyre2results/56da5616b4559c93/allhits.ann | 40 ++++++++++---------- src/jalview/gui/StructureChooser.java | 6 ++- src/jalview/io/AnnotationFile.java | 27 ++++++++----- src/jalview/io/SequenceAnnotationReport.java | 9 +++++ .../structure/StructureSelectionManager.java | 19 +++++++--- src/jalview/ws/phyre2/Phyre2Client.java | 19 +++++----- 6 files changed, 75 insertions(+), 45 deletions(-) diff --git a/examples/testdata/phyre2results/56da5616b4559c93/allhits.ann b/examples/testdata/phyre2results/56da5616b4559c93/allhits.ann index 1692259..a9b64f1 100644 --- a/examples/testdata/phyre2results/56da5616b4559c93/allhits.ann +++ b/examples/testdata/phyre2results/56da5616b4559c93/allhits.ann @@ -1,22 +1,22 @@ JALVIEW_ANNOTATION HIDE_INSERTIONS -STRUCTMODEL c4n58A_ c4n58A_.1.pdb 1 54 48 143 PDB Header: Hyrolase
Chain: A
PDB Molecule: Pectocin m2
PDB Title: Crystal structure of pectocin m2 at 1.86 amgtroms -STRUCTMODEL d1a70a_ d1a70a_.2.pdb 1 71 48 144 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1offa_ d1offa_.3.pdb 1 73 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1frra_ d1frra_.4.pdb 0.999 62 49 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1pfda_ d1pfda_.5.pdb 0.999 70 48 143 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1frda_ d1frda_.6.pdb 0.999 50 48 143 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1fxia_ d1fxia_.7.pdb 0.999 62 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1gaqb_ d1gaqb_.8.pdb 0.999 71 48 144 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1iuea_ d1iuea_.9.pdb 0.999 48 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1awda_ d1awda_.10.pdb 0.999 68 50 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1wria_ d1wria_.11.pdb 0.999 59 49 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d1czpa_ d1czpa_.12.pdb 0.999 64 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d2cjoa_ d2cjoa_.13.pdb 0.999 63 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL d4fxca_ d4fxca_.14.pdb 0.999 64 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related -STRUCTMODEL c4itkA_ c4itkA_.15.pdb 0.999 57 50 142 PDB Header: Electron transport
Chain: A
PDB Molecule: Apoferredoxin
PDB Title: The structure of c.reinhardtii ferredoxin 2 -STRUCTMODEL c1krhA_ c1krhA_.16.pdb 0.999 25 48 142 PDB Header: Oxidoreductase
Chain: A
PDB Molecule: Benzoate 1,2-deoxygenase reductase
PDB Title: X-ray structure of benzoate deoxygenate reductase -STRUCTMODEL d1krha3 d1krha3.17.pdb 0.999 24 48 143 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin domains from multi domain proteins -STRUCTMODEL d1jq4a_ d1jq4a_.18.pdb 0.999 29 47 138 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin domains from multi domain proteins -STRUCTMODEL c4wqmA_ c4wqmA_.19.pdb 0.999 28 49 144 PDB header: Oxidoreductase
Chain: A
PDB Molecule: Toluene-4-monooxygenase electron transfer component
PDB Title: Structure of the toluene 4-monooxygenase nah oxidoreductase t4mof,2 k270s k271s variant -STRUCTMODEL c2piaA_ c2piaA_.20.pdb 0.999 22 1 136 PDB header: Reductase
Chain: A
PDB Molecule: Phthalate deoxygenase reductase
PDB Title: Phthalate deoxygenate reductase: a modular structure for2 electron transfer from pyridine nucleotides to [2fe-2s] \ No newline at end of file +STRUCTMODEL c4n58A_ c4n58A_.1.pdb c4n58A_.1.fasta 1 54 48 143 PDB Header: Hyrolase
Chain: A
PDB Molecule: Pectocin m2
PDB Title: Crystal structure of pectocin m2 at 1.86 amgtroms +STRUCTMODEL d1a70a_ d1a70a_.2.pdb d1a70a_.2.fasta 1 71 48 144 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1offa_ d1offa_.3.pdb d1offa_.3.fasta 1 73 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1frra_ d1frra_.4.pdb d1frra_.4.fasta 0.999 62 49 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1pfda_ d1pfda_.5.pdb d1pfda_.5.fasta 0.999 70 48 143 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1frda_ d1frda_.6.pdb d1frda_.6.fasta 0.999 50 48 143 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1fxia_ d1fxia_.7.pdb d1fxia_.7.fasta 0.999 62 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1gaqb_ d1gaqb_.8.pdb d1gaqb_.8.fasta 0.999 71 48 144 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1iuea_ d1iuea_.9.pdb d1iuea_.9.fasta 0.999 48 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1awda_ d1awda_.10.pdb d1awda_.10.fasta 0.999 68 50 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1wria_ d1wria_.11.pdb d1wria_.11.fasta 0.999 59 49 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d1czpa_ d1czpa_.12.pdb d1czpa_.12.fasta 0.999 64 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d2cjoa_ d2cjoa_.13.pdb d2cjoa_.13.fasta 0.999 63 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL d4fxca_ d4fxca_.14.pdb d4fxca_.14.fasta 0.999 64 48 142 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin-related +STRUCTMODEL c4itkA_ c4itkA_.15.pdb c4itkA_.15.fasta 0.999 57 50 142 PDB Header: Electron transport
Chain: A
PDB Molecule: Apoferredoxin
PDB Title: The structure of c.reinhardtii ferredoxin 2 +STRUCTMODEL c1krhA_ c1krhA_.16.pdb c1krhA_.16.fasta 0.999 25 48 142 PDB Header: Oxidoreductase
Chain: A
PDB Molecule: Benzoate 1,2-deoxygenase reductase
PDB Title: X-ray structure of benzoate deoxygenate reductase +STRUCTMODEL d1krha3 d1krha3.17.pdb d1krha3.17.fasta 0.999 24 48 143 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin domains from multi domain proteins +STRUCTMODEL d1jq4a_ d1jq4a_.18.pdb d1jq4a_.18.fasta 0.999 29 47 138 Fold: Beta-Grasp (ubiquitin-like)
Superfamily: 2Fe-2S ferredoxin-like
Family: 2Fe-2S ferredoxin domains from multi domain proteins +STRUCTMODEL c4wqmA_ c4wqmA_.19.pdb c4wqmA_.19.fasta 0.999 28 49 144 PDB header: Oxidoreductase
Chain: A
PDB Molecule: Toluene-4-monooxygenase electron transfer component
PDB Title: Structure of the toluene 4-monooxygenase nah oxidoreductase t4mof,2 k270s k271s variant +STRUCTMODEL c2piaA_ c2piaA_.20.pdb c2piaA_.20.fasta 0.999 22 1 136 PDB header: Reductase
Chain: A
PDB Molecule: Phthalate deoxygenase reductase
PDB Title: Phthalate deoxygenate reductase: a modular structure for2 electron transfer from pyridine nucleotides to [2fe-2s] \ No newline at end of file diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 66fe431..a3f739a 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -907,11 +907,15 @@ public class StructureChooser extends GStructureChooser implements String templateId = getPhyreResultTable().getValueAt(row, templateColIndex).toString(); String structureFile = phyre2ResultDirectory + templateId; + String fastaMapping = phyre2ResultDirectory + + templateId.replaceAll(".pdb", ".fasta"); + // System.out.println("structure file >>>>> " + structureFile); + // System.out.println("fasta mapping >>>>> " + fastaMapping); pdbEntriesToView[count++] = new AssociateStructureFileWithSeq() .associateStructureWithSeq(structureFile, DataSourceType.FILE, selectedSequence, true, Desktop.instance); - ssm.registerPhyre2Template(structureFile); + ssm.registerPhyre2Template(structureFile, fastaMapping); } final StructureSelectionManager ssm = ap diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index c1ddeed..571ed79 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -1017,7 +1017,8 @@ public class AnnotationFile { boolean failedtoadd = true; // expect - // STRUCTMODEL <%.I.D> + // STRUCTMODEL + // <%.I.D> // [] if (st.hasMoreTokens()) { refSeq = al.findName(refSeqId = st.nextToken()); @@ -1030,12 +1031,14 @@ public class AnnotationFile else { String tempId = st.nextToken(); + String fastaMapping = st.nextToken(); String confidence = 100 * Double.valueOf(st.nextToken()) + ""; String pid = st.nextToken(); String alignRange = st.nextToken() + "-" + st.nextToken(); String otherInfo = st.hasMoreTokens() ? st.nextToken() : ""; String coverage = ""; - if (add_structmodel(al, refSeq, tempId, alignRange, coverage, + if (add_structmodel(al, refSeq, tempId, fastaMapping, + alignRange, coverage, confidence, pid, otherInfo)) { failedtoadd = false; @@ -1045,7 +1048,7 @@ public class AnnotationFile if (failedtoadd) { System.err - .println("Need <%.I.D> [] as tab separated fields after" + .println("Need <%.I.D> [] as tab separated fields after" + STRUCTMODEL + ".\nNote: other information could be provided in html format "); } else { @@ -1263,22 +1266,26 @@ public class AnnotationFile * @return true if model and sequence was added */ private boolean add_structmodel(AlignmentI al, SequenceI refSeq, - String tempId, String aRange, String coverage, String confidence, + String modelFile, String fastaFile, String aRange, + String coverage, String confidence, String pid, String otherInfo) { String warningMessage = null; boolean added = false; try { - String pdbFile = baseUri + tempId; - PDBEntry phyre2PDBEntry = new PDBEntry(tempId, null, Type.FILE, - pdbFile); - refSeq.getDatasetSequence().addPDBId(phyre2PDBEntry); + String structureModelFile = resolveAbsolute(modelFile); + String fastaMappingFile = resolveAbsolute(fastaFile); + // System.out.println("Model File >> " + fastaMappingFile); + // System.out.println("Fasta File >> " + structureModelFile); + PDBEntry phyre2PDBEntry = new PDBEntry(modelFile, null, Type.FILE, + structureModelFile); String phyre2ModelDesc = generatePhyre2InfoHTMLTable(aRange, coverage, confidence, pid, otherInfo); - refSeq.setDescription(phyre2ModelDesc); + phyre2PDBEntry.setProperty("PHYRE2_MODEL_INFO", phyre2ModelDesc); + refSeq.getDatasetSequence().addPDBId(phyre2PDBEntry); StructureSelectionManager ssm = StructureSelectionManager .getStructureSelectionManager(Desktop.instance); - ssm.registerPhyre2Template(pdbFile); + ssm.registerPhyre2Template(structureModelFile, fastaMappingFile); added = true; } catch (Exception x) diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 6c8f40f..a855aa2 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -22,6 +22,7 @@ package jalview.io; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; +import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.io.gff.GffConstants; @@ -449,6 +450,14 @@ public class SequenceAnnotationReport } } sb.append(""); + + for (PDBEntry pdb : ds.getAllPDBEntries()) + { + if (pdb != null && pdb.getProperty("PHYRE2_MODEL_INFO") != null) + { + sb.append(pdb.getProperty("PHYRE2_MODEL_INFO")); + } + } return maxWidth; } diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index addf310..671c325 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -50,6 +50,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; +import java.util.Hashtable; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; @@ -89,7 +90,7 @@ public class StructureSelectionManager private List sel_listeners = new ArrayList(); - private List phyre2ModelTemplates = new ArrayList(); + private Map phyre2ModelTemplates = new Hashtable(); /** * @return true if will try to use external services for processing secondary @@ -600,7 +601,8 @@ public class StructureSelectionManager setProgressBar(MessageManager .getString("status.obtaining_mapping_with_phyre2_template_alignment")); StructureMapping phyre2ModelMapping = new Phyre2Client(pdb) - .getStructureMapping(seq, pdbFile, " "); + .getStructureMapping(seq, pdbFile, + getPhyre2FastaFileFor(pdbFile), " "); seqToStrucMapping.add(phyre2ModelMapping); ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); @@ -628,9 +630,10 @@ public class StructureSelectionManager return pdb; } - public void registerPhyre2Template(String phyre2Template) + public void registerPhyre2Template(String phyre2Template, + String fastaMappingFile) { - phyre2ModelTemplates.add(phyre2Template); + phyre2ModelTemplates.put(phyre2Template, fastaMappingFile); } /** @@ -1400,7 +1403,13 @@ public class StructureSelectionManager { return false; } - return (phyre2ModelTemplates.contains(structureFile)); + return phyre2ModelTemplates.get(structureFile) != null + && !phyre2ModelTemplates.get(structureFile).isEmpty(); + } + + public String getPhyre2FastaFileFor(String structureFile) + { + return phyre2ModelTemplates.get(structureFile); } diff --git a/src/jalview/ws/phyre2/Phyre2Client.java b/src/jalview/ws/phyre2/Phyre2Client.java index e980a19..a54c924 100644 --- a/src/jalview/ws/phyre2/Phyre2Client.java +++ b/src/jalview/ws/phyre2/Phyre2Client.java @@ -34,11 +34,20 @@ public class Phyre2Client extends StructureMappingClient private final static String PATH_SEPARATOR = File.separator; + private String fastaMappingFile; + public Phyre2Client(StructureFile structureFile) { this.structureFile = structureFile; } + public StructureMapping getStructureMapping(SequenceI seq, + String pdbFile, String fMappingFile, String chain) + { + this.fastaMappingFile = fMappingFile; + return getStructureMapping(seq, pdbFile, chain); + } + @Override public StructureMapping getStructureMapping(SequenceI seq, String pdbFile, String chain) @@ -157,11 +166,7 @@ public class Phyre2Client extends StructureMappingClient private String getFastaMappingFile() { - File phyre2ModelFile = new File(structureFile.getDataName()); - String phyre2ModelResultDir = phyre2ModelFile.getParent(); - String modelId = structureFile.getId().substring(0, - structureFile.getId().lastIndexOf(".pdb")); - return phyre2ModelResultDir + PATH_SEPARATOR + modelId + ".fasta"; + return fastaMappingFile; } @Override @@ -279,10 +284,6 @@ public class Phyre2Client extends StructureMappingClient output.append(NEWLINE).append(NEWLINE); } float pid = (float) matchedSeqCount / seqRes.length() * 100; - // if (pid < SiftsSettings.getFailSafePIDThreshold()) - // { - // throw new Exception(">>> Low PID detected for Phyre2 mapping..."); - // } output.append("Length of alignment = " + seqRes.length()).append( NEWLINE); output.append(new Format("Percentage ID = %2.2f").form(pid)); -- 1.7.10.2