note to callers of adjustPanelHeight
[jalview.git] / src / MCview / PDBChain.java
index c1c586a..a556137 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -204,6 +204,8 @@ public class PDBChain
   public void makeResidueList()
   {
     int count = 0;
+    Object symbol;
+    boolean nucleotide=false;
     StringBuffer seq = new StringBuffer();
     Vector resFeatures = new Vector();
     Vector resAnnotation = new Vector();
@@ -250,22 +252,30 @@ public class PDBChain
       SequenceFeature sf = new SequenceFeature("RESNUM", tmpat.resName
               + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
               + count, offset + count, pdbid);
-
       // MCview.PDBChain.PDBFILEFEATURE);
       resFeatures.addElement(sf);
       resAnnotation.addElement(new Annotation(tmpat.tfactor));
       // Keep totting up the sequence
-      if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null)
+      if ((symbol=ResidueProperties.getAA3Hash().get(tmpat.resName)) == null)
       {
-        seq.append("X");
+        if (ResidueProperties.nucleotideIndex[tmpat.resName.charAt(0)]==-1)
+        {
+          seq.append("X");
         // System.err.println("PDBReader:Null aa3Hash for " +
         // tmpat.resName);
+        } else {
+          // nucleotide flag
+          nucleotide=true;
+          seq.append(tmpat.resName.charAt(0));
+        }
       }
       else
       {
-
-        seq.append(ResidueProperties.aa[((Integer) ResidueProperties
-                .getAA3Hash().get(tmpat.resName)).intValue()]);
+        if (nucleotide)
+        {
+          System.err.println("Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!");
+        }
+        seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]);
       }
       count++;
     }
@@ -279,6 +289,10 @@ public class PDBChain
                                                                         // resNumber-offset
                                                                         // ~=
                                                                         // seq.size()
+    // Add normalised feature scores to RESNUM indicating start/end of sequence
+    //      sf.setScore(offset+count);
+                                                                           
+                                                                       
     // System.out.println("PDB Sequence is :\nSequence = " + seq);
     // System.out.println("No of residues = " + residues.size());
     for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
@@ -297,7 +311,7 @@ public class PDBChain
       resAnnotation.setElementAt(null, i);
     }
     AlignmentAnnotation tfactorann = new AlignmentAnnotation(
-            "PDB.CATempFactor", "CA Temperature Factor for "
+            "PDB.TempFactor", "Temperature Factor for "
                     + sequence.getName(), annots, 0, max,
             AlignmentAnnotation.LINE_GRAPH);
     tfactorann.setSequenceRef(sequence);