+ return LINE_GRAPH;
+ }
+ else
+ {
+ return NO_GRAPH;
+ }
+ }
+
+ /**
+ * Creates a new AlignmentAnnotation object.
+ *
+ * @param label
+ * short label shown under sequence labels
+ * @param description
+ * text displayed on mouseover
+ * @param annotations
+ * set of positional annotation elements
+ */
+ public AlignmentAnnotation(String label, String description,
+ Annotation[] annotations)
+ {
+ setAnnotationId();
+ // always editable?
+ editable = true;
+ this.label = label;
+ this.description = description;
+ this.annotations = annotations;
+
+ validateRangeAndDisplay();
+ }
+
+ /**
+ * Checks if annotation labels represent secondary structures
+ *
+ */
+ void areLabelsSecondaryStructure()
+ {
+ boolean nonSSLabel = false;
+ isrna = false;
+ StringBuffer rnastring = new StringBuffer();
+
+ char firstChar = 0;
+ for (int i = 0; i < annotations.length; i++)
+ {
+ // DEBUG System.out.println(i + ": " + annotations[i]);
+ if (annotations[i] == null)
+ {
+ continue;
+ }
+ if (annotations[i].secondaryStructure == 'H'
+ || annotations[i].secondaryStructure == 'E')
+ {
+ // DEBUG System.out.println( "/H|E/ '" +
+ // annotations[i].secondaryStructure + "'");
+ hasIcons |= true;
+ }
+ else
+ // Check for RNA secondary structure
+ {
+ // DEBUG System.out.println( "/else/ '" +
+ // annotations[i].secondaryStructure + "'");
+ // TODO: 2.8.2 should this ss symbol validation check be a function in
+ // RNA/ResidueProperties ?
+ if (annotations[i].secondaryStructure == '('
+ || annotations[i].secondaryStructure == '['
+ || annotations[i].secondaryStructure == '<'
+ || annotations[i].secondaryStructure == '{'
+ || annotations[i].secondaryStructure == 'A'
+ || annotations[i].secondaryStructure == 'B'
+ || annotations[i].secondaryStructure == 'C'
+ || annotations[i].secondaryStructure == 'D'
+ // || annotations[i].secondaryStructure == 'E' // ambiguous on
+ // its own -- already checked above
+ || annotations[i].secondaryStructure == 'F'
+ || annotations[i].secondaryStructure == 'G'
+ // || annotations[i].secondaryStructure == 'H' // ambiguous on
+ // its own -- already checked above
+ || annotations[i].secondaryStructure == 'I'
+ || annotations[i].secondaryStructure == 'J'
+ || annotations[i].secondaryStructure == 'K'
+ || annotations[i].secondaryStructure == 'L'
+ || annotations[i].secondaryStructure == 'M'
+ || annotations[i].secondaryStructure == 'N'
+ || annotations[i].secondaryStructure == 'O'
+ || annotations[i].secondaryStructure == 'P'
+ || annotations[i].secondaryStructure == 'Q'
+ || annotations[i].secondaryStructure == 'R'
+ || annotations[i].secondaryStructure == 'S'
+ || annotations[i].secondaryStructure == 'T'
+ || annotations[i].secondaryStructure == 'U'
+ || annotations[i].secondaryStructure == 'V'
+ || annotations[i].secondaryStructure == 'W'
+ || annotations[i].secondaryStructure == 'X'
+ || annotations[i].secondaryStructure == 'Y'
+ || annotations[i].secondaryStructure == 'Z')
+ {
+ hasIcons |= true;
+ isrna |= true;
+ }
+ }
+
+ // System.out.println("displaychar " + annotations[i].displayCharacter);
+
+ if (annotations[i].displayCharacter == null
+ || annotations[i].displayCharacter.length() == 0)
+ {
+ rnastring.append('.');
+ continue;
+ }
+ if (annotations[i].displayCharacter.length() == 1)
+ {
+ firstChar = annotations[i].displayCharacter.charAt(0);
+ // check to see if it looks like a sequence or is secondary structure
+ // labelling.
+ if (annotations[i].secondaryStructure != ' ' && !hasIcons &&
+ // Uncomment to only catch case where
+ // displayCharacter==secondary
+ // Structure
+ // to correctly redisplay SS annotation imported from Stockholm,
+ // exported to JalviewXML and read back in again.
+ // &&
+ // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure
+ firstChar != ' ' && firstChar != '$' && firstChar != 0xCE
+ && firstChar != '(' && firstChar != '[' && firstChar != '<'
+ && firstChar != '{' && firstChar != 'A' && firstChar != 'B'
+ && firstChar != 'C' && firstChar != 'D' && firstChar != 'E'
+ && firstChar != 'F' && firstChar != 'G' && firstChar != 'H'
+ && firstChar != 'I' && firstChar != 'J' && firstChar != 'K'
+ && firstChar != 'L' && firstChar != 'M' && firstChar != 'N'
+ && firstChar != 'O' && firstChar != 'P' && firstChar != 'Q'
+ && firstChar != 'R' && firstChar != 'S' && firstChar != 'T'
+ && firstChar != 'U' && firstChar != 'V' && firstChar != 'W'
+ && firstChar != 'X' && firstChar != 'Y' && firstChar != 'Z'
+ && firstChar != '-'
+ && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
+ {
+ if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) // TODO:
+ // parameterise
+ // to
+ // gap
+ // symbol
+ // number
+ {
+ nonSSLabel = true;
+ }
+ }
+ }