X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=5a2c46e0b3e2be52032af8a67f02cfbefdde6cfc;hb=54904100ca490c7ca4484a88bf40963e48a35eec;hp=c3ccb0ba99b0eba2867bdc5ec17bf02a2e84eb07;hpb=f2a4334ccce440e1e84bab27ec5d08af1494a7f8;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index c3ccb0b..5a2c46e 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -29,11 +29,6 @@ public class AlignmentAnnotation { public SequenceI sequenceRef; - /** This annotation is the original loaded annotation - * without any gaps. It is necessary to adjust the annotation - * if sequences are updated */ - public AlignmentAnnotation datasetAnnotation; - /** DOCUMENT ME!! */ public String label; @@ -43,6 +38,7 @@ public class AlignmentAnnotation /** DOCUMENT ME!! */ public Annotation[] annotations; + public java.util.Hashtable sequenceMapping; /** DOCUMENT ME!! */ public float graphMin; @@ -143,6 +139,8 @@ public class AlignmentAnnotation this.annotations = annotations; graph = graphType; + boolean drawValues = true; + if (min == max) { min = 999999999; @@ -153,6 +151,11 @@ public class AlignmentAnnotation continue; } + if(drawValues && annotations[i].displayCharacter.length() > 1 ) + { + drawValues = false; + } + if (annotations[i].value > max) { max = annotations[i].value; @@ -170,19 +173,30 @@ public class AlignmentAnnotation for (int i = 0; i < annotations.length; i++) { - if ((annotations[i] != null) && - ((annotations[i].secondaryStructure == 'H') || + if (!hasIcons + && annotations[i] != null + && ((annotations[i].secondaryStructure == 'H') || (annotations[i].secondaryStructure == 'E'))) { hasIcons = true; } - if ((annotations[i] != null) && - (annotations[i].displayCharacter.length() > 0)) + if (!hasText + && annotations[i]!=null + && annotations[i].displayCharacter.length() > 0) { hasText = true; } } + + if(!drawValues && graphType!=NO_GRAPH) + { + for (int i = 0; i < annotations.length; i++) + { + if (annotations[i] != null) + annotations[i].displayCharacter = ""; + } + } } /** @@ -243,21 +257,69 @@ public class AlignmentAnnotation return threshold; } + /** + * This + */ + public void createSequenceMapping(SequenceI seqRef, int startRes) + { + if(seqRef == null) + return; + + sequenceMapping = new java.util.Hashtable(); + + sequenceRef = seqRef; + + if(startRes < sequenceRef.getStart()) + startRes = sequenceRef.getStart(); + + int seqPos; + + int fileOffset = 0; + if(startRes > sequenceRef.getStart()) + { + fileOffset = startRes - sequenceRef.getStart(); + } + + for(int i = 0; i < annotations.length; i++) + { + seqPos = sequenceRef.findPosition(i + fileOffset); + if(seqPosindex) - temp[a] = datasetAnnotation.annotations[index]; - } + index = new Integer(a); + if(sequenceMapping.containsKey(index)) + { + position = sequenceRef.findIndex(a)-1; + + temp[position] = (Annotation)sequenceMapping.get(index); + } } annotations = temp;