From: amwaterhouse Date: Mon, 30 Jan 2006 14:48:47 +0000 (+0000) Subject: AddAnnotation with start index X-Git-Tag: Root_VamJalview_2_07b+~209 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7e4c4ad887a30dc26496087b0150f4ac2fe355ec;p=jalview.git AddAnnotation with start index --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index e9af7f4..2545ec1 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -642,6 +642,27 @@ public class Alignment implements AlignmentI annotations = temp; } + + public void addAnnotation(AlignmentAnnotation aa, SequenceI seqRef, int index) + { + aa.refSequence = seqRef; + if(seqRef!=null && index!=0) + { + int aSize = aa.annotations.length; + int newIndex; + Annotation [] temp = new Annotation[seqRef.getLength()]; + for(int a=0; a 1) { - for (i = 0; i < (aSize - 1); i++) + for (i = 1; i < (aSize); i++) { - temp[i] = annotations[i]; + temp[i] = annotations[i-1]; } } - temp[i] = aa; - annotations = temp; } diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index e4d64fa..fcf9844 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -27,6 +27,8 @@ package jalview.datamodel; */ public class AlignmentAnnotation { + public SequenceI refSequence; + /** DOCUMENT ME!! */ public String label; @@ -43,6 +45,7 @@ public class AlignmentAnnotation /** DOCUMENT ME!! */ public float graphMax; + public java.util.Vector graphLines; // Graphical hints and tips @@ -58,16 +61,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 +140,7 @@ public class AlignmentAnnotation if (min == max) { + min = 999999999; for (int i = 0; i < annotations.length; i++) { if (annotations[i] == null) @@ -208,5 +226,24 @@ public class AlignmentAnnotation } return buffer.toString(); - } + } + + public void addGraphLine(GraphLine line) + { + if(graphLines==null) + graphLines = new java.util.Vector(); + + graphLines.add(line); + } + + public GraphLine getGraphLine(int index) + { + if(graphLines!=null && index