JAL-1065 - ensure null entries in annotation row so T-COFFEE annotation can be reloca...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 24 May 2012 17:51:24 +0000 (18:51 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 24 May 2012 17:51:24 +0000 (18:51 +0100)
src/jalview/io/TCoffeeScoreFile.java

index ed0f1d9..0da4628 100644 (file)
@@ -470,17 +470,29 @@ public class TCoffeeScoreFile extends AlignFile {
            Annotation[] annotations=new Annotation[al.getWidth()];
            for (int j=0;j<jSize;j++) {
              byte val = srow[j];
-             annotations[j]=new Annotation(s==null ? ""+val:null,s==null ? ""+val:null,(char) val,val*1f,val >= 0 && val < colors.length ? colors[val] : Color.white);
+             if (s!=null && jalview.util.Comparison.isGap(s.getCharAt(j)))
+             {
+               annotations[j]=null;
+               if (val>0)
+               {
+                 System.err.println("Warning: non-zero value for positional T-COFFEE score for gap at "+j+" in sequence "+s.getName());
+               }
+             } else {
+             annotations[j]=new Annotation(s==null ? ""+val:null,s==null ? ""+val:null,'\0',val*1f,val >= 0 && val < colors.length ? colors[val] : Color.white);
+             }
            }
            // this will overwrite any existing t-coffee scores for the alignment
            AlignmentAnnotation aa=al.findOrCreateAnnotation(TCOFFEE_SCORE,false,s,null);
            if (s!=null)
            {
              aa.label="T-COFFEE";
-             aa.description="Score for "+id.getKey();
+             aa.description=""+id.getKey();
              aa.annotations=annotations;
              aa.visible=false;
              aa.belowAlignment=false;
+              aa.createSequenceMapping(s, s.getStart(),true);
+              s.addAlignmentAnnotation(aa);
+              aa.adjustForAlignment();
            } else {
              aa.graph=AlignmentAnnotation.NO_GRAPH;
              aa.label="T-COFFEE";
@@ -490,7 +502,6 @@ public class TCoffeeScoreFile extends AlignFile {
              aa.visible=true;
            }
            aa.showAllColLabels=true;
-            aa.setSequenceRef(s);
            aa.validateRangeAndDisplay();
            added=true;
          }