na pdb: recognise NA residue names
authorjprocter <Jim Procter>
Fri, 30 Oct 2009 10:22:45 +0000 (10:22 +0000)
committerjprocter <Jim Procter>
Fri, 30 Oct 2009 10:22:45 +0000 (10:22 +0000)
src/MCview/PDBChain.java

index 61ad26a..a556137 100755 (executable)
@@ -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();
@@ -254,17 +256,26 @@ public class PDBChain
       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++;
     }
@@ -300,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);