X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=c3ccb0ba99b0eba2867bdc5ec17bf02a2e84eb07;hb=476d13d644d3bf2886519b13bc7f02d1ae9729f9;hp=e4d64fad3f16ab044886da976aa0432515584116;hpb=848bef9fdc243cfab564acb0b82fc7ee3bcffe9f;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index e4d64fa..c3ccb0b 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -27,6 +27,13 @@ package jalview.datamodel; */ 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 +50,7 @@ public class AlignmentAnnotation /** DOCUMENT ME!! */ public float graphMax; + public GraphLine threshold; // Graphical hints and tips @@ -58,16 +66,30 @@ public class AlignmentAnnotation /** DOCUMENT ME!! */ public boolean visible = true; + public int graphGroup = -1; + /** DOCUMENT ME!! */ public int height = 0; public int graph = 0; - public static int NO_GRAPH = 0; + public int graphHeight = 40; - public static int BAR_GRAPH = 1; + public static final int NO_GRAPH = 0; - public static int LINE_GRAPH = 2; + public static final int BAR_GRAPH = 1; + + public static final int LINE_GRAPH = 2; + + public static int getGraphValueFromString(String string) + { + if(string.equalsIgnoreCase("BAR_GRAPH")) + return BAR_GRAPH; + else if(string.equalsIgnoreCase("LINE_GRAPH")) + return LINE_GRAPH; + else + return NO_GRAPH; + } /** * Creates a new AlignmentAnnotation object. @@ -123,6 +145,7 @@ public class AlignmentAnnotation if (min == max) { + min = 999999999; for (int i = 0; i < annotations.length; i++) { if (annotations[i] == null) @@ -208,5 +231,37 @@ public class AlignmentAnnotation } return buffer.toString(); - } + } + + public void setThreshold(GraphLine line) + { + threshold = line; + } + + public GraphLine getThreshold() + { + return threshold; + } + + public void adjustForAlignment() + { + int a=0, aSize = sequenceRef.getLength(); + + int index = 0; + Annotation[] temp = new Annotation[aSize]; + + for (a = 0; a < aSize; a++) + { + if (!jalview.util.Comparison.isGap(sequenceRef.getCharAt(a))) + { + index = sequenceRef.findPosition(a); + if(datasetAnnotation.annotations.length>index) + temp[a] = datasetAnnotation.annotations[index]; + } + } + + annotations = temp; + } } + +