Merge branch 'releases/Release_2_11_3_Branch'
[jalview.git] / src / mc_view / PDBChain.java
index dc25368..2970ccf 100755 (executable)
@@ -28,6 +28,7 @@ import java.util.Vector;
 import jalview.analysis.AlignSeq;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
+import jalview.datamodel.ContactMatrixI;
 import jalview.datamodel.Mapping;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceFeature;
@@ -38,6 +39,7 @@ import jalview.schemes.ResidueProperties;
 import jalview.structure.StructureImportSettings;
 import jalview.structure.StructureMapping;
 import jalview.util.Comparison;
+import jalview.ws.datamodel.MappableContactMatrixI;
 
 public class PDBChain
 {
@@ -81,7 +83,7 @@ public class PDBChain
   public String pdbid = "";
 
   AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder(
-          "TemperatureFactor");
+          "Temperature Factor");
 
   public PDBChain(String thePdbid, String theId,
           AnnotationRowBuilder template)
@@ -535,6 +537,7 @@ public class PDBChain
                       ? tfacTemplate.getDescription()
                       : tfacTemplate.getName()) + " for " + pdbid + id,
               annots, min, max, AlignmentAnnotation.LINE_GRAPH);
+      tfactorann.setTFType(tfacTemplate.getTFType());
       tfactorann.setCalcId(getClass().getName());
 
       tfactorann.setSequenceRef(sequence);
@@ -664,10 +667,16 @@ public class PDBChain
                   ana.getCalcId(), ana.label, ana.description);
           if (transfer == null || transfer.size() == 0)
           {
+            ContactMatrixI cm = shadow.getContactMatrixFor(ana);
             ana = new AlignmentAnnotation(ana);
+            // TODO map contact matrix under mapping
             ana.liftOver(sequence, shadowMap);
             ana.liftOver(dsq, sqmpping);
             dsq.addAlignmentAnnotation(ana);
+            if (cm != null)
+            {
+              dsq.addContactListFor(ana, cm);
+            }
           }
           else
           {
@@ -688,10 +697,15 @@ public class PDBChain
                             ana.description);
             if (transfer == null || transfer.size() == 0)
             {
+              ContactMatrixI cm = sequence.getContactMatrixFor(ana);
               ana = new AlignmentAnnotation(ana);
               ana.liftOver(dsq, sqmpping);
               dsq.addAlignmentAnnotation(ana);
-              // mapping.transfer(ana);
+              if (cm != null && cm instanceof MappableContactMatrixI)
+              {
+                dsq.addContactListFor(ana, ((MappableContactMatrixI) cm)
+                        .liftOver(dsq, sqmpping));
+              }
             }
             else
             {
@@ -705,8 +719,8 @@ public class PDBChain
         // 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++)
+        for (int i = sq.getStart(), j = sq
+                .getEnd(), k = 0; i <= j; i++, k++)
         {
           int prn = mapping.getPDBResNum(k + 1);