X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=d6eb3eaa986943f0b4f75447c5f6df7fc1118d2b;hb=4851c84266e61a5be2244cb002fdd5f02f2a4140;hp=470497e12ceff0a258443205d43fa153667df87b;hpb=c11a4dfd307ba4a13d1b4cd7d5a21f8a56a06da9;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 470497e..d6eb3ea 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -103,21 +103,54 @@ public class AlignmentAnnotation this.description = description; this.annotations = annotations; - for (int i = 0; i < annotations.length; i++) + areLabelsSecondaryStructure(); + } + + void areLabelsSecondaryStructure() + { + boolean nonSSLabel = false; + for (int i = 0; i < annotations.length; i++) + { + if(annotations[i]==null) + continue; + + if (annotations[i].secondaryStructure == 'H' || + annotations[i].secondaryStructure == 'E') { - if ((annotations[i] != null) && - ((annotations[i].secondaryStructure == 'H') || - (annotations[i].secondaryStructure == 'E'))) - { - hasIcons = true; - } + hasIcons = true; + } + + if (annotations[i].secondaryStructure != 'H' + && annotations[i].secondaryStructure != 'E' + && annotations[i].secondaryStructure != '-') + { + nonSSLabel = true; + } + + if (annotations[i].displayCharacter.length() > 0) + { + hasText = true; + } + } + + if(nonSSLabel) + { + hasIcons = false; + for (int j = 0; j < annotations.length; j++) + { + if(annotations[j] !=null && annotations[j].secondaryStructure!=' ') + { + annotations[j].displayCharacter + =String.valueOf(annotations[j].secondaryStructure); + annotations[j].secondaryStructure = ' '; + if(annotations[j].description.length()<1) + annotations[j].description = annotations[j].displayCharacter; + } - if ((annotations[i] != null) && - (annotations[i].displayCharacter.length() > 0)) - { - hasText = true; - } } + + } + } /** @@ -171,23 +204,7 @@ public class AlignmentAnnotation graphMin = min; graphMax = max; - for (int i = 0; i < annotations.length; i++) - { - if (!hasIcons - && annotations[i] != null - && ((annotations[i].secondaryStructure == 'H') || - (annotations[i].secondaryStructure == 'E'))) - { - hasIcons = true; - } - - if (!hasText - && annotations[i]!=null - && annotations[i].displayCharacter.length() > 0) - { - hasText = true; - } - } + areLabelsSecondaryStructure(); if(!drawValues && graphType!=NO_GRAPH) { @@ -258,9 +275,10 @@ public class AlignmentAnnotation } /** - * Attach the annotation to seqRef, starting from startRes position. + * Attach the annotation to seqRef, starting from startRes position. If alreadyMapped is true then the indices of the annotation[] array are sequence positions rather than alignment column positions. * @param seqRef * @param startRes + * @param alreadyMapped */ public void createSequenceMapping(SequenceI seqRef, int startRes,