Merge branch 'JAL-674_fixannotlabels' into Release_2_8_2_Branch
authorJim Procter <jprocter@dundee.ac.uk>
Wed, 26 Nov 2014 14:52:59 +0000 (14:52 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Wed, 26 Nov 2014 14:52:59 +0000 (14:52 +0000)
src/MCview/PDBChain.java
src/MCview/PDBfile.java
src/jalview/ext/jmol/PDBFileWithJmol.java
src/jalview/gui/AnnotationLabels.java
src/jalview/io/RnamlFile.java

index e8f1bc9..408108b 100755 (executable)
@@ -392,8 +392,8 @@ public class PDBChain
       }
 
       AlignmentAnnotation tfactorann = new AlignmentAnnotation(
-              "PDB.TempFactor", "Temperature Factor for "
-                      + sequence.getName(), annots, 0, max,
+              "Temperature Factor", "Temperature Factor for " + pdbid + id,
+              annots, 0, max,
               AlignmentAnnotation.LINE_GRAPH);
       tfactorann.setSequenceRef(sequence);
       sequence.addAlignmentAnnotation(tfactorann);
@@ -552,34 +552,37 @@ public class PDBChain
         }
       }
       }
-      float min = -1, max = 0;
-      Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
-      for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
+      if (false)
       {
-        int prn = mapping.getPDBResNum(k + 1);
-
-        an[k] = new Annotation(prn);
-        if (min == -1)
+        // Useful for debugging mappings - adds annotation for mapped position
+        float min = -1, max = 0;
+        Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
+        for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
         {
-          min = k;
-          max = k;
-        }
-        else
-        {
-          if (min > k)
+          int prn = mapping.getPDBResNum(k + 1);
+
+          an[k] = new Annotation(prn);
+          if (min == -1)
           {
             min = k;
+            max = k;
           }
-          else if (max < k)
+          else
           {
-            max = k;
+            if (min > k)
+            {
+              min = k;
+            }
+            else if (max < k)
+            {
+              max = k;
+            }
           }
         }
+        sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
+                "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
+                an, min, max, AlignmentAnnotation.LINE_GRAPH));
       }
-      sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
-              "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
-              an, min, max, AlignmentAnnotation.LINE_GRAPH));
-
     }
   }
 }
index e1c4dc5..691fdcd 100755 (executable)
@@ -361,8 +361,8 @@ public class PDBfile extends jalview.io.AlignFile
           AlignmentI al, String pep, boolean b)
   {
     List<List<? extends Object>> replaced = AlignSeq
-            .replaceMatchingSeqsWith(seqs, annotations, prot, al,
-                    AlignSeq.PEP, false);
+            .replaceMatchingSeqsWith(seqs, annotations, prot, al, pep,
+                    false);
     for (PDBChain ch : chains)
     {
       int p = 0;
index 9fa6bf4..f5710d3 100644 (file)
@@ -186,9 +186,12 @@ public class PDBFileWithJmol extends AlignFile implements
                   seqs.add(sq);
                   if (!isNa)
                   {
+                    String mt = model.getModelTitle() == null ? getDataName()
+                            : model.getModelTitle();
+                    mt += _lastChainId;
                     AlignmentAnnotation ann = new AlignmentAnnotation(
                             "Secondary Structure",
-                            "Secondary Structure from PDB File", asecstr);
+                            "Secondary Structure for " + mt, asecstr);
                     ann.belowAlignment=true;
                     ann.visible=true;
                     ann.autoCalculated=false;
index ad6f9e5..6e8417f 100755 (executable)
@@ -478,20 +478,29 @@ public class AnnotationLabels extends JPanel implements MouseListener,
         {
           desc.append("<br/>");
         }
-
+        // if (aa.hasProperties())
+        // {
+        // desc.append("<table>");
+        // for (String prop : aa.getProperties())
+        // {
+        // desc.append("<tr><td>" + prop + "</td><td>"
+        // + aa.getProperty(prop) + "</td><tr>");
+        // }
+        // desc.append("</table>");
+        // }
       }
       else
       {
         // begin the tooltip's html fragment
         desc.append("<html>");
+        if (aa.hasScore())
+        {
+          // TODO: limit precision of score to avoid noise from imprecise
+          // doubles
+          // (64.7 becomes 64.7+/some tiny value).
+          desc.append(" Score: " + aa.score);
+        }
       }
-      if (aa.hasScore())
-      {
-        // TODO: limit precision of score to avoid noise from imprecise doubles
-        // (64.7 becomes 64.7+/some tiny value).
-        desc.append(" Score: " + aa.score);
-      }
-
       if (desc.length() > 6)
       {
         desc.append("</html>");
@@ -502,7 +511,6 @@ public class AnnotationLabels extends JPanel implements MouseListener,
         this.setToolTipText(null);
       }
     }
-
   }
 
   /**
index 9f0c8d5..c075fda 100644 (file)
@@ -167,8 +167,11 @@ public class RnamlFile extends AlignFile
                         annot[k]).charAt(0), 0f);
       }
 
-      AlignmentAnnotation align = new AlignmentAnnotation("Sec. str.",
-              current.getID(), ann);
+      AlignmentAnnotation align = new AlignmentAnnotation(
+              "Secondary Structure",
+              current.getID().trim().length() > 0 ? "Secondary Structure for "
+                      + current.getID()
+                      : "", ann);
 
       seqs[i].addAlignmentAnnotation(align);
       seqs[i].setRNA(result.get(i));