annotations = temp;\r
}\r
\r
+\r
+ public void addAnnotation(AlignmentAnnotation aa, SequenceI seqRef, int index)\r
+ {\r
+ aa.refSequence = seqRef;\r
+ if(seqRef!=null && index!=0)\r
+ {\r
+ int aSize = aa.annotations.length;\r
+ int newIndex;\r
+ Annotation [] temp = new Annotation[seqRef.getLength()];\r
+ for(int a=0; a<aSize; a++)\r
+ {\r
+ newIndex = seqRef.findIndex(a + index)-1;\r
+ temp[newIndex] = aa.annotations[a];\r
+ }\r
+\r
+ aa.annotations = temp;\r
+ }\r
+\r
+ addAnnotation(aa);\r
+ }\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
\r
\r
AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];\r
- int i = 0;\r
+\r
+ temp[0] = aa;\r
+\r
+ int i = 1;\r
\r
if (aSize > 1)\r
{\r
- for (i = 0; i < (aSize - 1); i++)\r
+ for (i = 1; i < (aSize); i++)\r
{\r
- temp[i] = annotations[i];\r
+ temp[i] = annotations[i-1];\r
}\r
}\r
\r
- temp[i] = aa;\r
-\r
annotations = temp;\r
}\r
\r
*/\r
public class AlignmentAnnotation\r
{\r
+ public SequenceI refSequence;\r
+\r
/** DOCUMENT ME!! */\r
public String label;\r
\r
/** DOCUMENT ME!! */\r
public float graphMax;\r
\r
+ public java.util.Vector graphLines;\r
\r
// Graphical hints and tips\r
\r
/** DOCUMENT ME!! */\r
public boolean visible = true;\r
\r
+ public int graphGroup = -1;\r
+\r
/** DOCUMENT ME!! */\r
public int height = 0;\r
\r
public int graph = 0;\r
\r
- public static int NO_GRAPH = 0;\r
+ public int graphHeight = 40;\r
\r
- public static int BAR_GRAPH = 1;\r
+ public static final int NO_GRAPH = 0;\r
\r
- public static int LINE_GRAPH = 2;\r
+ public static final int BAR_GRAPH = 1;\r
+\r
+ public static final int LINE_GRAPH = 2;\r
+\r
+ public static int getGraphValueFromString(String string)\r
+ {\r
+ if(string.equalsIgnoreCase("BAR_GRAPH"))\r
+ return BAR_GRAPH;\r
+ else if(string.equalsIgnoreCase("LINE_GRAPH"))\r
+ return LINE_GRAPH;\r
+ else\r
+ return NO_GRAPH;\r
+ }\r
\r
/**\r
* Creates a new AlignmentAnnotation object.\r
\r
if (min == max)\r
{\r
+ min = 999999999;\r
for (int i = 0; i < annotations.length; i++)\r
{\r
if (annotations[i] == null)\r
}\r
\r
return buffer.toString();\r
- }\r
+ }\r
+\r
+ public void addGraphLine(GraphLine line)\r
+ {\r
+ if(graphLines==null)\r
+ graphLines = new java.util.Vector();\r
+\r
+ graphLines.add(line);\r
+ }\r
+\r
+ public GraphLine getGraphLine(int index)\r
+ {\r
+ if(graphLines!=null && index<graphLines.size())\r
+ return (GraphLine)graphLines.elementAt(index);\r
+\r
+ else\r
+ return null;\r
+ }\r
}\r
+\r
+\r
public void addAnnotation(AlignmentAnnotation aa);\r
\r
/**\r
+ * Adds a new AlignmentAnnotation to this alignment,\r
+ * associated to Sequence starting at sequence index\r
+ */\r
+ public void addAnnotation(AlignmentAnnotation aa, SequenceI seqRef, int index);\r
+\r
+ /**\r
* Deletes a specific AlignmentAnnotation from the alignment.\r
*\r
* @param aa DOCUMENT ME!\r