- public TCoffeeColourScheme(TCoffeeScoreFile scoreFile) {
-
- scoreMatrix = scoreFile != null ? scoreFile.getScoresArray() : null;
-
+ public TCoffeeColourScheme(AnnotatedCollectionI alignment) {
+ alignmentChanged(alignment);
+ }
+ @Override public void alignmentChanged(AnnotatedCollectionI alignment)
+ {
+ // assume only one set of TCOFFEE scores - but could have more than one potentially.
+ ArrayList<AlignmentAnnotation> annots = new ArrayList<AlignmentAnnotation>();
+ // Search alignment to get all tcoffee annotation and pick one set of annotation to use to colour seqs.
+ seqMap = new IdentityHashMap<SequenceI, Color[]>();
+ for (AlignmentAnnotation al:alignment.getAlignmentAnnotation())
+ {
+ if (al.sequenceRef!=null && !al.belowAlignment && al.label!=null && (al.label==TCoffeeScoreFile.TCOFFEE_SCORE || al.label.equals(TCoffeeScoreFile.TCOFFEE_SCORE)))
+ {
+ annots.add(al);
+ Color[] scores=new Color[al.annotations.length];
+ int i=0;
+ for (Annotation an:al.annotations)
+ {
+ scores[i++]=(an!=null) ? an.colour : Color.white;
+ }
+ seqMap.put(al.sequenceRef, scores);
+ }
+ }