transfer of residue numbering as alignment annotation
authorjprocter <Jim Procter>
Wed, 25 Apr 2007 11:50:51 +0000 (11:50 +0000)
committerjprocter <Jim Procter>
Wed, 25 Apr 2007 11:50:51 +0000 (11:50 +0000)
src/MCview/PDBChain.java
src/jalview/structure/StructureSelectionManager.java

index aa404cc..33944fd 100755 (executable)
@@ -25,6 +25,7 @@ import java.awt.*;
 import jalview.analysis.*;
 import jalview.datamodel.*;
 import jalview.schemes.*;
+import jalview.structure.StructureMapping;
 
 public class PDBChain
 {
@@ -94,7 +95,6 @@ public class PDBChain
       }
     }
   }
-
   /**
    * copy over the RESNUM seqfeatures from the internal chain sequence to the mapped sequence
    * @param seq
@@ -237,7 +237,7 @@ public class PDBChain
                               "", offset + count, offset + count,
                               MCview.PDBChain.PDBFILEFEATURE);
       resFeatures.addElement(sf);
-      resAnnotation.addElement(new Annotation("","",'\0',tmpat.tfactor));
+      resAnnotation.addElement(new Annotation(tmpat.tfactor));
       // Keep totting up the sequence
       if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null)
       {
@@ -375,4 +375,51 @@ public class PDBChain
       tmp.endCol = col;
     }
   }
+
+  public AlignmentAnnotation[] transferResidueAnnotation(SequenceI seq, String status)
+  {
+    AlignmentAnnotation[] transferred = null;
+    
+    return transferred;
+    
+  }
+
+  /**
+   * copy any sequence annotation onto the sequence mapped using the provided StructureMapping
+   * @param mapping
+   */
+  public void transferResidueAnnotation(StructureMapping mapping)
+  {
+    SequenceI sq = mapping.getSequence();
+    if (sq!=null)
+    {
+      if (sequence!=null && sequence.getAnnotation()!=null)
+      {
+        
+      }
+      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++)
+      {
+        int prn = mapping.getPDBResNum(k+1);
+
+        an[k] = new Annotation((float)prn);
+        if (min==-1)
+        {
+          min=k;
+          max=k;
+        } else {
+          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, (float)min,(float)max, AlignmentAnnotation.LINE_GRAPH));
+    }
+  }
 }
index c0ab6f9..550fce0 100644 (file)
@@ -184,10 +184,11 @@ public class StructureSelectionManager
 
       if(protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
         pdbFile = "INLINE"+pdb.id;
-
+      
       mappings[mappings.length - 1]
           = new StructureMapping(sequence[s], pdbFile, pdb.id, maxChainId,
                                  mapping, mappingDetails.toString());
+      maxChain.transferResidueAnnotation(mappings[mappings.length-1]);
     }
     /////////