import javax.swing.*;
+import com.stevesoft.pat.Regex;
+
import jalview.analysis.AAFrequency;
import jalview.datamodel.*;
import jalview.schemes.ColourSchemeI;
final String SHEET = "Sheet";
+ /**
+ * For RNA secondary structure "stems" aka helices
+ */
+ final String STEM = "RNA Helix";
+
final String LABEL = "Label";
final String REMOVE = "Remove Annotation";
final Color SHEET_COLOUR = Color.green.darker().darker();
+ final Color STEM_COLOUR = Color.blue.darker();
+
/** DOCUMENT ME!! */
AlignViewport av;
symbol = "\u03B2";
}
+ // Added by LML to color stems
+ else if (evt.getActionCommand().equals(STEM))
+ {
+ type = 'S';
+ symbol = "\u03C3";
+ }
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
continue;
String tlabel = null;
if (anot[index] != null)
- {
+ { // LML added stem code
if (label2.equals(HELIX) || label2.equals(SHEET)
- || label2.equals(LABEL))
+ || label2.equals(STEM) || label2.equals(LABEL))
{
tlabel = anot[index].description;
if (tlabel == null || tlabel.length() < 1)
{
- if (label2.equals(HELIX) || label2.equals(SHEET))
+ if (label2.equals(HELIX) || label2.equals(SHEET)
+ || label2.equals(STEM))
{
tlabel = "" + anot[index].secondaryStructure;
}
item = new JMenuItem(SHEET);
item.addActionListener(this);
pop.add(item);
+ item = new JMenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
item = new JMenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
break;
+ case 'S': // Stem case for RNA secondary structure
+ g.setColor(STEM_COLOUR); // row.annotations[column].colour for By
+ // RNA Helices colouring
+ // System.out.println("last SSX displayx" +
+ // row.annotations[column-1].displayCharacter +"x");
+ Regex closeparen = new Regex("(\\))");
+
+ //If a closing base pair half of the stem, display a backward arrow
+ if (closeparen
+ .search(row.annotations[column - 1].displayCharacter))// row.annotations[column-1].displayCharacter))
+ {
+ g.fillPolygon(new int[]
+ { lastSSX + 5, lastSSX + 5, lastSSX },
+ new int[]
+ { y + iconOffset, y + 14 + iconOffset,
+ y + 8 + iconOffset }, 3);
+ g.fillRect(lastSSX + 2, y + 4 + iconOffset,
+ (x * av.charWidth) - lastSSX - 2, 7);
+ }
+ else //display a forward arrow
+ {
+ g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
+ - lastSSX - 4, 7);
+ g.fillPolygon(new int[]
+ { (x * av.charWidth) - 5, (x * av.charWidth) - 5,
+ (x * av.charWidth) },
+ new int[]
+ { y + iconOffset, y + 14 + iconOffset,
+ y + 8 + iconOffset }, 3);
+ }
+ break;
+
default:
g.setColor(Color.gray);
g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)