JAL-2136 JAL-2137 Improved STRUCTMODEL annotation syntax to reinstated fasta file...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 14 Mar 2017 15:35:50 +0000 (15:35 +0000)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 14 Mar 2017 15:35:50 +0000 (15:35 +0000)
examples/testdata/phyre2results/56da5616b4559c93/allhits.ann
src/jalview/gui/StructureChooser.java
src/jalview/io/AnnotationFile.java
src/jalview/io/SequenceAnnotationReport.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/ws/phyre2/Phyre2Client.java

index 1692259..a9b64f1 100644 (file)
@@ -1,22 +1,22 @@
 JALVIEW_ANNOTATION
 HIDE_INSERTIONS
-STRUCTMODEL    c4n58A_ c4n58A_.1.pdb   1       54      48      143     <b>PDB Header: </b>Hyrolase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Pectocin m2<br> <b>PDB Title: </b>Crystal structure of pectocin m2 at 1.86 amgtroms
-STRUCTMODEL    d1a70a_ d1a70a_.2.pdb   1       71      48      144     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1offa_ d1offa_.3.pdb   1       73      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1frra_ d1frra_.4.pdb   0.999   62      49      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1pfda_ d1pfda_.5.pdb   0.999   70      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1frda_ d1frda_.6.pdb   0.999   50      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1fxia_ d1fxia_.7.pdb   0.999   62      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1gaqb_ d1gaqb_.8.pdb   0.999   71      48      144     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1iuea_ d1iuea_.9.pdb   0.999   48      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1awda_ d1awda_.10.pdb  0.999   68      50      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1wria_ d1wria_.11.pdb  0.999   59      49      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d1czpa_ d1czpa_.12.pdb  0.999   64      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d2cjoa_ d2cjoa_.13.pdb  0.999   63      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    d4fxca_ d4fxca_.14.pdb  0.999   64      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    c4itkA_ c4itkA_.15.pdb  0.999   57      50      142     <b>PDB Header: </b>Electron transport<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Apoferredoxin <br><b>PDB Title: </b>The structure of c.reinhardtii ferredoxin 2
-STRUCTMODEL    c1krhA_ c1krhA_.16.pdb  0.999   25      48      142     <b>PDB Header: </b>Oxidoreductase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Benzoate 1,2-deoxygenase reductase <br> <b>PDB Title: </b>X-ray structure of benzoate deoxygenate reductase
-STRUCTMODEL    d1krha3 d1krha3.17.pdb  0.999   24      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins
-STRUCTMODEL    d1jq4a_ d1jq4a_.18.pdb  0.999   29      47      138     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins
-STRUCTMODEL    c4wqmA_ c4wqmA_.19.pdb  0.999   28      49      144     <b>PDB header: </b>Oxidoreductase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Toluene-4-monooxygenase electron transfer component<br><b>PDB Title: </b>Structure of the toluene 4-monooxygenase nah oxidoreductase t4mof,2 k270s k271s variant
-STRUCTMODEL    c2piaA_ c2piaA_.20.pdb  0.999   22      1       136     <b>PDB header: </b>Reductase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Phthalate deoxygenase reductase<br><b>PDB Title: </b>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     <b>PDB Header: </b>Hyrolase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Pectocin m2<br> <b>PDB Title: </b>Crystal structure of pectocin m2 at 1.86 amgtroms
+STRUCTMODEL    d1a70a_ d1a70a_.2.pdb   d1a70a_.2.fasta 1       71      48      144     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1offa_ d1offa_.3.pdb   d1offa_.3.fasta 1       73      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1frra_ d1frra_.4.pdb   d1frra_.4.fasta 0.999   62      49      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1pfda_ d1pfda_.5.pdb   d1pfda_.5.fasta 0.999   70      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1frda_ d1frda_.6.pdb   d1frda_.6.fasta 0.999   50      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1fxia_ d1fxia_.7.pdb   d1fxia_.7.fasta 0.999   62      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1gaqb_ d1gaqb_.8.pdb   d1gaqb_.8.fasta 0.999   71      48      144     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1iuea_ d1iuea_.9.pdb   d1iuea_.9.fasta 0.999   48      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1awda_ d1awda_.10.pdb  d1awda_.10.fasta        0.999   68      50      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1wria_ d1wria_.11.pdb  d1wria_.11.fasta        0.999   59      49      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d1czpa_ d1czpa_.12.pdb  d1czpa_.12.fasta        0.999   64      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d2cjoa_ d2cjoa_.13.pdb  d2cjoa_.13.fasta        0.999   63      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    d4fxca_ d4fxca_.14.pdb  d4fxca_.14.fasta        0.999   64      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    c4itkA_ c4itkA_.15.pdb  c4itkA_.15.fasta        0.999   57      50      142     <b>PDB Header: </b>Electron transport<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Apoferredoxin <br><b>PDB Title: </b>The structure of c.reinhardtii ferredoxin 2
+STRUCTMODEL    c1krhA_ c1krhA_.16.pdb  c1krhA_.16.fasta        0.999   25      48      142     <b>PDB Header: </b>Oxidoreductase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Benzoate 1,2-deoxygenase reductase <br> <b>PDB Title: </b>X-ray structure of benzoate deoxygenate reductase
+STRUCTMODEL    d1krha3 d1krha3.17.pdb  d1krha3.17.fasta        0.999   24      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins
+STRUCTMODEL    d1jq4a_ d1jq4a_.18.pdb  d1jq4a_.18.fasta        0.999   29      47      138     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins
+STRUCTMODEL    c4wqmA_ c4wqmA_.19.pdb  c4wqmA_.19.fasta        0.999   28      49      144     <b>PDB header: </b>Oxidoreductase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Toluene-4-monooxygenase electron transfer component<br><b>PDB Title: </b>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     <b>PDB header: </b>Reductase<br><b>Chain: </b>A<br><b>PDB Molecule: </b>Phthalate deoxygenase reductase<br><b>PDB Title: </b>Phthalate deoxygenate reductase: a modular structure for2 electron transfer from pyridine nucleotides to [2fe-2s]
\ No newline at end of file
index 66fe431..a3f739a 100644 (file)
@@ -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
index c1ddeed..571ed79 100755 (executable)
@@ -1017,7 +1017,8 @@ public class AnnotationFile
         {
           boolean failedtoadd = true;
           // expect
-          // STRUCTMODEL <TemplateSeqId> <TemplateFileName> <Confidence> <%.I.D>
+          // STRUCTMODEL <TemplateSeqId> <ModelFile> <FastaMappingFile>
+          // <Confidence> <%.I.D>
           // <MatchStart> <MatchEnd> <Coverage> [<Other Information>]
           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 <TemplateSeqId> <TemplateFileName> <Confidence> <%.I.D> <MatchStart> <MatchEnd> <Coverage> [<Other Information>] as tab separated fields after"
+                    .println("Need <TemplateSeqId> <ModelFile> <FastaMappingFile> <Confidence> <%.I.D> <MatchStart> <MatchEnd> <Coverage> [<Other Information>] 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)
index 6c8f40f..a855aa2 100644 (file)
@@ -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("</i>");
+
+    for (PDBEntry pdb : ds.getAllPDBEntries())
+    {
+      if (pdb != null && pdb.getProperty("PHYRE2_MODEL_INFO") != null)
+      {
+        sb.append(pdb.getProperty("PHYRE2_MODEL_INFO"));
+      }
+    }
     return maxWidth;
   }
 
index addf310..671c325 100644 (file)
@@ -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<SelectionListener> sel_listeners = new ArrayList<SelectionListener>();
 
-  private List<String> phyre2ModelTemplates = new ArrayList<String>();
+  private Map<String, String> phyre2ModelTemplates = new Hashtable<String, String>();
 
   /**
    * @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);
   }
 
 
index e980a19..a54c924 100644 (file)
@@ -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));