tfactor and occupancy extracted from PDB file, and tfactor added as sequence associat...
authorjprocter <Jim Procter>
Thu, 19 Apr 2007 16:17:39 +0000 (16:17 +0000)
committerjprocter <Jim Procter>
Thu, 19 Apr 2007 16:17:39 +0000 (16:17 +0000)
src/MCview/Atom.java
src/MCview/PDBChain.java

index f8fb9b4..e22b94e 100755 (executable)
@@ -36,7 +36,8 @@ public class Atom
   public String chain;
   public int alignmentMapping = -1;
   public int atomIndex;
-
+  public float occupancy=0;
+  public float tfactor=0;
   public boolean isSelected = false;
 
   public Atom(String str)
@@ -55,7 +56,8 @@ public class Atom
     this.x = (float) (new Float(str.substring(30, 38).trim()).floatValue());
     this.y = (float) (new Float(str.substring(38, 46).trim()).floatValue());
     this.z = (float) (new Float(str.substring(47, 55).trim()).floatValue());
-
+    occupancy = (float) (new Float(str.substring(54,60).trim()).floatValue());
+    tfactor = (float) (new Float(str.substring(60,66).trim()).floatValue());
   }
 
   public Atom(float x, float y, float z)
index 76a0cde..8441a2d 100755 (executable)
@@ -189,6 +189,7 @@ public class PDBChain
     int count = 0;
     StringBuffer seq = new StringBuffer();
     Vector resFeatures = new Vector();
+    Vector resAnnotation = new Vector();
     int i, iSize = atoms.size() - 1;
     int resNumber = -1;
     for (i = 0; i <= iSize; i++)
@@ -236,6 +237,7 @@ public class PDBChain
                               "", offset + count, offset + count,
                               MCview.PDBChain.PDBFILEFEATURE);
       resFeatures.addElement(sf);
+      resAnnotation.addElement(new Annotation("","",'\0',tmpat.tfactor));
       // Keep totting up the sequence
       if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null)
       {
@@ -266,6 +268,19 @@ public class PDBChain
       sequence.addSequenceFeature( (SequenceFeature) resFeatures.elementAt(i));
       resFeatures.setElementAt(null, i);
     }
+    Annotation[] annots = new Annotation[resAnnotation.size()];
+    float max=0;
+    for (i=0,iSize=annots.length; i<iSize; i++)
+    {
+      annots[i] = (Annotation) resAnnotation.elementAt(i);
+      if (annots[i].value>max)
+        max = annots[i].value;
+      resAnnotation.setElementAt(null, i);
+    }
+    AlignmentAnnotation tfactorann = new AlignmentAnnotation("PDB.CATempFactor","CA Temperature Factor", 
+            annots, 0, max, AlignmentAnnotation.LINE_GRAPH);
+    tfactorann.setSequenceRef(sequence);
+    sequence.addAlignmentAnnotation(tfactorann);
   }
 
   public void setChargeColours()