}
if (row.hasIcons)
{
+ char ss=row.annotations[column].secondaryStructure;
+ if (ss=='S')
+ {
+ // distinguish between forward/backward base-pairing
+ if (row.annotations[column].displayCharacter.indexOf(')')>-1)
+ {
+ ss='s';
+ }
+ }
if (!validRes
- || (row.annotations[column].secondaryStructure != lastSS))
+ || (ss != lastSS))
{
if (x > -1)
{
break;
case 'S': // Stem case for RNA secondary structure
+ case 's': // and opposite direction
drawStemAnnot(g, row, lastSSX, x, y, iconOffset, startRes,
column, validRes, validEnd);
break;
}
if (validRes)
{
- lastSS = row.annotations[column].secondaryStructure;
+ lastSS = ss;
}
else
{
drawSheetAnnot(g, row, lastSSX, x, y, iconOffset, startRes,
column, validRes, validEnd);
break;
+ case 's':
case 'S': // Stem case for RNA secondary structure
drawStemAnnot(g, row, lastSSX, x, y, iconOffset, startRes,
column, validRes, validEnd);
int lastSSX, int x, int y, int iconOffset, int startRes,
int column, boolean validRes, boolean validEnd)
{
- g.setColor(STEM_COLOUR);
+ g.setColor(STEM_COLOUR);
int sCol = (lastSSX / av.charWidth) + startRes;
int x1 = lastSSX;
int x2 = (x * av.charWidth);
Regex closeparen = new Regex("(\\))");
-
- String dc="";
+
+ String dc = column==0 ? "" : row.annotations[column - 1].displayCharacter;
+
+ boolean diffupstream=sCol == 0 || row.annotations[sCol - 1] == null
+ || !dc.equals(row.annotations[sCol - 1].displayCharacter);
+ boolean diffdownstream=!validRes || !validEnd || row.annotations[column] == null
+ || !dc.equals(row.annotations[column].displayCharacter);
+ System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
// If a closing base pair half of the stem, display a backward arrow
- if (column>0 && closeparen.search(dc=row.annotations[column - 1].displayCharacter))
+ if (column > 0
+ && closeparen
+ .search(dc))
{
- if (sCol == 0 || row.annotations[sCol - 1] == null
- || !dc.equals(row.annotations[sCol - 1].displayCharacter))
- //if (validRes && column>1 && row.annotations[column-2]!=null && dc.equals(row.annotations[column-2].displayCharacter))
- { g.fillPolygon(new int[]
- { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
- x1+=5;
+ if (diffupstream)
+ // if (validRes && column>1 && row.annotations[column-2]!=null &&
+ // dc.equals(row.annotations[column-2].displayCharacter))
+ {
+ g.fillPolygon(new int[]
+ { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x1 += 5;
+ }
+ if (diffdownstream)
+ {
+ x2-=1;
}
}
else
{
// display a forward arrow
- if (!validRes || row.annotations[column] == null
- || !dc.equals(row.annotations[column].displayCharacter))
+ if (diffdownstream)
{
- g.fillPolygon(
- new int[]
- { x2 - 5, x2 - 5,
- x2 }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
- 3);
- x2-=5;
+ g.fillPolygon(new int[]
+ { x2 - 5, x2 - 5, x2 }, new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x2 -= 5;
+ }
+ if (diffupstream)
+ {
+ x1+=1;
}
}
// draw arrow body
- g.fillRect(x1, y + 4 + iconOffset, x2-x1, 7);
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
}
private void drawGlyphLine(Graphics g, AlignmentAnnotation row,