- /**\r
- *\r
- * @param aa AlignmentAnnotation\r
- * @param seqRef The sequence to associate this annotation with\r
- * @return The adjusted AlignmentAnnotation, with dataset sequence and annotation added\r
- */\r
- public AlignmentAnnotation addAnnotation(AlignmentAnnotation aa, SequenceI seqRef)\r
- {\r
- if(seqRef!=null)\r
- {\r
- //We can only add Annotations to the dataset sequences\r
- if(seqRef.getDatasetSequence()==null)\r
- {\r
- setDataset(null);\r
- }\r
-\r
- AlignmentAnnotation [] old = seqRef.getDatasetSequence().getAnnotation();\r
-\r
- //First check if this is a new annotation or not. If it is new,\r
- //we must add the annotation to the dataset\r
- boolean newAnnotation = true;\r
- if(seqRef.getDatasetSequence().getAnnotation()!=null)\r
- {\r
- for(int a=0; a<old.length; a++)\r
- {\r
- if(old[a] == aa)\r
- {\r
-\r
- newAnnotation = false;\r
- break;\r
- }\r
- }\r
- }\r
-\r
- if(newAnnotation)\r
- {\r
- seqRef.getDatasetSequence().addAlignmentAnnotation(aa);\r
- }\r
-\r
- AlignmentAnnotation copy = null;\r
- if (aa.graph > 0)\r
- copy = new AlignmentAnnotation(\r
- aa.label, aa.description, aa.annotations, aa.graphMin,\r
- aa.graphMax, aa.graph\r
- );\r
- else\r
- copy = new AlignmentAnnotation(\r
- aa.label, aa.description, aa.annotations\r
- );\r
-\r
- copy.datasetAnnotation = aa;\r
-\r
- addAnnotation(copy);\r
-\r
- copy.sequenceRef = seqRef;\r
-\r
- return copy;\r
- }\r
- else\r
- {\r
- addAnnotation(aa);\r
- return aa;\r
- }\r
- }\r